Reputation: 3919
I am using Jenkins to create a build pipeline, and need to trigger a deployment step in the pipeline. This means a manual process (the build occurs automatically, timed, then stops at the deployment stage, waiting for manual authorization).
I need the deploy step to also be triggered with parameters from the prior step.
So, using the 'Parameterized plugin' I can pass parameters between jobs. I can trigger automated OR manually triggered downstream jobs (not sure if this is a standard feature, or manual builds was added by some plugin).
However, I cannot find any way to trigger a manual parameterized job.
Does anyone know of a way to do this? Is there another plugin I can use?
The reason I need the parameters is that I have created a generic deployment job, and need to pass in the module name, and maven version to deploy. I could create specific deployment jobs for each module, but this would be very painful.
I have also been considering the following, but it seems a kludge:
There are various problems with this approach
Upvotes: 13
Views: 28847
Reputation: 732
In my opinion there is no possibility to achieve the goal
When you start the pipeline delivery-pipeline-plugin checks only the parameters of first job -> and then display (or not) the initParam screen
But when next step (for example deploy) is manual and it required paramaters then the initParam screen is ignored Look at issue https://issues.jenkins-ci.org/browse/JENKINS-32336
Upvotes: 0
Reputation: 9705
Current production version (1.4.2) of build-pipeline-plugin allows it - to specify manual downstream job with parameters, which is displayed on the pipeline and can be started from there. Old versions couldn't do it.
Upvotes: 7
Reputation: 9705
There is a sort of workaround:
Once you manually promote a specific build of upstream job, it will fire up a build of downstream job. But the downstream job will not appear on the pipeline.
Upvotes: 2
Reputation: 5836
The Build Pipeline Plugin can do this, but at the time of this writing, not in any released version. I built the plugin from main (rev 392 at the time), which includes the patch mentioned in this issue and it works for me.
When you have that installed, you are able to use a post-build action called "Build other projects (manual step)" in the first job and there you can configure the parameters to be passed to the second (manually triggered) pipeline job.
Upvotes: 1
Reputation: 21
Take a look at the Build Pipeline Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin.
You can specify jobs to be automatically triggered or manually triggered.
Also if you need parameter passing between jobs you will need to download the Groovy Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin
In order to pass parameters lets say an SVN revision between jobs you will need to Execute System Groovy Script at the start of your build. This is an example that will add a SVN_UPSTREAM parameter that can be used by any downstream jobs. NOTE: I have noticed a problem with creating a downstream job that also has a system groovy script. It seems to blow away any references to the original parameters created.
import hudson.model.*
def build = Thread.currentThread().executable;
build.addAction(new ParametersAction(new StringParameterValue("SVN_UPSTREAM", build.getEnvVars()['SVN_REVISION'])));
println "SVN_UPSTREAM:" + build.getEnvVars()['SVN_UPSTREAM'];
Upvotes: 2