-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
54 lines (48 loc) · 1.13 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env groovy
pipeline {
agent { label 'linux' }
parameters {
string(
name: 'IMAGE_TAG',
defaultValue: params.IMAGE_TAG ?: 'latest',
description: 'Optional Docker image tag to push.'
)
}
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
DOCKER_REGISTRY = 'harbor.status.im'
IMAGE_NAME = 'wakuorg/storenode-messages-counter'
IMAGE_DEFAULT_TAG = "${env.GIT_COMMIT.take(8)}"
}
stages {
stage('Build') {
steps { script {
image = docker.build(
"${DOCKER_REGISTRY}/${IMAGE_NAME}:${IMAGE_DEFAULT_TAG}",
"--build-arg='commit=${GIT_COMMIT}' .",
)
} }
}
stage('Deploy') {
when { expression { params.IMAGE_TAG != '' } }
steps { script {
withDockerRegistry([
credentialsId: 'harbor-telemetry-robot',
url: 'https://${DOCKER_REGISTRY}',
]) {
image.push(params.IMAGE_TAG)
}
} }
}
}
post {
cleanup { cleanWs() }
}
}