@@ -4,13 +4,22 @@ stages:
4
4
- unit-tests
5
5
- build
6
6
- e2e-tests
7
+ - e2e_k8s_19
8
+ - e2e_k8s_20
9
+ - e2e_k8s_21
10
+ - e2e_k8s_22
11
+ - e2e_k8s_23
12
+ - e2e_k8s_24
7
13
variables :
8
14
KUBECTL : v1.24.3
9
15
KIND : v0.14.0
10
16
DOCKER_HOST : tcp://docker:2375
11
17
DOCKER_DRIVER : overlay2
12
18
diff :
13
19
stage : diff
20
+ rules :
21
+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
22
+ - if : $CI_PIPELINE_SOURCE == 'push'
14
23
image :
15
24
name : $CI_REGISTRY_GO/golang:1.19
16
25
entrypoint : [ "" ]
@@ -21,12 +30,11 @@ diff:
21
30
script :
22
31
- test -z "$(git diff 2> /dev/null)" || exit "Documentation is not generated, issue \`cd documentation/gen && go run .\` and commit the result"
23
32
- test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit "Documentation created untracked files, cannot proceed"
24
- only :
25
- - merge_requests
26
- - branches
27
33
tidy :
28
34
stage : lint
29
35
needs : []
36
+ rules :
37
+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
30
38
image :
31
39
name : $CI_REGISTRY_GO/golang:1.19
32
40
entrypoint : [""]
@@ -35,36 +43,35 @@ tidy:
35
43
script :
36
44
- go mod tidy
37
45
- test -z "$(git diff 2> /dev/null)" || exit 'Go modules not tidied, issue \`go mod tidy\` and commit the result'
38
- only :
39
- - merge_requests
40
- - branches
41
46
golangci_lint :
42
47
stage : lint
43
48
needs : []
49
+ rules :
50
+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
44
51
image :
45
52
name : $CI_REGISTRY_GO/lint:1.33
46
53
entrypoint : [""]
47
54
tags :
48
55
- go
49
56
script :
50
57
- golangci-lint run --enable-all --timeout=10m
51
- only :
52
- - merge_requests
53
- - branches
54
58
lint-commit-msg :
55
59
stage : lint
56
60
needs : []
61
+ rules :
62
+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
57
63
image :
58
64
name : $CI_REGISTRY_GO/check-commit:v2.1.0
59
65
entrypoint : [""]
60
66
tags :
61
67
- go
62
68
script :
63
69
- /check
64
- only :
65
- - merge_requests
66
70
unit-tests :
67
71
needs : ["diff", "tidy"]
72
+ rules :
73
+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
74
+ - if : $CI_PIPELINE_SOURCE == 'push'
68
75
stage : unit-tests
69
76
image :
70
77
name : $CI_REGISTRY_GO/haproxy-alpine:2.5-go1.19
@@ -74,12 +81,12 @@ unit-tests:
74
81
script :
75
82
- go build -v .
76
83
- go test -v ./...
77
- only :
78
- - merge_requests
79
- - branches
80
84
docker-build :
81
85
stage : build
82
86
needs : []
87
+ rules :
88
+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
89
+ - if : $CI_PIPELINE_SOURCE == 'push'
83
90
image : $CI_REGISTRY_GO/docker:stable-go1.19
84
91
services :
85
92
- name : $CI_REGISTRY_GO/docker:18.09.7-dind
@@ -104,9 +111,41 @@ docker-build:
104
111
paths :
105
112
- tar
106
113
expire_in : 60 minutes
114
+ docker-build-sch :
115
+ stage : build
116
+ needs : []
117
+ rules :
118
+ - if : $CI_PIPELINE_SOURCE == 'schedule'
119
+ image : $CI_REGISTRY_GO/docker:stable-go1.19
120
+ services :
121
+ - name : $CI_REGISTRY_GO/docker:18.09.7-dind
122
+ alias : docker
123
+ tags :
124
+ - go
125
+ before_script :
126
+ - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY_GO
127
+ - go version
128
+ - docker pull -q $CI_REGISTRY_GO/alpine:3
129
+ - docker image tag $CI_REGISTRY_GO/alpine:3 alpine:3
130
+ - docker pull -q $CI_REGISTRY_GO/golang:1.19-alpine
131
+ - docker image tag $CI_REGISTRY_GO/golang:1.19-alpine golang:1.19-alpine
132
+ - sed -i "s~FROM golang~FROM $CI_REGISTRY_GO/golang~g" "build/Dockerfile"
133
+ - sed -i "s~FROM haproxytech/haproxy-alpine~FROM $CI_REGISTRY_GO/haproxy-alpine~g" "build/Dockerfile"
134
+ script :
135
+ - mkdir -p tar
136
+ - make build
137
+ - docker save -o tar/k8sIC.tar haproxytech/kubernetes-ingress:latest
138
+ artifacts :
139
+ when : on_success
140
+ paths :
141
+ - tar
142
+ expire_in : 24 hours
107
143
.kind_deployment :
108
144
stage : e2e-tests
109
145
needs : ["diff", "tidy", "docker-build"]
146
+ rules :
147
+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
148
+ - if : $CI_PIPELINE_SOURCE == 'push'
110
149
image : $CI_REGISTRY_GO/docker:stable-go1.19
111
150
services :
112
151
- name : $CI_REGISTRY_GO/docker:18.09.7-dind
@@ -147,9 +186,6 @@ docker-build:
147
186
after_script :
148
187
- kubectl get pods -A
149
188
- kind delete cluster --name=dev
150
- only :
151
- - merge_requests
152
- - branches
153
189
parallel :
154
190
matrix :
155
191
- TEST_PART : [ "18#e2e_parallel", "18#e2e_https", "1#e2e_sequential" ]
@@ -160,36 +196,55 @@ docker-build:
160
196
- IFS='#' read -r -a array <<< $TEST_PART; echo "running tests with --tags=${array[1]}"
161
197
- IFS='#' read -r -a array <<< $TEST_PART; KIND_URL=docker CGO_ENABLED=0 go test -v -p ${array[0]} ./deploy/tests/e2e/... --tags=${array[1]}
162
198
.kind_deployment_schedules :
163
- only :
164
- - schedules
199
+ needs : ["docker-build-sch"]
200
+ rules :
201
+ - if : $CI_PIPELINE_SOURCE == "schedule"
165
202
extends : .kind_deployment
203
+ allow_failure : true
204
+ artifacts :
205
+ paths :
206
+ - tar
207
+ expire_in : 60 minutes
208
+ exclude :
209
+ - tar/*
166
210
# Kubernetes 1.19 is the oldest release to support networking.k8s.io/v1
167
- k8s_19 :
211
+ e2e_k8s_19 :
212
+ stage : e2e_k8s_19
168
213
variables :
169
214
K8S_VERSION : v1.19.16
170
215
KUBEADM_VER : v1beta2
171
216
extends : .kind_deployment_schedules
172
- k8s_20 :
217
+ e2e_k8s_20 :
218
+ stage : e2e_k8s_20
219
+ needs : ["docker-build-sch","e2e_k8s_19"]
173
220
variables :
174
221
K8S_VERSION : v1.20.15
175
222
KUBEADM_VER : v1beta2
176
223
extends : .kind_deployment_schedules
177
- k8s_21 :
224
+ e2e_k8s_21 :
225
+ stage : e2e_k8s_21
226
+ needs : ["docker-build-sch","e2e_k8s_20"]
178
227
variables :
179
228
K8S_VERSION : v1.21.12
180
229
KUBEADM_VER : v1beta2
181
230
extends : .kind_deployment_schedules
182
- k8s_22 :
231
+ e2e_k8s_22 :
232
+ stage : e2e_k8s_22
233
+ needs : ["docker-build-sch","e2e_k8s_21"]
183
234
variables :
184
235
K8S_VERSION : v1.22.9
185
236
KUBEADM_VER : v1beta2
186
237
extends : .kind_deployment_schedules
187
- k8s_23 :
238
+ e2e_k8s_23 :
239
+ stage : e2e_k8s_23
240
+ needs : ["docker-build-sch","e2e_k8s_22"]
188
241
variables :
189
242
K8S_VERSION : v1.23.6
190
243
KUBEADM_VER : v1beta3
191
244
extends : .kind_deployment_schedules
192
- k8s_24 :
245
+ e2e_k8s_24 :
246
+ stage : e2e_k8s_24
247
+ needs : ["docker-build"]
193
248
variables :
194
249
K8S_VERSION : v1.24.3
195
250
KUBEADM_VER : v1beta3
0 commit comments