-
Notifications
You must be signed in to change notification settings - Fork 14
/
Jenkinsfile
75 lines (62 loc) · 1.77 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
pipeline {
agent any
stages {
stage('Login to Docker repo') {
steps {
sh '''cat ~/.GH_TOKEN | docker login docker.pkg.github.com -u mattmattox --password-stdin
'''
}
}
stage('Docker') {
parallel {
stage('Build Docker image and push - Manager') {
steps {
dir(path: './manager') {
sh '''docker build -t drainnode/manager:"$BRANCH_NAME"-rc"$BUILD_NUMBER" .
docker push drainnode/manager:"$BRANCH_NAME"-rc"$BUILD_NUMBER"'''
}
}
}
stage('Build Docker image and push - Worker') {
steps {
dir(path: './worker') {
sh '''docker build -t drainnode/worker:"$BRANCH_NAME"-rc"$BUILD_NUMBER" .
docker push drainnode/worker:"$BRANCH_NAME"-rc"$BUILD_NUMBER"'''
}
}
}
stage('Build Docker image and push - Leader') {
steps {
dir(path: './worker') {
sh '''docker pull fredrikjanssonse/leader-elector:0.6
docker tag fredrikjanssonse/leader-elector:0.6 drainnode/leader:"$BRANCH_NAME"-rc"$BUILD_NUMBER"'''
}
}
}
}
}
stage('Packaging') {
steps {
dir(path: './chart') {
sh '''echo "Removing old packages..."
rm -f drain-node-on-crash-*.tgz
echo "Packing chart using helm..."
helm package ./drain-node-on-crash/ \\
--app-version="$BRANCH_NAME"-rc"$BUILD_NUMBER" \\
--version="$BRANCH_NAME"-rc"$BUILD_NUMBER"
echo "Moving package..."
mv drain-node-on-crash-*.tgz ~/helm-chart/'''
}
}
}
stage('Publishing') {
steps {
sh '''cd ~/helm-chart/
helm repo index ~/helm-chart/ --url https://mattmattox.github.io/helm-chart/
git add .
git commit -m "Jenkins Import"
git push'''
}
}
}
}