-
Notifications
You must be signed in to change notification settings - Fork 12
/
Jenkinsfile
44 lines (34 loc) · 1.14 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
node {
def app
stage('Clone repository') {
checkout scm
sh "git rev-parse origin/${sha1} > .commit"
}
stage('Inject credentials') {
sh "cp /creds/aflame/app.config files/app.config"
}
stage('Build image') {
app = docker.build("erlang-aflame")
}
stage('Push image') {
def commit = readFile('.commit').trim()
docker.withRegistry('http://docker-registry:5000') {
app.push("${commit}")
app.push("${sha1}")
app.push("latest")
}
sh "docker image prune -fa --filter 'until=240h'"
}
stage('Kubernetes Deploy') {
def commit = readFile('.commit').trim()
sh "docker run --rm \
--mount type=bind,source=/creds/kubectl/,target=/root/.kube/ \
lachlanevenson/k8s-kubectl:v1.10.2 \
set image deployment/aflame-deployment \
aflame=docker-registry:5000/erlang-aflame:${commit}"
sh "docker run --rm \
--mount type=bind,source=/creds/kubectl/,target=/root/.kube/ \
lachlanevenson/k8s-kubectl:v1.10.2 \
rollout status deployment/aflame-deployment"
}
}