Skip to content

Commit

Permalink
Retagging latest image on master merge
Browse files Browse the repository at this point in the history
  • Loading branch information
pmccarthy committed Jun 1, 2018
1 parent a6044e4 commit 4be00ca
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,17 @@ fhBuildNode(['label': 'openshift']) {
buildWithDockerStrategy params
archiveArtifacts writeBuildInfo('rhmap-backups', "${VERSION}-${BUILD}")
}
}

if (env.BRANCH_NAME && env.BRANCH_NAME == 'master') {
fhBuildNode(['label': 'jenkins-tools']) {

stage('Retag image as latest')

final String COMPONENT = "backups"
final String VERSION = "1.0.0"
final String BUILD = env.BUILD_NUMBER
final String DOCKER_HUB_ORG = "rhmap"
final String DOCKER_HUB_REPO = COMPONENT
final String OUTPUT_IMAGE = "docker.io/${DOCKER_HUB_ORG}/${DOCKER_HUB_REPO}:${VERSION}-${BUILD}"
final String LATEST_IMAGE = "docker.io/${DOCKER_HUB_ORG}/${DOCKER_HUB_REPO}:latest"

sh "skopeo copy ${OUTPUT_IMAGE} ${LATEST_IMAGE}"

if (env.BRANCH_NAME && env.BRANCH_NAME == 'master') {
stage('Build Latest Image') {
final Map params = [
fromDir: '.',
buildConfigName: COMPONENT,
imageRepoSecret: "dockerhub",
outputImage: "docker.io/${DOCKER_HUB_ORG}/${DOCKER_HUB_REPO}:latest"
]
buildWithDockerStrategy params
archiveArtifacts writeBuildInfo('rhmap-backups', "${VERSION}-${BUILD}")
}
}
}

0 comments on commit 4be00ca

Please sign in to comment.