forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.nightly
150 lines (142 loc) · 5.89 KB
/
Jenkinsfile.nightly
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
@Library('cilium') _
pipeline {
agent {
label 'fixed'
}
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"
GOPATH = "${WORKSPACE}"
TESTDIR = "${WORKSPACE}/${PROJ_PATH}/test"
SERVER_BOX = "cilium/ubuntu"
NIGHTLY_TAG = "${new Date().format("yyyyMMdd")}-${BUILD_NUMBER}"
}
options {
timeout(time: 700, unit: 'MINUTES')
timestamps()
ansiColor('xterm')
}
stages {
stage('Checkout') {
steps {
Status("PENDING", "$JOB_BASE_NAME")
sh 'env'
sh 'rm -rf src; mkdir -p src/github.com/cilium'
sh 'ln -s $WORKSPACE src/github.com/cilium/cilium'
checkout scm
}
}
stage('Nightly-Docker-Image') {
when {
environment name: 'GIT_BRANCH', value: 'origin/master'
}
steps {
withDockerRegistry([ credentialsId: "NIGHTLY_DOCKER_HUB_CRED", url: "" ]) {
sh 'make docker-image'
sh 'docker tag cilium/cilium:latest cilium/nightly:latest'
sh 'docker tag cilium/nightly:latest cilium/nightly:${NIGHTLY_TAG}'
sh 'docker push cilium/nightly:${NIGHTLY_TAG}'
sh 'docker push cilium/nightly:latest'
}
}
}
stage('Nightly-Tests') {
environment {
K8S_NODES=4
K8S_VERSION=1.11
MEMORY=4096
CPU=4
FAILFAST=setIfLabel("ci/fail-fast", "true", "false")
}
options {
timeout(time: 460, unit: 'MINUTES')
}
steps {
parallel(
"Nightly":{
sh 'cd ${TESTDIR}; ginkgo --focus="Nightly*" -v --timeout 450m --failFast=${FAILFAST}'
},
)
}
post {
always {
sh 'cd test/; ./post_build_agent.sh || true'
sh 'cd test/; vagrant destroy -f || true'
sh 'cd test/; ./archive_test_results.sh || true'
archiveArtifacts artifacts: '*.zip'
junit testDataPublishers: [[$class: 'AttachmentPublisher']], testResults: 'test/*.xml'
}
}
}
stage('Kubernetes tests') {
steps {
parallel(
"K8s-1.7":{
sh 'cd ${TESTDIR}; K8S_VERSION=1.7 ginkgo --focus=" K8s*" -v'
},
"K8s-1.8":{
sh 'cd ${TESTDIR}; K8S_VERSION=1.8 ginkgo --focus=" K8s*" -v'
}
)
}
post {
always {
sh 'cd ${TEST_DIR}; ./archive_test_results.sh || true'
archiveArtifacts artifacts: '*.zip'
junit testDataPublishers: [[$class: 'AttachmentPublisher']], testResults: 'test/*.xml'
}
}
}
stage('Envoy Tests') {
steps {
sh 'cd ${TESTDIR}; vagrant up runtime --no-provision'
sh 'cd ${TESTDIR}; ./run-envoy-unit-tests.sh'
}
post {
always {
sh "cd ${TESTDIR}; vagrant destroy -f || true"
}
}
}
}
post {
always {
sh "cd ${TESTDIR}; K8S_VERSION=1.8 vagrant destroy -f || true"
sh "cd ${TESTDIR}; K8S_VERSION=1.7 vagrant destroy -f || true"
sh "cd ${TESTDIR}; K8S_VERSION=1.11 vagrant destroy -f || true"
sh "cd ${TESTDIR}; vagrant destroy -f || true"
sh 'cd ${TEST_DIR}; ./post_build_agent.sh || true'
cleanWs()
}
success {
Status("SUCCESS", "$JOB_BASE_NAME")
}
failure {
Status("FAILURE", "$JOB_BASE_NAME")
}
}
}