I hope it's okay to ask for recommendations here. I'm very new to devops, and am trying to get into the headspace of involved technologies and workflows.

I've created a webhook in my Bitbucket project that posts to http://JENKINS_URL/generic-webhook-trigger/invoke. Using techniques described here, the corresponding Pipeline build in Jenkins only acts if the event was the pushing of a git tag.

I would like this Jenkins Pipeline build to trigger another Jenkins build that is triggerable by a human -- what are (good/proper) ways to organize this? In other words: if A is a Pipeline build triggered by a generic webhook, I would like A to figure out some variable values and trigger B, passing it those variables, and I would like for a human to be able to manually trigger B using human-supplied variables.

In my naivete, I imagined A being a Pipeline build because they offer the option to use a Pipeline script, which is the only way I'm currently aware of that offers a way to access the Post content parameters. I.e. if A was a freestyle build with a shell script, I don't know how I'd access the Post content.

However, when A is a Pipeline build there is no Post-build Actions section in the Jenkins UI -- i.e. I don't see how a Pipeline build can trigger a subsequent build.

From naivete, again, I envisioned a Pipeline build triggering a freestyle build because the Pipeline build allows accessing generic webhook post content, and the freestyle build is human-triggerable, and can be parameterized so that either the human or the calling Pipeline build can supply those parameters.

(I hope I might also direct some eyeballs to a separate, but related, question about passing parameters to parameterized builds: Why is parameter not propagated to post-build parameterized build?)


Make B as a Pipeline job and give it some build parameters. Humans will be able to trigger this build with whatever parameters they want using the "Build With Parameters" button in the web UI.

Then, in your Pipeline script for A, trigger the build using the built-in build step. This will allow job A to trigger B with whatever parameters are necessary:

  job: 'Job B',
  parameters: [
    string(name: 'parameterName1', value: "some parameter value"),
    string(name: 'parameterName2', value: "some parameter value"),
    // etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.