Azure Devops Pipeline CI Matlab Command Extension Bugs between R2019B and R2017B

5 views (last 30 days)
I have a working Azure CI pipeline doing building code gen operations with Matlab 2019. The Matlab project is written for Matlab 2017B. it also builds/work locally with Matlab 2017b or 2019b.
ENV:
It's a self-hosted windows 10 computer connected to Azure Pipelines with multiple version of Matlab. Matlab 2017B is a node-locked license. Matlab2019B is a floating license. Using this tool:
https://marketplace.visualstudio.com/items?itemName=MathWorks.matlab-azure-devops-extension
ACTION:
I changed the Matlab version used by the script to 2017B and ran my script to match production server specification.
steps:
- powershell: Write-Host '##vso[task.prependpath]C:\Program Files\MATLAB\R2017B\bin'
- task: RunMATLABCommand@0
inputs:
command: myscript
EXPECTED:
It to run without issues. Or, have 1-2 compatibility issues in the script, that I can debug as I go along.
RESULT:
It can't even set Matlab path when it inits. (Which is step 1 of opening matlab, not even part of my script ), hence it has access to no standard Matlab function, and everything breaks..
C:\WINDOWS\system32\cmd.exe /D /S /C "C:\agentS\_work\_tasks\RunMATLABCommand_28fdff80-51b4-4b6e-83e1-cfcf3f3b25a6\0.2.6\bin\run_matlab_command.bat "cd('C:\agentS\_work\_temp'); command_1ae12f20_c2aa_4b55_9c6c_6da1d64c4a30""
C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m: Cannot open file: permission denied.
[Warning: MATLAB did not appear to successfully set the search path. To recover for this session of MATLAB,
type "restoredefaultpath;matlabrc". To find out how to avoid this warning the next time you start MATLAB,
...
Undefined function or variable 'pwd'.
Error in buildSequence (line 1)
addpath(pwd);
Error in command_1ae12f20_c2aa_4b55_9c6c_6da1d64c4a30 (line 2)
buildSequence
ERROR: MATLAB error (starter line:1202) Exit Status: 0x00000001
INFO:
This are my finding & what I tried.
  1. check acess right to file
This is my acess to the 2 files for matlab 2019, 2017.
-rw-r--r-- 1 NARCISS Administrators 39652 Aug 17 13:35 pathdef.m (2017B Matlab)
-rw-r--r-- 1 NARCISS Administrators 45073 Sep 14 17:11 pathdef.m (2019B Matlab)
  1. Compare Azure & Local Acess to file
I know from Running this locally from my computer, from a terminal not in admin mode:
cat "C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m"
cat "C:\Program Files\MATLAB\R2019b\toolbox\local\pathdef.m"
That both file print to terminal.
And Running this from a Azure Pipeline with a Self-Hosted Windows computer(same computer as local), from a terminal not in admin mode:
cat "C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m"
cat "C:\Program Files\MATLAB\R2019b\toolbox\local\pathdef.m"
1st File get access denied, second print as regular.
So this could explain why script run good on 2019, but fail on 2017, because it doesn't have access right to the file?
  1. Try to replicate error on matlab locally
I opened Matlab GUI and matlab CLI, locally and tried said problematic line, without any issue.
addpath(pwd);
  1. Trying online solution to update pathdef.m
I tried doing these steps, with no change:
  1. https://www.mathworks.com/matlabcentral/answers/102432-why-do-i-receive-a-warning-regarding-missing-pathdef-m-when-starting-matlab-7-14-r2012a
  2. https://www.mathworks.com/help/matlab/matlab_env/when-path-not-successfully-set-at-startup.html
QUESTION:
I'm kind of stuck. I don't understand the difference in behavior from local CLI and Azure pipeline CLI? I'm not sure if the bug is in the matlab tool side? Any Idea on how to fix this bug?

Answers (1)

Samuel Narcisse
Samuel Narcisse on 2 Oct 2020
Well, I found a fix, after installing a second version of MATLAB2017B with another floating license(instead of a node locked license). I have all access rights when running it on Azure pipelines.
cat "C:\Program Files\MATLAB\R2017b\toolbox\local\pathdef.m"
cat "C:\Program Files\MATLAB\R2017b2\toolbox\local\pathdef.m"
cat "C:\Program Files\MATLAB\R2019b\toolbox\local\pathdef.m"
1st one is still access denied. But the 2 others works. R2017B and R2019B. Hence, my MATLAB project open & build as it did with the MATLAB 2019b release.
I'm not sure if it was a acess issue or a licensing issue, see ref below. but it works. ^^. Anyone is free to chyme in, for my general knowledge.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!