forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathginkgo.Jenkinsfile
131 lines (122 loc) · 4.09 KB
/
ginkgo.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@Library('cilium') _
pipeline {
agent {
label 'baremetal'
}
environment {
PROJ_PATH = "src/github.com/cilium/cilium"
TESTDIR = "${WORKSPACE}/${PROJ_PATH}/"
MEMORY = "3072"
SERVER_BOX = "cilium/ubuntu"
}
options {
timeout(time: 210, unit: 'MINUTES')
timestamps()
ansiColor('xterm')
}
stages {
stage('Checkout') {
options {
timeout(time: 10, unit: 'MINUTES')
}
steps {
BuildIfLabel('area/k8s', 'Cilium-PR-Kubernetes-Upstream')
BuildIfLabel('area/k8s', 'Cilium-PR-Ginkgo-Tests-K8s')
BuildIfLabel('area/documentation', 'Cilium-PR-Doc-Tests')
sh 'env'
sh 'rm -rf src; mkdir -p src/github.com/cilium'
sh 'ln -s $WORKSPACE src/github.com/cilium/cilium'
checkout scm
}
}
stage('Precheck') {
options {
timeout(time: 20, unit: 'MINUTES')
}
environment {
TESTDIR="${WORKSPACE}/${PROJ_PATH}/"
}
steps {
sh "cd ${TESTDIR}; make jenkins-precheck"
}
post {
always {
sh "cd ${TESTDIR}; make clean-ginkgo-tests || true"
}
}
}
stage('UnitTesting') {
options {
timeout(time: 20, unit: 'MINUTES')
}
environment {
GOPATH="${WORKSPACE}"
TESTDIR="${WORKSPACE}/${PROJ_PATH}/"
}
steps {
sh "cd ${TESTDIR}; make tests-ginkgo"
}
post {
always {
sh "cd ${TESTDIR}; make clean-ginkgo-tests || true"
}
}
}
stage('Boot VMs'){
options {
timeout(time: 30, unit: 'MINUTES')
}
environment {
TESTDIR="${WORKSPACE}/${PROJ_PATH}/test"
}
steps {
sh 'cd ${TESTDIR}; K8S_VERSION=1.7 vagrant up --no-provision'
sh 'cd ${TESTDIR}; K8S_VERSION=1.11 vagrant up --no-provision'
}
}
stage('BDD-Test-PR') {
environment {
GOPATH="${WORKSPACE}"
TESTDIR="${WORKSPACE}/${PROJ_PATH}/test"
FAILFAST=setIfLabel("ci/fail-fast", "true", "false")
CONTAINER_RUNTIME=setIfLabel("area/containerd", "containerd", "docker")
}
options {
timeout(time: 120, unit: 'MINUTES')
}
steps {
script {
parallel(
"Runtime":{
sh 'cd ${TESTDIR}; ginkgo --focus=" Runtime*" -v --failFast=${FAILFAST}'
},
"K8s-1.7":{
sh 'cd ${TESTDIR}; K8S_VERSION=1.7 ginkgo --focus=" K8s*" -v --failFast=${FAILFAST}'
},
"K8s-1.11":{
sh 'cd ${TESTDIR}; K8S_VERSION=1.11 ginkgo --focus=" K8s*" -v --failFast=${FAILFAST}'
},
failFast: "${FAILFAST}".toBoolean()
)
}
}
post {
always {
// Temporary workaround to test cleanup
// rm -rf ${GOPATH}/src/github.com/cilium/cilium
sh 'cd test/; ./post_build_agent.sh || true'
sh 'cd test/; ./archive_test_results.sh || true'
archiveArtifacts artifacts: '*.zip'
junit testDataPublishers: [[$class: 'AttachmentPublisher']], testResults: 'test/*.xml'
}
}
}
}
post {
always {
sh 'cd ${TESTDIR}/test/; K8S_VERSION=1.7 vagrant destroy -f || true'
sh 'cd ${TESTDIR}/test/; K8S_VERSION=1.11 vagrant destroy -f || true'
cleanWs()
}
}
}