Search code examples
gitjenkinsenvironment-variablesjobsgit-tag

How to post parameters in jenkins? The Build Number of the first Job?


JENKINS

I am running 5 jobs. The first triggers the second and so on. I am trying to pass the $BUILD_NUMBER environmental variable from the first job to the last one so I can use the $BUILD_NUMBER from the first job for a git tag in the last job.

I was wondering what is the best way to go about that.


Solution

  • Set the child job to paramatized with parameter BUILD_NUMBER. Trigger build from the parent job with predefined parameters. Set them as BUILD_NUMBER=$BUILD_NUMBER