-
Notifications
You must be signed in to change notification settings - Fork 24
/
Jenkinsfile
95 lines (89 loc) · 2.71 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
@Library('juju-pipeline@master') _
def juju_model = String.format("%s-%s", params.model, uuid())
def juju_controller = String.format("%s-%s", params.controller, uuid())
pipeline {
agent {
label "${params.build_node}"
}
/* XXX: Global $PATH setting doesn't translate properly in pipelines
https://stackoverflow.com/questions/43987005/jenkins-does-not-recognize-command-sh
*/
environment {
PATH = "${utils.cipaths}"
}
options {
ansiColor('xterm')
timestamps()
}
stages {
stage("Prep") {
steps {
tearDownLxd()
}
}
stage('Deploy: K8s') {
options {
timeout(time: 4, unit: 'HOURS')
}
steps {
setStartTime()
sh "juju bootstrap ${params.cloud} ${juju_controller} --debug"
sh "juju add-model -c ${juju_controller} ${juju_model}"
deployCDK(
controller: juju_controller,
model: juju_model,
cloud: params.cloud,
bundle: "cs:~containers/${params.bundle}",
version_overlay: params.version_overlay,
bundle_channel: params.bundle_channel,
disable_add_model: true
)
}
}
stage('Validate') {
options {
timeout(time: 2, unit: 'HOURS')
}
when {
expression { !params.perform_upgrade }
}
steps {
dir('jobs') {
sh "CONTROLLER=${juju_controller} MODEL=${juju_model} CLOUD=lxd ${utils.pytest} --junit-xml=validate.xml integration/test_lxd_profile_deploy.py::test_lxd_profiles"
}
}
}
stage('Validate Upgrade') {
options {
timeout(time: 2, unit: 'HOURS')
}
when {
expression { params.perform_upgrade }
}
steps {
dir('jobs') {
"CONTROLLER=${juju_controller} MODEL=${juju_model} CLOUD=lxd ${utils.pytest} --junit-xml=validate.xml integration/test_lxd_profile_deploy.py::test_lxd_profile_upgrade"
}
}
}
}
post {
failure {
setFail()
}
success {
setPass()
}
always {
setEndTime()
sh "sudo lxc profile show default"
collectDebug(juju_controller,
juju_model)
}
cleanup {
saveMeta()
tearDown(juju_controller)
tearDownLxd()
}
}
}