问题
I've just started using Jenkins and need some advice.
After a successful build I would like to have the resulting directory packaged into a zip file and stored in workspace so later I can send to an artifactory.
At the moment I'm using a program that I wrote for that purpose which I run in a batch file as the last step of a build but I wonder if there is a way of having Jenkins to do that.
回答1:
The file operations plugin has a zip operation.
Used with ${GIT_BRANCH} to create a zip file of the successful build.
https://wiki.jenkins.io/display/JENKINS/File+Operations+Plugin
回答2:
There is a Jenkins plug-in for that:
https://wiki.jenkins-ci.org/display/JENKINS/Compress+Artifacts+Plugin
回答3:
I you use Jenkinsfile(declarative) you can use zipFile and give the directory name that you want to be zipped
https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#zip-create-zip-file
来源:https://stackoverflow.com/questions/16725989/package-the-result-of-a-build-in-jenkins-into-a-zip