forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflannel.Jenkinsfile
135 lines (127 loc) · 4.8 KB
/
flannel.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
132
133
134
135
@Library('cilium') _
pipeline {
agent {
label 'baremetal'
}
environment {
PROJ_PATH = "src/github.com/cilium/cilium"
TESTDIR = "${WORKSPACE}/${PROJ_PATH}/"
VM_MEMORY = "4096"
SERVER_BOX = "cilium/ubuntu"
NETNEXT=setIfLabel("ci/net-next", "1", "0")
CNI_INTEGRATION="flannel"
GINKGO_TIMEOUT="75m"
}
options {
timeout(time: 240, unit: 'MINUTES')
timestamps()
ansiColor('xterm')
}
stages {
stage('Set build name') {
when {
not {environment name: 'GIT_BRANCH', value: 'origin/master'}
}
steps {
script {
currentBuild.displayName = env.getProperty('ghprbPullTitle') + ' ' + env.getProperty('ghprbPullLink') + ' ' + currentBuild.displayName
}
}
}
stage('Checkout') {
options {
timeout(time: 20, unit: 'MINUTES')
}
steps {
Status("PENDING", "${env.JOB_NAME}")
sh 'env'
sh 'rm -rf src; mkdir -p src/github.com/cilium'
sh 'ln -s $WORKSPACE src/github.com/cilium/cilium'
checkout scm
sh '/usr/local/bin/cleanup || true'
}
}
stage('Preload vagrant boxes') {
steps {
sh '/usr/local/bin/add_vagrant_box ${WORKSPACE}/${PROJ_PATH}/vagrant_box_defaults.rb'
}
post {
unsuccessful {
script {
if (!currentBuild.displayName.contains('fail')) {
currentBuild.displayName = 'preload vagrant boxes fail' + currentBuild.displayName
}
}
}
}
}
stage('Boot VMs'){
options {
timeout(time: 60, unit: 'MINUTES')
}
environment {
TESTDIR="${WORKSPACE}/${PROJ_PATH}/test"
}
steps {
retry(3){
timeout(time: 20, unit: 'MINUTES'){
sh 'cd ${TESTDIR}; K8S_VERSION=1.10 vagrant destroy --force'
sh 'cd ${TESTDIR}; K8S_VERSION=1.13 vagrant destroy --force'
sh 'cd ${TESTDIR}; K8S_VERSION=1.10 vagrant up --no-provision'
sh 'cd ${TESTDIR}; K8S_VERSION=1.13 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: 75, unit: 'MINUTES')
}
steps {
script {
parallel(
"K8s-1.10":{
sh 'cd ${TESTDIR}; K8S_VERSION=1.10 vagrant provision k8s1-1.10; K8S_VERSION=1.10 vagrant provision k8s2-1.10'
sh 'cd ${TESTDIR}; K8S_VERSION=1.10 ginkgo --focus="K8s" -v --failFast=${FAILFAST} -- -cilium.provision=false -cilium.timeout=${GINKGO_TIMEOUT}'
},
"K8s-1.13":{
sh 'cd ${TESTDIR}; K8S_VERSION=1.13 vagrant provision k8s1-1.13; K8S_VERSION=1.13 vagrant provision k8s2-1.13'
sh 'cd ${TESTDIR}; K8S_VERSION=1.13 ginkgo --focus="K8s" -v --failFast=${FAILFAST} -- -cilium.provision=false -cilium.timeout=${GINKGO_TIMEOUT}'
},
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.10 vagrant destroy -f || true'
sh 'cd ${TESTDIR}/test/; K8S_VERSION=1.13 vagrant destroy -f || true'
cleanWs()
sh '/usr/local/bin/cleanup || true'
}
success {
Status("SUCCESS", "$JOB_BASE_NAME")
}
failure {
Status("FAILURE", "$JOB_BASE_NAME")
}
}
}