diff --git a/docker/dataverse-k8s/Jenkinsfile b/docker/dataverse-k8s/Jenkinsfile index 2a6ea7da..fe00f5dc 100644 --- a/docker/dataverse-k8s/Jenkinsfile +++ b/docker/dataverse-k8s/Jenkinsfile @@ -13,18 +13,21 @@ pipeline { environment { dockerfile = "./docker/dataverse-k8s/glassfish/Dockerfile" context = "." - imagetag = "build-${env.BUILD_ID}" + imagetag = "build-${env.BRANCH_NAME}" hublogin = "dockerhub-dataversebot" registry = "https://registry.hub.docker.com" } triggers { cron('H H(0-4) * * *') } stages { + stage('checkout') { + steps { checkout scm } + } stage('build') { when { anyOf { changeset "docker/dataverse-k8s/**" triggeredBy 'TimerTrigger' - tag "v4.*" + tag "" } } steps { @@ -38,16 +41,14 @@ pipeline { anyOf { changeset "docker/dataverse-k8s/**" triggeredBy 'TimerTrigger' - tag "v4.*" - } - anyOf { - branch 'master' - tag "v4.*" + tag "" } } parallel { stage('release') { - when { buildingTag() } + when { + tag "v4.*" + } environment { imageTag = "${TAG_NAME.substring(1)}" } @@ -60,6 +61,9 @@ pipeline { } } stage('latest') { + when { + branch 'master' + } steps { script { docker.withRegistry("${env.registry}", "${env.hublogin}") { diff --git a/docker/solr-k8s/Jenkinsfile b/docker/solr-k8s/Jenkinsfile index ae116690..228bf7d7 100644 --- a/docker/solr-k8s/Jenkinsfile +++ b/docker/solr-k8s/Jenkinsfile @@ -12,23 +12,26 @@ pipeline { agent any environment { context = "docker/solr-k8s" - imagetag = "build-${env.BUILD_ID}" + imagetag = "build-${env.BRANCH_NAME}" hublogin = "dockerhub-dataversebot" registry = "https://registry.hub.docker.com" } triggers { cron('H H(0-4) * * *') } stages { + stage('checkout') { + steps { checkout scm } + } stage('build') { when { anyOf { changeset "docker/solr-k8s/**" triggeredBy 'TimerTrigger' - tag "v4.*" + tag "" } } steps { script { - docker_image = docker.build("iqss/solr-k8s:${env.imagetag}", "--pull ${env.context}") + docker_image = docker.build("iqss/solr-k8s:${env.imagetag}", "--pull -f ${env.dockerfile} ${env.context}") } } } @@ -37,16 +40,14 @@ pipeline { anyOf { changeset "docker/solr-k8s/**" triggeredBy 'TimerTrigger' - tag "v4.*" - } - anyOf { - branch 'master' - tag "v4.*" + tag "" } } parallel { stage('release') { - when { buildingTag() } + when { + tag "v4.*" + } environment { imageTag = "${TAG_NAME.substring(1)}" } @@ -59,6 +60,9 @@ pipeline { } } stage('latest') { + when { + branch 'master' + } steps { script { docker.withRegistry("${env.registry}", "${env.hublogin}") {