-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
61 lines (61 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
pipeline {
agent {
kubernetes {
yamlFile 'job-pod.yaml'
defaultContainer 'python'
}
}
parameters {
booleanParam(name: 'BUILD_TEST', defaultValue: false, description: 'Build a test version of the site')
}
stages {
stage('Build test') {
when {
expression { return params.BUILD_TEST }
}
steps {
sh "pip install -r requirements.txt"
sh "make html"
}
}
stage('Push test image') {
when {
expression { return params.BUILD_TEST }
}
steps {
container('kaniko') {
sh "/kaniko/executor --dockerfile Dockerfile --context dir://${env.WORKSPACE} --verbosity debug --destination gcr.io/tom-personal-287221/tfsite-test:latest"
}
}
}
stage('Build live') {
when {
branch 'main'
}
steps {
sh "pip install -r requirements.txt"
sh "make publish"
}
}
stage('Push live image') {
when {
branch 'main'
}
steps {
container('kaniko') {
sh "/kaniko/executor --dockerfile Dockerfile --context dir://${env.WORKSPACE} --verbosity debug --destination gcr.io/tom-personal-287221/thomasflanigan:latest"
}
}
}
stage('Deploy live') {
when {
branch 'main'
}
steps {
container('kubectl') {
sh "kubectl delete pod -l=app=site -n thomasflanigan"
}
}
}
}
}