Skip to content

Commit

Permalink
Need PR logic and proper file naming for Dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
thelamer committed Jun 28, 2018
1 parent bb3eacf commit 89aa6ba
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
File renamed without changes.
45 changes: 44 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,54 @@ pipeline {
PR Release Logic
################ */
// Push to PR user dockerhub endpoint when this is a pull request
stage('Docker-Push-PR') {
stage('Docker-Push-PR-Single') {
when {
not {
environment name: 'CHANGE_ID', value: ''
}
expression{
env.MULTIARCH == 'false'
}
}
steps {
withCredentials([
[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'c1701109-4bdc-4a9c-b3ea-480bec9a2ca6',
usernameVariable: 'DOCKERUSER',
passwordVariable: 'DOCKERPASS'
]
]) {
echo 'Logging into DockerHub'
sh '''#! /bin/bash
echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
'''
echo 'Tag images to the built one'
sh "docker tag ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:latest"
sh "docker tag ${DOCKERHUB_IMAGE}:${EXT_RELEASE}-ls${LS_TAG_NUMBER} ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}"
echo 'Pushing both tags'
sh "docker push ${PR_DOCKERHUB_IMAGE}:latest"
sh "docker push ${PR_DOCKERHUB_IMAGE}:${EXT_RELEASE}-pkg-${PACKAGE_TAG}-pr-${PULL_REQUEST}"
}
script{
env.CODE_URL = sh(
script: '''echo https://github.com/${LS_USER}/${LS_REPO}/pull/${PULL_REQUEST}''',
returnStdout: true).trim()
env.DOCKERHUB_LINK = sh(
script: '''echo https://hub.docker.com/r/${PR_DOCKERHUB_IMAGE}/tags/''',
returnStdout: true).trim()
}
}
}
// Push to PR user dockerhub endpoint when this is a pull request
stage('Docker-Push-PR-Multi') {
when {
not {
environment name: 'CHANGE_ID', value: ''
}
expression{
env.MULTIARCH == 'true'
}
}
steps {
withCredentials([
Expand Down

0 comments on commit 89aa6ba

Please sign in to comment.