FMI Toolbox Matlab Azure Devops CI Pipeline Bugs with network service account

169 views Asked by At

I'm making a CI pipeline for a Matlab/Simulink project on Azure DevOps. The build pipeline is stable and reproduce same output as local computer execution. The test pipeline however is bugging. Any solution is welcome!

Action:

My project uses Modelon FMI toolbox to run plant models. My local computer runs all matlab unit test, which run a Simulink file including my Modelon FMU, without any issue and generate a jUnit Test report xml. I called the same files to run using a azure-pipeline.yml file.

Expected:

I expected the same result as my local run with the same pass/fail result showed on the job run CLI.

Result:

At execution from Azure Pipeline those FMU plant cause a failure on all my test. it's the same error 29 times.
https://www.modelon.com/products-services/modelon-deployment-suite/fmi-toolbox/

Error occurred in TestSim/testSim(File=****************_slx) and it did not run to completion.
---------
Error ID:
---------
'Simulink:modelReference:NormalModeSimulationError'
--------------
Error Details:
--------------
Error using testRunner (line 18)
An error occurred during simulation of Model block '*******************/PLANT_*****'.
Error in TestSim/testSim (line 31)
simOutRes = testRunner(File,duration);
Caused by:
Error using testRunner (line 18)
An error occurred during simulation of Model block 'PLANT_*****/*****/************'.
Error using testRunner (line 18)
Error reported by S-function 'sfun_fmu_cs_********' in 'PLANT_******************/******************************':
Error: FMI Toolbox running in DEMO mode: Only examples included in the FMI Toolbox distribution can be run.
Please contact [email protected] in order to obtain an evaluation license or to purchase FMI Toolbox for MATLAB.
================================================================================

Info:

This is what I tried.

  1. I verified I had the appropriate licenses:
Version of the Licensing toolkit client library
    v11.10.0.0 build 95001 x64_n6
---------------------
Performing test for feature: FMI_TOOLBOX
    Feature: 'FMI_TOOLBOX'
    Feature version: '2021.0625'
    Feature is checked out
License type:
    Server license IP: ******.******.***.***
    2/2 licenses in use
Expiration date:
    25-jun-2021
Number of days until expiration:
    246
Start date:
    10-jun-2020
License number:
    ****-****-****-****-****-****-****-****
Daemon name:
    modelon
Notice:
    Customer ************* Product FMI ToolBox for Matlab
Issuer:
    Modelon AB

  1. I changed the user account of the Azure Pipeline Agent Service that was running to my own account and all worked fine . It build & test all my FMU blocks like it did locally and then publish report on Azure Pipelines. I see the bug only happens on Azure default network service account. For security reasons and other reasons, I would also like it to work on network services.

  2. I did some quick lecture online.

1

There are 1 answers

0
Weltgeist On BEST ANSWER

SOLUTION:

I found that Network Service Account and My User Account use different %APPDATA% folder.

C:\Users\*******\AppData\Roaming\Modelon\Licenses\Server

and

C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\Modelon\Licenses\Server

In the network service folder I had nothing, but in my folder I had a fmi_licence.lic file with this content:

SERVER **************.com ANY  *****
USE_SERVER

Upon adding the file to my Network service %APPDATA%, and adding these line to my Azure Pipeline YMAL File, the licence checked out to be a working network license and my project stopped working on DEMO mode when running on Network Service Account.

 #Making FMI Toolbox licence check
  - script: |
      echo fmitoolbox_license; > fmitoolboxLicenseCheck.m
    displayName: 'Making FMI Toolbox licence check' 

#FMI Toolbox licence check Action
  - task: RunMATLABCommand@0
    inputs:
      command: fmitoolboxLicenseCheck
    displayName: 'FMI Toolbox Licence Check Action'

More reading:

Find temp folder for user Network Service?

https://superuser.com/questions/197576/network-service-account-password