Potential problem from Gitlab runner pipeline on windows (powershell)
Mostrar comentarios más antiguos
Dear All
I have encountered some problems with gitlab pipeline script which composed by powershell executor..
I appreciated whoever experienced with this kind of problem comment anything that I could try...
There is no error in command log when I run this pipeline, however matlab.exe seems not operating actually...
# stage
stages:
- command
mfile_command:
stage: command
tags: [my-runner-windows-]
only:
- main
script:
- 'C:\"Program Files"\MATLAB\R2023b\bin\matlab.exe'
- powershell -command "Start-Sleep -Seconds 60"
4 comentarios
Angelo Yeo
el 29 de Mzo. de 2024
- What is the purpose of running MATLAB Desktop with command, and why GitLab?
- What do you mean by "however matlab.exe seems not operating actually..."? Can you elaborate the issue?
태현
el 29 de Mzo. de 2024
Angelo Yeo
el 29 de Mzo. de 2024
(1) Would you mind taking a look at the answer below?
In short, try the below:
script:
- 'powershell.exe "C:\Program Files\MATLAB\R2023b\bin\matlab.exe"'
(2) If you want to run a script with MATLAB from command window, you can use "-r" option. For example, if you want to run myscript.m via command,
script:
- 'powershell.exe "C:\Program Files"\MATLAB\R2023b\bin\matlab.exe" -r myscript'
More information can be found from the doc below.
태현
el 1 de Abr. de 2024
Respuestas (3)
Divyanshu
el 2 de Abr. de 2024
0 votos
Hi,
A possible cause of such errors in powershell is because of spaces present in the path of executable you are trying to execute. As a workaround you can refer these steps:
- Firstly execute cd '<Path to the bin folder containing the .exe of MATLAB>' in Windows Powershell. Entire path should be in single qoutes.
- Then you can execute this command powershell matlab.exe -r myscript, which would launch MATLAB.
Hope it helps!
1 comentario
태현
el 3 de Abr. de 2024
Strider
el 8 de Dic. de 2024
0 votos
I had to use the following to force the gitlab runner to "wait" on MATLAB
matlab -batch "myBuildScript" -wait
Otherwise the gitlab script would timeout and fail even through there were no MATLAB errors.
Hi,
I suggest trying C:\Progra~1\ instead of C:\Program Files\ to address the issue with the Program Files path.
Also, it’s better to check which account the Windows GitLab Runner is using when running MATLAB.
To do this:
- Run services.msc.
- Double-click the GitLab Runner service and go to the 'Log On' tab.
- Select 'This account' and enter the actual user account used for MATLAB.
- Restart the service.
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!