-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
40 lines (39 loc) · 1.1 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
def dockerImage
pipeline {
agent any
stages {
stage('Build') {
steps {
script {
dockerImage = docker.build("miquelbar/code:${env.BRANCH_NAME}-${env.BUILD_ID}")
}
}
}
stage('Test') {
when {
expression { env.BRANCH_NAME != 'master' }
}
steps {
script {
sh "make test"
}
}
}
stage('Deploy') {
when {
expression { env.BRANCH_NAME == 'master' }
}
steps {
echo 'Deploying....'
script {
docker.withRegistry('https://repo.treescale.com', 'canister') {
dockerImage.push()
}
sh "sed -i'' 's/{{BUILD_ID}}/${env.BRANCH_NAME}-${env.BUILD_ID}/g' kubernetes/deployment.yml"
sh "cat kubernetes/deployment.yml"
sh "kubectl apply -f kubernetes/"
}
}
}
}
}