ci: add Jenkins pipeline

Build and push chat-store image to Harbor on merge to `release` branch.
Image tag derived from job name (deploy-logos-dev, deploy-logos-test).
Watchtower picks up the new tag on the deployed hosts.
This commit is contained in:
Vedran Mendelski 2026-07-15 11:25:31 +02:00 committed by Vedran
parent 673c49671a
commit 29d05e70bd

74
ci/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,74 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.41'
pipeline {
agent {
docker {
label 'linuxcontainer'
image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0'
args '--volume=/var/run/docker.sock:/var/run/docker.sock ' +
'--user jenkins'
}
}
options {
timestamps()
ansiColor('xterm')
disableRestartFromStage()
timeout(time: 30, unit: 'MINUTES')
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
))
}
parameters {
string(
name: 'IMAGE_TAG',
description: 'Name of Docker tag to push.',
defaultValue: env.JOB_BASE_NAME
)
string(
name: 'IMAGE_NAME',
description: 'Name of Docker image to push.',
defaultValue: params.IMAGE_NAME ?: 'harbor.status.im/logos-messaging/chat-store',
)
string(
name: 'DOCKER_CRED',
description: 'Name of Docker Registry credential.',
defaultValue: params.DOCKER_CRED ?: 'harbor-logos-core-private-robot',
)
string(
name: 'DOCKER_REGISTRY_URL',
description: 'URL of the Docker Registry',
defaultValue: params.DOCKER_REGISTRY_URL ?: 'https://harbor.status.im'
)
}
stages {
stage('Build') {
steps { script {
image = docker.build(
"${params.IMAGE_NAME}:${params.IMAGE_TAG}",
"--label=build='${env.BUILD_URL}' " +
"--label=commit='${git.commit()}' " +
"."
)
} }
}
stage('Push') {
steps { script {
withDockerRegistry([
credentialsId: params.DOCKER_CRED, url: params.DOCKER_REGISTRY_URL
]) {
image.push()
}
} }
}
}
post {
always { sh 'docker image prune -f' }
}
}