If you are using a Jenkinsfile and want to save a txt file with the build number, you just to use the $BUILD_NUMBER environment variable:
sh 'echo "build $BUILD_NUMBER" > version.txt'
Then, in post section - always, you can post your version.txt file:
post {
always {
archiveArtifacts artifacts: 'build/ , version.txt'
}
}
Here in the example, I am posting two files separated by commas.
Jenkinsfile
Output
No comments:
Post a Comment