MATLAB Answers

Build offline application installer with gitlab CI for external deployment

45 views (last 30 days)
Ejelli
Ejelli on 30 Aug 2019
Hi there,
How can build an offline application installer via gitlab CI for external deployment?
I tried the past day(s) to automatize the packaging of offline installer for our MATLAB application with gitlab CI. In theory this should be quite simple:
So this .gitlab-ci.yml should do the job on a gitlab runner (batch) on a windows system with an usable MATLAB licence :
build_installer:
stage: build
tags:
- windows
- matlab
script:
- call deploytool.bat -package myMatlabProject.prj
It works fine if the project file uses the option Runtime downloaded from web. However we noticed that the installation process for some users fail due to issues with the MCR download.
Since we can not really provide support for every users on how to setup the connection settings correctly, we decided to provide a version with a the runtime included.
This should be as simple as swapping the project definition
myMatlabProject.prj
in the above .gitlab-ci.yml with a sligthly different one which uses the option Runtime included in package
myMatlabProject_MCR.prj
Unfortunately the corrsponding gitlab job fails with the error message:
Start build and package process
Packaging...
Creating the bundle...
Cached offline installer not generated or is invalid. Run the package command from MATLAB to generate the offline installer cache.
No installer package created.
Package failed
So I proceeded with running deploytool from within matlab on the same machine where the gitlab runner is installed with an non-gitlabrunner user account:
system('call deploytool.bat -package myMatlabProject_MCR.prj')
Which works fine, but is not part of the CI pipeline.
I figured out (can not remember how) that the cached offline installer for MATLAB R2017b is available in
C:\Users\%USERNAME%\AppData\Local\Temp\%USERNAME%\installAgent9.3\win64\InstallAgent_35000_35001_35010.zip
So I renamed the file such that the system can not find it anymore, and get the same error message as the gitlab runner:
Start build and package process
Packaging...
Creating the bundle...
Looking for offline installer cache in C:\Users\####\AppData\Local\Temp\####\installAgent9.3\win64\InstallAgent_35000_35001_35010.zip.
Cached offline installer not generated or is invalid. Run the package command from MATLAB to generate the offline installer cache.
No installer package created.
Package failed
Next I tried to call the deploytool from a matlab script called buildMCR.m:
deploytool -package myMatlabProject_MCR.prj
exit
If I run this script via command line it generates InstallAgent_35000_35001_35010.zip in the previously mentioned folder and the executable is build correctly:
system("matlab -nodisplay -nodesktop -nosplash -wait -logfile build.log -r run(' buildMCR.m')")
The corresponding .gitlab-ci.yml howerver, does not build the executable:
build_installer:
stage: build
tags:
- windows
- matlab
script:
- matlab -nodisplay -nodesktop -nosplash -wait -logfile build.log -r run('deployment\buildWithMCR.m')
- type build.log
Unforunatunately the content of build.log is everthing but verbose:
Warning: Unable to locate a personal folder for $documents\MATLAB
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
Does anyone have an idea how I can build an installer with MCR included via gitlab CI?
Eric

  0 Comments

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by