Skip to content
Permalink
Browse files

implement SKIP_IMAGE_PUBLISH

  • Loading branch information
Schnitzel committed Feb 7, 2020
1 parent 9aa9076 commit cbe2073e5d9c8c4d9a04b41d2bc111c2d74c7631
Showing with 12 additions and 6 deletions.
  1. +12 −6 Jenkinsfile
@@ -5,7 +5,10 @@ node {
env.MINISHIFT_HOME = "/data/jenkins/.minishift"

withEnv(['AWS_BUCKET=jobs.amazeeio.services', 'AWS_DEFAULT_REGION=us-east-2']) {
withCredentials([usernamePassword(credentialsId: 'aws-s3-lagoon', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY')]) {
withCredentials([
usernamePassword(credentialsId: 'aws-s3-lagoon', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
string(credentialsId: 'SKIP_IMAGE_PUBLISH', variable: 'SKIP_IMAGE_PUBLISH')
]) {
try {
env.CI_BUILD_TAG = env.BUILD_TAG.replaceAll('%2f','').replaceAll("[^A-Za-z0-9]+", "").toLowerCase()
env.SAFEBRANCH_NAME = env.BRANCH_NAME.replaceAll('%2f','-').replaceAll("[^A-Za-z0-9]+", "-").toLowerCase()
@@ -19,7 +22,6 @@ node {
stage ('Checkout') {
def checkout = checkout scm
env.GIT_COMMIT = checkout["GIT_COMMIT"]
sh "git fetch --tags"
}

stage ('build images') {
@@ -51,8 +53,12 @@ node {
'push images to amazeeiolagoon': {
stage ('push images to amazeeiolagoon/*') {
withCredentials([string(credentialsId: 'amazeeiojenkins-dockerhub-password', variable: 'PASSWORD')]) {
sh 'docker login -u amazeeiojenkins -p $PASSWORD'
sh "make publish-amazeeiolagoon-baseimages publish-amazeeiolagoon-serviceimages BRANCH_NAME=${SAFEBRANCH_NAME} -j4"
if (env.SKIP_IMAGE_PUBLISH != 'true') {
sh 'docker login -u amazeeiojenkins -p $PASSWORD'
sh "make publish-amazeeiolagoon-baseimages publish-amazeeiolagoon-serviceimages BRANCH_NAME=${SAFEBRANCH_NAME} -j4"
} else {
sh 'echo "skipped because of SKIP_IMAGE_PUBLISH env variable"'
}
}
}
}
@@ -86,7 +92,7 @@ node {
)
}

if (env.TAG_NAME) {
if (env.TAG_NAME && env.SKIP_IMAGE_PUBLISH != 'true') {
stage ('publish-amazeeio') {
withCredentials([string(credentialsId: 'amazeeiojenkins-dockerhub-password', variable: 'PASSWORD')]) {
sh 'docker login -u amazeeiojenkins -p $PASSWORD'
@@ -95,7 +101,7 @@ node {
}
}

if (env.BRANCH_NAME == 'master') {
if (env.BRANCH_NAME == 'master' && env.SKIP_IMAGE_PUBLISH != 'true') {
stage ('save-images-s3') {
sh "make s3-save -j8"
}

0 comments on commit cbe2073

Please sign in to comment.
You can’t perform that action at this time.