I have a MSbuild job in jenkins running on windows slave. The master server is a linux server. When build runs successfully, i am archiving the artifacts which executes on linux master server. Now i want to create a zip of this archived artifacts. How do i do this as my slave is a windows slave ?
0
votes
1 Answers
0
votes
You can specify different parts of each job be done on specific nodes. In your pipeline script (assuming it's groovy) after the windows portion of your job completes, add another 'node' section with the label 'master':
node('master')
Jenkins stores artifacts in the following location:
$JENKINS_HOME/jobs//builds//archive
You can cd to that directory then perform a zip command
zip -r name_of_zip_file ./*
You should be able to add something like the snippet below to your groovy script:
node('master'){
stage ("Zip Artifacts"){
sh '''
cd $JENKINS_HOME/jobs/<job>/builds/<build>/archive
zip -r name_of_zip_file ./*
'''
}
}