blob: c776510b794d7bd69775389b782bbd54ea76b27e [file] [log] [blame]
Zack Williams84a193e2018-05-08 15:57:45 -07001/* helm-api-test pipeline */
2
3pipeline {
4
Zack Williams90cf9fd2018-05-11 10:26:21 -07005 parameters {
6 string(name:'executorNode', defaultValue:'invalid', description:'Name of the Jenkins node to run the job on')
7 string(name:'manifestUrl', defaultValue:'invalid', description:'URL to the repo manifest')
8 string(name:'manifestBranch', defaultValue:'master', description:'Name of the repo branch to use')
9 }
10
Zack Williams84a193e2018-05-08 15:57:45 -070011 /* no label, executor is determined by JJB */
12 agent {
Zack Williams90cf9fd2018-05-11 10:26:21 -070013 label '${params.executorNode}'
Zack Williams84a193e2018-05-08 15:57:45 -070014 }
15
16 stages {
17
Zack Williams90cf9fd2018-05-11 10:26:21 -070018 stage('checkout') {
19 steps {
20 checkout(changelog: false, \
21 poll: false,
22 scm: [$class: 'RepoScm', \
23 manifestRepositoryUrl: '${params.manifestUrl}', \
24 manifestBranch: '${params.manifestBranch}', \
25 currentBranch: true, \
26 destinationDir: 'cord', \
27 forceSync: true,
28 resetFirst: true, \
29 quiet: true, \
30 jobs: 4, \
31 showAllChanges: true] \
32 )
33 }
34 }
35
Zack Williams84a193e2018-05-08 15:57:45 -070036 stage('prep') {
37 parallel {
38
39 stage('images') {
40 steps {
41 sh 'cd cord/build; ./scripts/imagebuilder.py -f helm-charts/examples/test-images.yaml'
42
43 }
44 }
45
46 stage('minikube') {
47 steps {
48 /* see https://github.com/kubernetes/minikube/#linux-continuous-integration-without-vm-support */
49 sh '''
50 export MINIKUBE_WANTUPDATENOTIFICATION=false;
51 export MINIKUBE_WANTREPORTERRORPROMPT=false;
52 export CHANGE_MINIKUBE_NONE_USER=true;
53 export MINIKUBE_HOME=$HOME;
54 mkdir -p $HOME/.kube || true;
55 touch $HOME/.kube/config;
56 export KUBECONFIG=$HOME/.kube/config;
Zack Williams90cf9fd2018-05-11 10:26:21 -070057 minikube start --vm-driver=none;
Zack Williams84a193e2018-05-08 15:57:45 -070058
Zack Williams90cf9fd2018-05-11 10:26:21 -070059 chown -R $USER $HOME/.minikube;
60 chgrp -R $(id -g) $HOME/.minikube;
Zack Williams84a193e2018-05-08 15:57:45 -070061
62 for i in {1..150}; do # timeout for 5 minutes
63 ./kubectl get po &> /dev/null
64 if [ $? -ne 1 ]; then
65 break
66 fi
67 sleep 2
68 done
69 '''
70 }
71 }
72 }
73 }
74
75 stage('helm') {
76 steps {
77 sh 'helm init && sleep 60'
78 }
79 }
80
81 stage('xos') {
82 steps {
83 sh '''
84 cd cord/build/helm-charts;
85 helm dep up xos-core;
86 helm install -f examples/test-values.yaml -f examples/candidate-tag-values.yaml xos-core -n xos-core;
87 sleep 60
88 '''
89 }
90 }
91
92 stage('test'){
93 steps {
94 sh 'helm test xos-core'
95 sh 'kubectl logs xos-core-api-test'
96 }
97 post {
98 always {
99 archive '/tmp/helm_test_xos_core_logs_*/**'
100
101 }
102 }
103 }
104 }
105
106 post {
107 always {
108 sh 'kubectl delete pod xos-core-api-test'
109 sh 'helm delete --purge xos-core'
110 deleteDir()
111 }
112 }
113}