I have a build with mulitple parameterised choices
How do trigger these Parameterized choies?
I have tried to enter the /buildWithParameters URL with said choice but it doesnt seem to be working.
See Launching a build with parameters section in Parameterized Build:
http://server/job/myjob/buildWithParameters?token=TOKEN&REQUESTED_ACTION=greeting
Related
I used jenkins remote trigger build option at job A and triggered another job B. When I open job B build, I could see "Started by remote project <path to job A>". I am trying to get the value from job B after execution but I not working. I tried working with BuildUser plugin which gave null output. Could someone help me to find a way to find the information?
The Parameterized Remote Trigger Plugin job setup options have a section Build Info with a field Parameters. Define parameters there like:
TRIGGERED_BY_JOB=${JOB_NAME}
TRIGGERED_BY_BUILD_NO=${BUILD_NUMBER}
and use them accordingly in your job B.
See Jenkins Set Environment Variables for other available information.
Using Jenkins, I am trying to arrange for the success of one build to trigger another build, so that there will be a cascade of builds until failure.
Given three projects (project1, project2, and project3), I am using Parameterized Trigger Plugin. How should I write the condition in the "Predefined parameters" field.
For example:
project1->success then trigger project2->success then trigger project3
In Jenkins I configure freestyle job.
Use a wrapper job of MultiJob type:
https://wiki.jenkins-ci.org/display/JENKINS/Multijob+Plugin
This will enable you to put each of your projects as a phase in the build and build the logic you need and much more
Look for the "Trigger when build is" Stable
I have build jobs like a-build, a-deploy. b-build, b-deploy.
*-deploy are downstream job for *-build jobs. So they look like,
a-build
|
+-a-deploy
b-build
|
+-b-deploy
Now I have another job X-build. It accepts a-build, b-build etc as a parameter. So I if I run X-build with a-build as parameter it should complete with a post build action that triggers a-deploy. How can that be done?
You can accomplish this quite easily if you receive the job name in a parameter.
You can then use "Call/Trigger Builds on Other Projects" step, and use the Parameter you receive in the job name:
If the step is not available to you via Post Build menu, you can get to it via "Execute set of scripts" post-build step.
Jenkins JobA triggers JobB as a subproject.
Is there any way that I can force JobB to have the same build number as JobA?
I am currently passing an environment variable into JobB so that JobB can use the correct number during its build. But it's still confusing having JobA and JobB have different build numbers.
I am also using the "Next Build Number Plugin", but JobA and JobB's build numbers keep drifting apart over time as JobA fails before it calls JobB, forcing me to come back and manually fix it.
You should consider Build Name Setter Plugin, as it allows setting a BUILD_NUMBER through a variable. Configure it to use something like $parentBuildNumber
Now, in JobB configure a text/string parameter, parentBuildNumber.
When you trigger JobB from JobA, you should be using Parameterized Trigger Plugin.
There configure a predefined parameter set as parentBuildNumber=$BUILD_NUMBER
In the parent job get the next build number, substract by 1 if needed and pass it to child job:
cat $JENKINS_HOME/jobs/$JOB_NAME/nextBuildNumber
And output it to
$JENKINS_HOME/jobs/$CHILD_JOB_NAME/nextBuildNumber
You may or may not have to install the NextBuildNumber plugin:
Also, there is a CLI command set-next-build-number. Try executing jenkins CLI help.
I want to run some post build actions in my Jenkins job on condition if a string or a regular expression is present in the console log. Any plugin available to do this?
One solution is to use the LogParser plugin and to create some regexp rules to parse your log.
This plugin can change the build status to Unstable:
Next, you create a downstream job and you will use the Parameterized Trigger plugin to pass the build status from the upstream to the downstream job.
If the status is unstable (= the LogParser find something), then you will execute some specific post build actions.
You can use the Conditional BuildStep plugin to condition the downstream build step according to the upstream build status.