Problem:
One of our flows is to release a build to our repo then retrieve the build number and feed it to a deploy stage.After the build and release I have retrieved the build number but I can’t figure out how to pass the version number to the next stage. What’s the best practice for passing properties between stages and jobs?
Solution:
Downstream stage(i.e. a stage from downstream pipeline, or a subsequent stage in a pipeline) can download artifacts from upstream stages. You can use <artifact src="build_no_file" dest="build_no_file" /> to upload a file that contains build number that was retrieved after releasing artifact to repo. The subsequent stage(or downstream stage) can download the artifact using <fetchartifact pipeline="upstream" stage="upstream" job="upstream" srcdir="build_no_file" dest="build_no_file" />. You can omit the pipeline name if this is a subsequent stage in the same pipeline.
The task that uploads the artifact to nexus can write build number to build_no_file after finishing the upload.
Comments
0 comments
Please sign in to leave a comment.