sed -i 's/foo/bar/gI' cloudformation.yml
Instead of foo, I'd like it to be the previous build number in Jenkins ${env.BUILD_ID)-1 , and bar = the current build number in jenkins = ${env.BUILD_ID}
So if currently I'm on build 133, jenkins/linux will look for the number 132 in my cloudformation file, and will replace it with 133, and so on.
Any help would be appreciated
You can see all global variables at https://you-jenkins-url/pipeline-syntax/globals. Within a stage directive, add the below.
stage('Change-BuildID') {
steps {
env.previousBuildID = currentBuild.previousBuild.number
sh "sed -i \'s/${BUILD_ID}/${env.previousBuildID}/g\' cloudformation.yml"
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments