Plugin Information |
---|
Distribution of this plugin has been suspended due to unresolved security vulnerabilities, see below. |
The current version of this plugin may not be safe to use. Please review the following warnings before use:
Jenkins Groovy Axis Plugin
Description
This plugin allows to have scriptable axes for Matrix Jobs. Groovy is the scripting language being used.
The script will have to return a list of strings and each of the strings will be an element of the axis.
If the script does not return a list of strings then
[default]
will be returned instead.
Examples
Define an axis with three values:
return [ "Axis1", "Axis2", "Axis3" ]
Define the same axis programmatically:
def result = [] (1..3).each { result += "Axis"+it } return result
Define an axis whose values are the files in the root directory:
def dir = new File('/') def result = [] dir.eachFile { if (it.isFile()) { result += it.canonicalPath } } return result
Screenshot
14 Comments
Hila Peleg
Is it possible to include environment variables in the groovy script? I'd like things such as file paths to be dynamic...
Erik Zaadi
Just use : System.getenv("YOUR_ENV")
Ivan Zolotuhhin
Hi,
I am trying to create axis to deploy some content to choosen to all selected environments.
The idea is to setup "This build is parameterized" -> create booleans: QA_SERVER1, QA_SERVER2, QA_SERVER3
And if user select for example QA_SERVER1 & QA_SERVER3 it should execute only for this servers.
I wrote script (not only , but to understand my logic), but it not working.
How should I rewrite it to access custom booleans?
Emil Bäckmark
Ouch, this was not as dynamic as I hoped. The groovy script doesn't seem to be run for each build. It is only run when pressing Save/Apply in the project configuration. Could that be changed somehow? I have matrix values stored in files and I want them to be reread for every build.
Emanuele Zattin
There's a pull request in Jenkins core to address this issue.
Unknown User (maerkus)
I upgraded Jenkins to 1.472, which according to changelog has this feature implemented. Do I need to modify now something to actually get it working, as my axis definition updates still only when I apply/save job settings.
My axis is simple groovy script reading axis definition from a text file on web server as follows;
Bryan Schumaker
Is it possible to include build parameters in the script? For example, I could have another job pass in a list of Linux .config files and build a kernel for each.
Nikolay Martynov
I'm trying to trigger matrix jobs on all nodes of particular type. Since there are lots of configured nodes and some of them can be offline the plugin seems to be a natural choice. However, the things doesnt seem to work. The expression for axis values is
It correctly determines node names: [ superfrog1, pintov1, pintov2, swtsscg, gdrcw, pintov4, pecanv6 ]
However, when build is executed then things go wrong as Jenkins doesnt seems to be using axis values at all:Building remotely on swtsscg in workspace /ci/workspace/test/node/superfrog1
superfrog1 $ /bin/sh -xe /tmp/hudson5253422839681441452.sh
Label is superfrog1
Executing on swtsscg
So while axis label was superfrog1 build was executed on node stwsscg. Any suggestions?
ernstp -
Here's how to do it with build parameters, according to https://github.com/jenkinsci/groovyaxis-plugin/commit/945518d9c2b35376f9ddf8b72e71a7aeec65b9e8 :
cosmo king
I see the same behavior as Nickolay. Jobs with the discovered labels are executed, however they actually run on the wrong nodes. Has anyone looked into it?
I would love to get this plugin working!
cosmo king
This change fixes it for me (extend LabelAxis instead of Axis). I made my own fork of this plugin called GroovyLabelAxis which solves it nicely. Including ernstp's parameters option this givesreally nice functionality of choosing labels for the axis at job runtime
Dustin Masterson
Cosmo,
Have you published this fix anywhere? I am running into the same problem
Thanks.
Tatyana Che
I configure so that the Axis amount depended on the parameter build. But there is a problem:
let's build A has started 20 Axis and the next build B- 10. At the matrix A will be showed only 10 Axis icons and links. Is it possible to display the Axis as much as was used in the build?
Nikolay Martynov
You can spawn full matrix and then selectively skip configurations you are not interested in. You can colorize "skipped" builds and even add badges and explanations to them. Decision to skip is just a first step in the build. Could be groovy or shell. Groovy postbuild plugin can be used to check if build was skipped and colorize result for this configuration.