简体   繁体   中英

How does Jenkins promotion step manage workspaces

This is a Jenkins 101 question... I'm writing a Jenkins Promotion script which copies files from my workspace to a git repository. Currently my promotion process isn't doing a rebuild. My question is how does Jenkins manage the workspace? If I have two builds in Jenkins build #1 and build #2. Assuming build #2 was done last, if I go to promote build #1 will the workspace have build #2 files in it or will Jenkins somehow switch back to the workspace from build #1 (with my build artifacts still intact from the build step).

So the question boils down to whether Jenkins does some magic to make this work for me or if this is something I need to handle myself.

One approach to get the artifacts from specific builds is to use the copy artifact plugin - it allows you to specify which build artifact you want to grab.

Just note that to keep the artifacts, you need to archive them on your build jobs.

About the workspace management, I think it really depends on your configuration, because both approaches are possible. By default, I believe it uses the same, but imagine that you have concurrent builds, Jenkins will create folders such as workspace@2 and so on... Best approach is to use the artifacts that are archived during the build, and do not care bout the workspace management.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM