forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkubernetes-upstream.Jenkinsfile
154 lines (140 loc) · 5.92 KB
/
kubernetes-upstream.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@Library('cilium') _
pipeline {
agent {
label 'baremetal'
}
parameters {
string(defaultValue: '${ghprbPullDescription}', name: 'ghprbPullDescription')
string(defaultValue: '${ghprbActualCommit}', name: 'ghprbActualCommit')
string(defaultValue: '${ghprbTriggerAuthorLoginMention}', name: 'ghprbTriggerAuthorLoginMention')
string(defaultValue: '${ghprbPullAuthorLoginMention}', name: 'ghprbPullAuthorLoginMention')
string(defaultValue: '${ghprbGhRepository}', name: 'ghprbGhRepository')
string(defaultValue: '${ghprbPullLongDescription}', name: 'ghprbPullLongDescription')
string(defaultValue: '${ghprbCredentialsId}', name: 'ghprbCredentialsId')
string(defaultValue: '${ghprbTriggerAuthorLogin}', name: 'ghprbTriggerAuthorLogin')
string(defaultValue: '${ghprbPullAuthorLogin}', name: 'ghprbPullAuthorLogin')
string(defaultValue: '${ghprbTriggerAuthor}', name: 'ghprbTriggerAuthor')
string(defaultValue: '${ghprbCommentBody}', name: 'ghprbCommentBody')
string(defaultValue: '${ghprbPullTitle}', name: 'ghprbPullTitle')
string(defaultValue: '${ghprbPullLink}', name: 'ghprbPullLink')
string(defaultValue: '${ghprbAuthorRepoGitUrl}', name: 'ghprbAuthorRepoGitUrl')
string(defaultValue: '${ghprbTargetBranch}', name: 'ghprbTargetBranch')
string(defaultValue: '${ghprbPullId}', name: 'ghprbPullId')
string(defaultValue: '${ghprbActualCommitAuthor}', name: 'ghprbActualCommitAuthor')
string(defaultValue: '${ghprbActualCommitAuthorEmail}', name: 'ghprbActualCommitAuthorEmail')
string(defaultValue: '${ghprbTriggerAuthorEmail}', name: 'ghprbTriggerAuthorEmail')
string(defaultValue: '${GIT_BRANCH}', name: 'GIT_BRANCH')
string(defaultValue: '${ghprbPullAuthorEmail}', name: 'ghprbPullAuthorEmail')
string(defaultValue: '${sha1}', name: 'sha1')
string(defaultValue: '${ghprbSourceBranch}', name: 'ghprbSourceBranch')
}
environment {
PROJ_PATH = "src/github.com/cilium/cilium"
TESTDIR="${WORKSPACE}/${PROJ_PATH}/test"
VM_MEMORY = "5120"
K8S_VERSION="1.20"
KERNEL="419"
SERVER_BOX = "cilium/ubuntu-4-19"
CNI_INTEGRATION=setIfLabel("integration/cni-flannel", "FLANNEL", "")
RACE="""${sh(
returnStdout: true,
script: 'if [ "${run_with_race_detection}" = "" ]; then echo -n ""; else echo -n "1"; fi'
)}"""
LOCKDEBUG="""${sh(
returnStdout: true,
script: 'if [ "${run_with_race_detection}" = "" ]; then echo -n ""; else echo -n "1"; fi'
)}"""
BASE_IMAGE="""${sh(
returnStdout: true,
script: 'if [ "${run_with_race_detection}" = "" ]; then echo -n "scratch"; else echo -n "quay.io/cilium/cilium-runtime:2021-01-14@sha256:be12ad63360ef1ff14a77d48cd146154154f888deb75bd99c17cd9381a4c05a5"; fi'
)}"""
}
options {
timeout(time: 300, 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') {
steps {
sh 'env'
Status("PENDING", "${env.JOB_NAME}")
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'){
options {
timeout(time: 20, unit: 'MINUTES')
}
steps {
sh '/usr/local/bin/add_vagrant_box ${WORKSPACE}/${PROJ_PATH}/vagrant_box_defaults.rb'
}
}
stage('Boot VMs'){
options {
timeout(time: 70, unit: 'MINUTES')
}
steps {
retry(3){
sh 'cd ${TESTDIR}; vagrant destroy k8s1-${K8S_VERSION} --force'
sh 'cd ${TESTDIR}; vagrant destroy k8s2-${K8S_VERSION} --force'
sh 'cd ${TESTDIR}; timeout 20m vagrant up k8s1-${K8S_VERSION} k8s2-${K8S_VERSION}'
}
}
}
stage('BDD-tests'){
options {
timeout(time: 150, unit: 'MINUTES')
}
steps {
sh 'cd ${TESTDIR}; vagrant ssh k8s1-${K8S_VERSION} -c "cd /home/vagrant/go/${PROJ_PATH}; ./test/kubernetes-test.sh"'
}
}
stage('Netperf tests'){
when {
environment name: 'GIT_BRANCH', value: 'origin/master'
}
options {
timeout(time: 300, unit: 'MINUTES')
}
environment {
PROMETHEUS_URL="https://metrics.cilium.io/metrics/job/upstream_job"
PROMETHEUS=credentials("metrics")
}
steps {
sh '''
cd ${TESTDIR}; vagrant ssh k8s1-${K8S_VERSION} -c "
cd /home/vagrant/go/${PROJ_PATH}/test;
./kubernetes-netperftest.sh '$PROMETHEUS_URL' '$PROMETHEUS_USR' '$PROMETHEUS_PSW'"
'''
}
}
}
post {
always {
sh 'lscpu'
sh 'cd ${TESTDIR}; K8S_VERSION=${K8S_VERSION} vagrant destroy -f || true'
cleanWs()
sh '/usr/local/bin/cleanup || true'
}
success {
Status("SUCCESS", "$JOB_BASE_NAME")
}
failure {
Status("FAILURE", "$JOB_BASE_NAME")
}
}
}