forked from status-im/telemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
53 lines (47 loc) · 1.09 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
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