-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathJenkinsfile
103 lines (100 loc) · 3.8 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
96
97
98
99
100
101
102
103
@Library('juju-pipeline@master') _
def exec(String cmd) {
sh "juju ssh -m ${CONTROLLER}:default ubuntu/0 -- bash -c 'cd . && ${cmd}'"
}
def tryexec(String cmd) {
sh "juju ssh -m ${CONTROLLER}:default ubuntu/0 -- bash -c 'cd . && ${cmd}'"
}
pipeline {
agent {
label 'runner-amd64'
}
/* 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}"
CONTROLLER = "validate-microk8s-${uuid()}"
}
options {
ansiColor('xterm')
timestamps()
timeout(time: 1, unit: 'HOURS')
}
stages {
// stage('Set Start Time') {
// steps {
// setStartTime()
// }
// }
stage('Setup') {
steps {
sh "juju bootstrap --config logging-config='juju.environs.simplestreams=TRACE;<root>=DEBUG' aws/${params.region} ${CONTROLLER}"
sh "juju deploy -m ${CONTROLLER}:default ubuntu --constraints 'cores=4 mem=16G root-disk=40G'"
sh "juju wait -vw -m ${CONTROLLER}:default"
sh "juju status -m ${CONTROLLER}:default"
sh "juju status -m ${CONTROLLER}:default --format yaml"
}
}
stage('Wait for snap') {
options {
retry(20)
}
steps {
exec 'sudo snap install core'
}
}
stage('Install dependencies') {
steps {
exec 'sudo snap install charm --classic'
exec 'sudo snap install jq'
exec "sudo snap install juju --classic --channel ${params.juju_channel}"
exec 'sudo snap install juju-helpers --classic --edge'
exec 'sudo snap install juju-wait --classic'
exec 'sudo snap install kubectl --classic'
exec "sudo snap install microk8s --classic --channel ${params.microk8s_channel}"
exec 'sudo snap install yq'
exec 'sudo apt update && sudo apt install -y libssl-dev'
exec 'sudo pip3 install pytest sh kfp requests pyyaml'
exec 'sudo usermod -a -G microk8s ubuntu'
exec 'echo \'PATH=$PATH:/snap/bin\' > ~/.bashrc'
}
}
stage('Deploy kubeflow') {
steps {
// Copy forked mysql interface from charmed-osm into interfaces dir
exec 'git clone git://git.launchpad.net/canonical-osm'
exec 'git clone https://github.com/juju-solutions/bundle-kubeflow.git'
exec 'cp -r canonical-osm/charms/interfaces/juju-relation-mysql bundle-kubeflow/mysql'
exec 'cd bundle-kubeflow && python3 ./scripts/cli.py microk8s setup'
exec 'cd bundle-kubeflow && KUBEFLOW_AUTH_PASSWORD=foobar python3 ./scripts/cli.py deploy-to uk8s --build'
}
}
stage('Validate') {
steps {
exec "cd bundle-kubeflow && git checkout ${params.bundle_revision} && ./tests/run.sh"
}
}
}
post {
// success {
// setPass()
// }
failure {
// setFail()
tryexec 'cd bundle-kubeflow && ./tests/dump-pipeline-logs.sh'
tryexec 'juju kubectl logs --tail 1000 --all-containers -l juju-app=argo-controller'
tryexec 'juju kubectl get pods'
tryexec 'juju kubectl get pods -oyaml'
tryexec 'juju status'
tryexec 'juju status --format yaml'
}
// always {
// setEndTime()
// }
cleanup {
// saveMeta()
sh "juju destroy-controller -y --destroy-all-models --destroy-storage ${CONTROLLER}"
}
}
}