use Harbor docker registry, handle develop branch

https://github.com/status-im/infra-sites/issues/42

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2025-04-15 14:47:42 +02:00
parent 6346620989
commit 77dac22067
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4

27
Jenkinsfile vendored
View File

@ -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' }