mirror of
https://github.com/waku-org/telemetry.git
synced 2025-01-20 12:58:51 +00:00
54 lines
1.1 KiB
Plaintext
54 lines
1.1 KiB
Plaintext
|
pipeline {
|
||
|
agent { label 'linux' }
|
||
|
|
||
|
parameters {
|
||
|
booleanParam(
|
||
|
name: 'DEPLOY',
|
||
|
description: 'Enable to deploye the Docker image.',
|
||
|
defaultValue: false,
|
||
|
)
|
||
|
}
|
||
|
|
||
|
options {
|
||
|
timestamps()
|
||
|
disableConcurrentBuilds()
|
||
|
/* manage how many builds we keep */
|
||
|
buildDiscarder(logRotator(
|
||
|
numToKeepStr: '10',
|
||
|
daysToKeepStr: '30',
|
||
|
))
|
||
|
}
|
||
|
|
||
|
environment {
|
||
|
IMAGE_NAME = "statusteam/telemetry"
|
||
|
IMAGE_DEFAULT_TAG = "${env.GIT_COMMIT.take(7)}"
|
||
|
IMAGE_DEPLOY_TAG = "deploy"
|
||
|
}
|
||
|
|
||
|
stages {
|
||
|
stage('Build') { steps { script {
|
||
|
image = docker.build(
|
||
|
"${env.IMAGE_NAME}:${env.IMAGE_DEFAULT_TAG}"
|
||
|
)
|
||
|
} } }
|
||
|
|
||
|
stage('Push') { steps { script {
|
||
|
withDockerRegistry([
|
||
|
credentialsId: "dockerhub-statusteam-auto"
|
||
|
]) {
|
||
|
image.push()
|
||
|
}
|
||
|
} } }
|
||
|
|
||
|
stage('Deploy') {
|
||
|
when { expression { params.DEPLOY } }
|
||
|
steps { script {
|
||
|
withDockerRegistry([
|
||
|
credentialsId: "dockerhub-statusteam-auto"
|
||
|
]) {
|
||
|
image.push(env.IMAGE_DEPLOY_TAG)
|
||
|
}
|
||
|
} } }
|
||
|
} // stages
|
||
|
} // pipeline
|