blob: adedd8cb9e0d1926b84afbedb887d4bc9b747b00 [file] [log] [blame]
Zack Williams84a193e2018-05-08 15:57:45 -07001/* helm-api-test pipeline */
2
3pipeline {
4
5 /* no label, executor is determined by JJB */
6 agent {
Zack Williamsdc6cf042018-05-14 13:00:57 -07007 label "${params.executorNode}"
Zack Williams84a193e2018-05-08 15:57:45 -07008 }
9
10 stages {
11
Zack Williamsdc6cf042018-05-14 13:00:57 -070012 stage('repo') {
Zack Williams90cf9fd2018-05-11 10:26:21 -070013 steps {
14 checkout(changelog: false, \
15 poll: false,
16 scm: [$class: 'RepoScm', \
Zack Williamsdc6cf042018-05-14 13:00:57 -070017 manifestRepositoryUrl: "${params.manifestUrl}", \
18 manifestBranch: "${params.manifestBranch}", \
Zack Williams90cf9fd2018-05-11 10:26:21 -070019 currentBranch: true, \
20 destinationDir: 'cord', \
21 forceSync: true,
22 resetFirst: true, \
23 quiet: true, \
24 jobs: 4, \
25 showAllChanges: true] \
26 )
27 }
28 }
29
Zack Williamsdc6cf042018-05-14 13:00:57 -070030 stage('patch') {
31 steps {
32 sh """
33 pushd cord
34 PROJECT_PATH=$(xmllint --xpath "string(//project[@name=\"${gerritProject}\"]/@path)" .repo/manifest.xml)
35 repo download "\$PROJECT_PATH" "${gerritChangeNumber}/${gerritPatchsetNumber}"
36 popd
37 """
38 }
39 }
40
Zack Williams84a193e2018-05-08 15:57:45 -070041 stage('prep') {
42 parallel {
43
44 stage('images') {
45 steps {
Zack Williamsdc6cf042018-05-14 13:00:57 -070046 sh '''
47 pushd cord/build
48 ./scripts/imagebuilder.py -f ../helm-charts/examples/test-images.yaml
49 popd
50 '''
Zack Williams84a193e2018-05-08 15:57:45 -070051 }
52 }
53
54 stage('minikube') {
55 steps {
56 /* see https://github.com/kubernetes/minikube/#linux-continuous-integration-without-vm-support */
57 sh '''
Zack Williamsdc6cf042018-05-14 13:00:57 -070058 export MINIKUBE_WANTUPDATENOTIFICATION=false
59 export MINIKUBE_WANTREPORTERRORPROMPT=false
60 export CHANGE_MINIKUBE_NONE_USER=true
61 export MINIKUBE_HOME=$HOME
62 mkdir -p $HOME/.kube || true
63 touch $HOME/.kube/config
64 export KUBECONFIG=$HOME/.kube/config
65 sudo -E /usr/bin/minikube start --vm-driver=none
Zack Williams84a193e2018-05-08 15:57:45 -070066
67 for i in {1..150}; do # timeout for 5 minutes
68 ./kubectl get po &> /dev/null
69 if [ $? -ne 1 ]; then
70 break
71 fi
72 sleep 2
73 done
74 '''
75 }
76 }
77 }
78 }
79
80 stage('helm') {
81 steps {
82 sh 'helm init && sleep 60'
83 }
84 }
85
86 stage('xos') {
87 steps {
88 sh '''
Zack Williamsdc6cf042018-05-14 13:00:57 -070089 pushd cord/helm-charts
90 helm dep up xos-core
91 helm install -f examples/test-values.yaml -f examples/candidate-tag-values.yaml xos-core -n xos-core
Zack Williams84a193e2018-05-08 15:57:45 -070092 sleep 60
Zack Williamsdc6cf042018-05-14 13:00:57 -070093 popd
Zack Williams84a193e2018-05-08 15:57:45 -070094 '''
95 }
96 }
97
98 stage('test'){
99 steps {
Zack Williamsdc6cf042018-05-14 13:00:57 -0700100 sh '''
101 helm test xos-core
102 kubectl logs xos-core-api-test
103 mkdir -p ./RobotLogs;
104 cp /tmp/helm_test_xos_core_logs_*/* ./RobotLogs
105 '''
Zack Williams84a193e2018-05-08 15:57:45 -0700106
Zack Williamsdc6cf042018-05-14 13:00:57 -0700107 step([$class: 'RobotPublisher',
108 disableArchiveOutput: false,
109 logFileName: 'RobotLogs/log*.html',
110 otherFiles: '',
111 outputFileName: 'RobotLogs/output*.xml',
112 outputPath: '.',
113 passThreshold: 100,
114 reportFileName: 'RobotLogs/report*.html',
115 unstableThreshold: 0]);
Zack Williams84a193e2018-05-08 15:57:45 -0700116 }
117 }
118 }
119
120 post {
121 always {
Zack Williamsdc6cf042018-05-14 13:00:57 -0700122 sh '''
123 kubectl delete pod xos-core-api-test
124 helm delete --purge xos-core
125 '''
Zack Williams84a193e2018-05-08 15:57:45 -0700126 deleteDir()
127 }
128 }
129}