All properties and methods from BoxCommon are valid in addition to the properties and methods documented here.
Promotes images and pushes git tag to repository
Notes on using the promoteToVersion
override. This is intended for special occasions where the release needs to be manipulated or an older release requires a patch bump. This key can also be used to promote to a major or minor version on a tag/release
event without the need to modify the baseVersion
in jenkins.yaml
. Some notes on the functionality
- If you use promoteToVersion to override the registries defined for your
promotionKey
will be used to store any promoted images - If git tags are used the
promoteToVersion
will be tagged on the promoted commit - Promoting to a version that is greater than the current version will write it back to build-versions as long as the version type matches a version that would normally be written using that
promotionKey
(ie. writing an rc tag on atag/release
event will not write back to build-versions or trigger a deployment). - As a general rule, do not use promoteToVersion for pre-release versions. If you are releasing a pre-release version with
promoteToVersion
and there is a currently released pre-release with the samemajor.minor.patch
semantic version (ie.promoteToVersion = 1.0.1-rc5
andcurrentSemVer = 1.0.1-rc100
), thepromoteToVersion
version will overwrite thecurrentSemVer
in build versions
jenkins.yaml:
common:
images:
- test/a
- test/b
promote:
baseVersion: "0.1.0"
Jenkinsfile:
@Library('jenkins-shared-library@master')
import com.boxboat.jenkins.pipeline.promote.*
def promotions = ["", "stage", "prod"]
properties([
parameters([
choice(name: 'promotionKey', choices: promotions, description: 'Promotion', defaultValue: '')
//Add these if you want to manually create a promoted version. Note if 'overridePromoteToEvent' is set, the image tag will not be written to build-versions
string(name: 'overrideEvent', description: 'Override promote from event, typically commit/<branch>, tag/<tag>, or imageTag/<imageTag>', defaultValue: '')
string(name: 'promoteToVersion', description: 'Set a semver to promote to. Overrides patch bumping behavior', defaultValue: '')
])
])
def promote = new BoxPromote()
node() {
promote.wrap {
stage('Promote'){
promote.promote()
}
}
}