Matlab and Jenkins CI

13 visualizaciones (últimos 30 días)
Simon Parten
Simon Parten el 3 de Sept. de 2015
Respondida: Houman Rastegarfar el 14 de Jul. de 2023
In brief, I'm hoping to take over a matlab project of moderate complexity. The strategy is to unit test. My experience is that continuous integration is a very effective tool for automating these kinds of activities. I've tried to follow this post;
But I'm stuck. Matlab appears to not communicate with any other process which spawns it - I've tried from the command window and I have the same problem. In the blog post, Andrew Campbell is able to print 'hello world' to the jenkins console via the matlab process.
I cannot achieve this, or actually even get the matlab splash info to be displayed in either jenkins or just a pure cmd window. Even using the -nodesktop modifier, it simply spawns it's own custom console rather than using the existing one.
I have matlab R2015a and windows 8.1.
Has anyone successfully setup Jenkins on windows with Matlab? I'm hoping someone can confirm it should be possible possible before I spend more time on it? It's the sort of thing I had hoped would be easy :-(.
  2 comentarios
Simon Parten
Simon Parten el 3 de Sept. de 2015
More info;
I downloaded the example project from this post.
I can run the tests from the command line using this in the cmd shell, which opens a matlab console.
matlab -nosplash -nodesktop -wait -r "loadTestModule;runUnitTestsAutomatic" -sd "C:/temp/aahhhh/example_project"
But trying to run the same in jenkins fails... basically withou any further help.
Simon Parten
Simon Parten el 3 de Sept. de 2015
So, after more poking around, I found the matlab -logfile option. Apparently starting Matlab from the command line meant that matlab didn't find it's license file, and failed silently.
Now, I've added a -c option, which points matlab to a valid license file...
Current behaviour is that it appears to kick off a 'matlab start' process, and a matlab process, and then hangs ...
- The logfile is blank - After 5 minutes there is no activity

Iniciar sesión para comentar.

Respuesta aceptada

Simon Parten
Simon Parten el 3 de Sept. de 2015
Editada: Simon Parten el 3 de Sept. de 2015
So, it appears to depend on how you install Jenkins. To someone reading this who wants matlab - Jenkins CI on windows. Some hints;
Do NOT install jenkins as a windows installer from the jenkins homepage It sets itself up as a windows service with some sort of service account. I didn't have permission to mess with that and set it to be myself, so I and ended up in a world of pain.
For success, suggest a different strategy of setting up your own webserver and hosting jenkins inside. Sounds harder than it is;
  1. download and extract tomcat from a zip file
  2. download jenkins war file and place in webapp directory of downloaded tomcat
  3. modify tomcat-users.xml to include yourself as a tomcat user with manager-gui role
  4. setup the JAVA_HOME enivronment variable to reference your java installation
  5. move to tomcat bin dir and type 'start' ... for whatever reason, this appears to be the key part as it means jenkins ends up running as you, not a service account.
Note that you now have a potentially unsecured webserver available to whoever can see your computer... this may not be wise.
However you can now follow the instructions Andrew lays out in the two CI blog posts and actually automate running some tests - woot.
  2 comentarios
Erwin Hoogerwerf
Erwin Hoogerwerf el 16 de Sept. de 2019
An alternative method to achieve the same as the solution by Simon above, which will also work if you have already installed Jenkins as a service. We can actually change the user account that is used to run the Jenkins service.
  1. In windows services, search for the jenkins service -> properties -> log on (tab) and tell windows to use a specific account. Here, use an account that can start Matlab. This can be the current user, but be aware this can be abused as mentioned above.
  2. Go to the jenkins home folder and open jenkins.xml in any text editor. Change the name field to the specific account used in the step above.
  3. Restart the jenkins service
Brandon Smith
Brandon Smith el 12 de Jun. de 2020
I second Erwin's comment. This is substantially easier to do. Just open the Windows 'Serviced' App and look for the already installed Jenkins service.

Iniciar sesión para comentar.

Más respuestas (1)

Houman Rastegarfar
Houman Rastegarfar el 14 de Jul. de 2023
You can install the MATLAB plugin for Jenkins to easily run a MATLAB build, as well as MATLAB tests, scripts, functions, and statements. For more information, see Continuous Integration with MATLAB on Jenkins.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by