Reputation: 1986
Is there a way to download multiple artifacts in Jenkins, based on a list of builds OR based on a statement like: hey, Jenkins, please download all artifacts from the succesful and unstable builds, starting from build 123, ending with the last succesful build?
Is there a plugin that could manage to do that?
I was thinking of a code like:
for (( buildNumber=$startingBuild; buildNumber<$lastSuccesfulBuildNumber; buildNumber++ ))
do
cp $JENKINS_HOME/view/PROJECT/job/$JOB_NAME/$buildNumber/artifact/file.zip $targetDirectory/$buildNumber
done
but this will download all the artifacts, without ommiting the failed ones...
Upvotes: 1
Views: 647
Reputation: 357
I am not sure if there are any plugins to do this functionality.
However, we can use the Archive artifacts plugin's feature to achieve the desired functionality. We can enable the "Archive artifacts only if build is successful" option. So only successful builds will create the artifacts.
Artifacts are stored at: /archive/
So we can be sure that if "archive" folder exist for the build, the build is successful.
Or
As a post build action, we can store all the artifacts at centralized place after each successful build. Later we can access those artifacts whenever required.
I hope this helps.
Upvotes: 0