Developer Zone

Advanced Software Development with MATLAB

Kick the Buckets 3

Posted by Andy Campbell,

OK, quick follow up to last post. Having a parameterized build is great, but it presents us with one problem. I can guarantee you I will pretty much never click the button to kick off builds manually for other parameters.

Well, never fear since you can use the parameterized scheduler plugin to get that additional feature. This will allow you to still have the build parameters as specified with one default build, but then you can schedule additional values based on the cron-like scheduling grammar. So, if we'd like to run our Standard tests on every commit, our Performance tests nightly, and our Deferred tests once a week, just install the parameterized plugin and set up your schedule to look something like this:

In this example, we are polling the SCM system every 5 minutes for our standard job. Since "Standard" is the default parameter we don't need to specify it at all. Then the parameterized scheduler allows us to specify a single hashed minute and hour (this is what the "H" means in the specification) for the Performance tests and a single hashed minute, hour, and day of the week for the Deferred tests. We could just as easily specify the specific time of day and day of week that we'd like these to run, but the hashing feature is a way to attempt a bit of load balancing on the Jenkins server by letting Jenkins choose the time to run based on a hash of the project. This is useful because we don't want all jobs to get scheduled at typical times humans tend to schedule things (like midnight, etc).

There we go, now my system is set up to test my MATLAB and Simulink projects with reckless abandon!

On another note. We talk a lot of Jenkins on this blog, but its definitely not the only CI system out there, and definitely not the only one we support and are working to improve. Are you using something else? If so, what are you using? Do you have any questions about how to set up a build for another system? Definitely open to hear your experiences.

Get the MATLAB code

Published with MATLAB® R2018b

3 CommentsOldest to Newest

Nicolas BERNARD replied on : 1 of 3
Instead of using parametrized build trigger, another working strategy is to set up a Jenkins pipeline in a Groovy Shared Library and to call it with different arguments for each of your different pipeline (for instance build, unit test, performance). We found that the other advantage of having this as a shared Library is that you can share between different projects the same CI mechanisms, with limited amount of maintenance
David Barry replied on : 2 of 3
Hi Andy, We currently use Jenkins. However, we have recently moved over to the Atlassian toolset and are using Bitbucket and JIRA. With the Atlassian tools we now have access to Bamboo and we are considering a move over to it from Jenkins so that everything is integrated in to one system. Do you have any feedback on Bamboo vs Jenkins, know of others using it with MATLAB or have any tips & tricks you can share?
@Nicolas Yes that is a great strategy! Perhaps that could be a good follow up post. Definitely the more of our configuration we can put into code the better. @David Ha! There's another "bucket", BitBucket! There are definitely people using Bamboo with MATLAB and it certainly can be done out of the box with things like the TAPPlugin and the XMLPlugin to get MATLAB test results in there. Because Atlassian likes Clover the last I checked it didn't have support for coverage using Cobertura. In general, Bamboo does not have as rich of an ecosystem as Jenkins, but it is also more in control of a company who can work to streamline the tool and the workflows, especially with the rest of the Atlassian suite. I'd definitely suggest you try it out with a couple smaller projects to evaluate it against your current Jenkins setup. Also, have you looked at Bitbucket Pipelines? Just curious if you plan to host your CI server or whether you think you may ever move to a hosted service.