From 77dac22067dd56f22e0e2d42ca22f436ea916a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 15 Apr 2025 14:47:42 +0200 Subject: [PATCH] use Harbor docker registry, handle develop branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/status-im/infra-sites/issues/42 Signed-off-by: Jakub SokoĊ‚owski --- Jenkinsfile | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 08b9033..c66bb29 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,9 +7,14 @@ pipeline { parameters { string( name: 'IMAGE_TAG', - defaultValue: params.IMAGE_TAG ?: '', + defaultValue: params.IMAGE_TAG ?: deployBranch(), description: 'Optional Docker image tag to push.' ) + string( + name: 'DOCKER_REGISTRY', + description: 'Docker registry ', + defaultValue: params.DOCKER_REGISTRY ?: 'harbor.status.im', + ) } options { @@ -22,22 +27,26 @@ pipeline { } environment { - IMAGE_NAME = 'statusteam/rln-keystore-management' - NEXT_PUBLIC_SITE_URL = "https://${env.JOB_BASE_NAME}" + IMAGE_NAME = 'wakuorg/rln-keystore-management' + NEXT_PUBLIC_SITE_URL = "https://${deployDomain()}" } stages { stage('Build') { steps { script { - image = docker.build("${IMAGE_NAME}:${GIT_COMMIT.take(8)}") + image = docker.build( + "${DOCKER_REGISTRY}/${IMAGE_NAME}:${GIT_COMMIT.take(8)}" + ) } } } stage('Push') { steps { script { - withDockerRegistry([credentialsId: 'dockerhub-statusteam-auto', url: '']) { + withDockerRegistry([ + credentialsId: 'harbor-wakuorg-robot', url: "https://${DOCKER_REGISTRY}", + ]) { image.push() } } } @@ -46,7 +55,9 @@ pipeline { stage('Deploy') { when { expression { params.IMAGE_TAG != '' } } steps { script { - withDockerRegistry([credentialsId: 'dockerhub-statusteam-auto', url: '']) { + withDockerRegistry([ + credentialsId: "harbor-wakuorg-robot", url: "https://${DOCKER_REGISTRY}", + ]) { image.push(params.IMAGE_TAG) } } } @@ -57,3 +68,7 @@ pipeline { cleanup { cleanWs() } } } + +def isMasterBranch() { GIT_BRANCH ==~ /.*master/ } +def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' } +def deployDomain() { isMasterBranch() ? 'waku.org' : 'dev.waku.org' }