-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
269 lines (269 loc) · 11.9 KB
/
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
pipeline {
agent none
options {
retry(1)
timeout(time: 3, unit: 'HOURS')
}
environment {
UPDATE_CACHE = "true"
DOCKER_CREDENTIALS = credentials('dockerhub')
DOCKER_USERNAME = "${env.DOCKER_CREDENTIALS_USR}"
DOCKER_PASSWORD = "${env.DOCKER_CREDENTIALS_PSW}"
DOCKER_CLI_EXPERIMENTAL = "enabled"
// PULP_PROD and PULP_STAGE are used to do releases
PULP_HOST_PROD = "https://api.pulp.konnect-prod.konghq.com"
PULP_PROD = credentials('PULP')
PULP_HOST_STAGE = "https://api.pulp.konnect-stage.konghq.com"
PULP_STAGE = credentials('PULP_STAGE')
DEBUG = 0
}
stages {
stage('Release -- Release Branch Release to Unofficial Asset Stores') {
when {
beforeAgent true
anyOf {
branch 'master';
branch 'release/*';
}
}
parallel {
stage('Alpine') {
agent {
node {
label 'bionic'
}
}
environment {
KONG_SOURCE_LOCATION = "${env.WORKSPACE}"
KONG_BUILD_TOOLS_LOCATION = "${env.WORKSPACE}/../kong-build-tools"
AWS_ACCESS_KEY = "instanceprofile"
PACKAGE_TYPE = "apk"
GITHUB_SSH_KEY = credentials('github_bot_ssh_key')
}
options {
retry(2)
timeout(time: 2, unit: 'HOURS')
}
steps {
sh 'echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin || true'
sh 'make setup-kong-build-tools'
sh 'make RESTY_IMAGE_BASE=alpine RESTY_IMAGE_TAG=3 KONG_TEST_CONTAINER_TAG="${GIT_BRANCH##*/}-alpine" DOCKER_MACHINE_ARM64_NAME="kong-"`cat /proc/sys/kernel/random/uuid` release-docker-images'
}
}
}
}
stage('Release -- Tag Release to Official Asset Stores') {
when {
beforeAgent true
allOf {
buildingTag()
not { triggeredBy 'TimerTrigger' }
}
}
parallel {
stage('RPM') {
agent {
node {
label 'bionic'
}
}
environment {
KONG_SOURCE_LOCATION = "${env.WORKSPACE}"
KONG_BUILD_TOOLS_LOCATION = "${env.WORKSPACE}/../kong-build-tools"
PACKAGE_TYPE = "rpm"
PRIVATE_KEY_FILE = credentials('kong.private.gpg-key.asc')
PRIVATE_KEY_PASSPHRASE = credentials('kong.private.gpg-key.asc.password')
GITHUB_SSH_KEY = credentials('github_bot_ssh_key')
}
options {
retry(2)
timeout(time: 2, unit: 'HOURS')
}
steps {
sh 'echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin || true'
sh 'make setup-kong-build-tools'
sh 'cp $PRIVATE_KEY_FILE ../kong-build-tools/kong.private.gpg-key.asc'
sh 'make RESTY_IMAGE_BASE=amazonlinux RESTY_IMAGE_TAG=2 release'
sh 'make RESTY_IMAGE_BASE=amazonlinux RESTY_IMAGE_TAG=2022 release'
sh 'make RESTY_IMAGE_BASE=centos RESTY_IMAGE_TAG=7 release'
sh 'make RESTY_IMAGE_BASE=rhel RESTY_IMAGE_TAG=7.9 release'
sh 'make RESTY_IMAGE_BASE=rhel RESTY_IMAGE_TAG=8.6 RELEASE_DOCKER=true release'
}
}
stage('DEB') {
agent {
node {
label 'bionic'
}
}
environment {
KONG_SOURCE_LOCATION = "${env.WORKSPACE}"
KONG_BUILD_TOOLS_LOCATION = "${env.WORKSPACE}/../kong-build-tools"
PACKAGE_TYPE = "deb"
GITHUB_SSH_KEY = credentials('github_bot_ssh_key')
}
options {
retry(2)
timeout(time: 2, unit: 'HOURS')
}
steps {
sh 'echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin || true'
sh 'make setup-kong-build-tools'
sh 'make RESTY_IMAGE_BASE=debian RESTY_IMAGE_TAG=10 release'
sh 'make RESTY_IMAGE_BASE=debian RESTY_IMAGE_TAG=11 RELEASE_DOCKER=true release'
sh 'make RESTY_IMAGE_BASE=ubuntu RESTY_IMAGE_TAG=18.04 release'
sh 'make RESTY_IMAGE_BASE=ubuntu RESTY_IMAGE_TAG=20.04 RELEASE_DOCKER=true release'
sh 'make RESTY_IMAGE_BASE=ubuntu RESTY_IMAGE_TAG=22.04 RELEASE_DOCKER=true release'
}
}
stage('SRC & Alpine') {
agent {
node {
label 'bionic'
}
}
environment {
KONG_SOURCE_LOCATION = "${env.WORKSPACE}"
KONG_BUILD_TOOLS_LOCATION = "${env.WORKSPACE}/../kong-build-tools"
PACKAGE_TYPE = "rpm"
GITHUB_SSH_KEY = credentials('github_bot_ssh_key')
AWS_ACCESS_KEY = "instanceprofile"
}
options {
retry(2)
timeout(time: 2, unit: 'HOURS')
}
steps {
sh 'echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin || true'
sh 'make setup-kong-build-tools'
sh 'make RESTY_IMAGE_BASE=src RESTY_IMAGE_TAG=src PACKAGE_TYPE=src release'
sh 'make RESTY_IMAGE_BASE=alpine RESTY_IMAGE_TAG=3 PACKAGE_TYPE=apk DOCKER_MACHINE_ARM64_NAME="kong-"`cat /proc/sys/kernel/random/uuid` RELEASE_DOCKER=true release'
}
}
}
}
stage('Post Release Steps') {
when {
beforeAgent true
allOf {
buildingTag()
not { triggeredBy 'TimerTrigger' }
expression { env.TAG_NAME ==~ /^\d+\.\d+\.\d+$/ }
}
}
parallel {
stage('PR Docker') {
agent {
node {
label 'bionic'
}
}
environment {
GITHUB_TOKEN = credentials('github_bot_access_token')
GITHUB_SSH_KEY = credentials('github_bot_ssh_key')
SLACK_WEBHOOK = credentials('core_team_slack_webhook')
GITHUB_USER = "mashapedeployment"
}
steps {
sh './scripts/setup-ci.sh'
sh 'echo "y" | ./scripts/make-release $TAG_NAME update_docker'
}
post {
failure {
script {
sh 'SLACK_MESSAGE="updating docker-kong failed" ./scripts/send-slack-message.sh'
}
}
success {
script {
sh 'SLACK_MESSAGE="updating docker-kong succeeded. Please review, approve and continue with the kong release script" ./scripts/send-slack-message.sh'
}
}
}
}
stage('PR Homebrew') {
agent {
node {
label 'bionic'
}
}
environment {
GITHUB_TOKEN = credentials('github_bot_access_token')
GITHUB_SSH_KEY = credentials('github_bot_ssh_key')
SLACK_WEBHOOK = credentials('core_team_slack_webhook')
GITHUB_USER = "mashapedeployment"
}
steps {
sh './scripts/setup-ci.sh'
sh 'echo "y" | ./scripts/make-release $TAG_NAME homebrew'
}
post {
failure {
script {
sh 'SLACK_MESSAGE="updating homebrew-kong failed" ./scripts/send-slack-message.sh'
}
}
success {
script {
sh 'SLACK_MESSAGE="updating homebrew-kong succeeded. Please review, approve and merge the PR" ./scripts/send-slack-message.sh'
}
}
}
}
stage('PR Vagrant') {
agent {
node {
label 'bionic'
}
}
environment {
GITHUB_TOKEN = credentials('github_bot_access_token')
GITHUB_SSH_KEY = credentials('github_bot_ssh_key')
SLACK_WEBHOOK = credentials('core_team_slack_webhook')
GITHUB_USER = "mashapedeployment"
}
steps {
sh './scripts/setup-ci.sh'
sh 'echo "y" | ./scripts/make-release $TAG_NAME vagrant'
}
post {
failure {
script {
sh 'SLACK_MESSAGE="updating kong-vagrant failed" ./scripts/send-slack-message.sh'
}
}
success {
script {
sh 'SLACK_MESSAGE="updating kong-vagrant succeeded. Please review, approve and merge the PR" ./scripts/send-slack-message.sh'
}
}
}
}
stage('PR Pongo') {
agent {
node {
label 'bionic'
}
}
environment {
GITHUB_TOKEN = credentials('github_bot_access_token')
GITHUB_SSH_KEY = credentials('github_bot_ssh_key')
SLACK_WEBHOOK = credentials('core_team_slack_webhook')
GITHUB_USER = "mashapedeployment"
}
steps {
sh './scripts/setup-ci.sh'
sh 'echo "y" | ./scripts/make-release $TAG_NAME pongo'
}
post {
always {
script {
sh 'SLACK_MESSAGE="pongo branch is pushed go open the PR at https://github.com/Kong/kong-pongo/branches" ./scripts/send-slack-message.sh'
}
}
}
}
}
}
}
}