@@ -5,245 +5,19 @@ stages:
55 - unit-tests
66 - build
77 - e2e-tests
8- - e2e_k8s_30
9- - e2e_k8s_31
10- - e2e_k8s_32
8+ - e2e_k8s
9+ - e2e_k8s_sch_1
10+ - e2e_k8s_sch_2
1111variables :
1212 KIND : v0.27.0
1313 DOCKER_HOST : tcp://docker:2375
1414 DOCKER_DRIVER : overlay2
1515 GO_VERSION : " 1.24"
16- DOCKER_VERSION : " 27.0"
17- pipelines-check :
18- stage : bots
19- needs : []
20- image :
21- name : $CI_REGISTRY_GO/docker:$DOCKER_VERSION-go$GO_VERSION
22- entrypoint : [ "" ]
23- rules :
24- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
25- tags :
26- - go
27- script :
28- - go run cmd/gitlab-mr-pipelines/main.go
29- diff :
30- stage : diff
31- rules :
32- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
33- - if : $CI_PIPELINE_SOURCE == 'push'
34- image :
35- name : $CI_REGISTRY_GO/golang:$GO_VERSION
36- entrypoint : [ "" ]
37- tags :
38- - go
39- before_script :
40- - cd documentation/gen && go run .
41- script :
42- - test -z "$(git diff 2> /dev/null)" || exit "Documentation is not generated, issue \`cd documentation/gen && go run .\` and commit the result"
43- - test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit "Documentation created untracked files, cannot proceed"
44- diff-crd :
45- stage : diff
46- rules :
47- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
48- - if : $CI_PIPELINE_SOURCE == 'push'
49- image :
50- name : $CI_REGISTRY_GO/golang:$GO_VERSION
51- entrypoint : [ "" ]
52- tags :
53- - go
54- before_script :
55- - go version
56- - make cr_generate
57- script :
58- - git diff
59- - test -z "$(git diff 2> /dev/null)" || exit "CRD generation was not generated, issue \`make cr_generate\` and commit the result"
60- - test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit "CRD generation created untracked files, cannot proceed"
61- tidy :
62- stage : lint
63- needs : []
64- rules :
65- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
66- - if : $CI_PIPELINE_SOURCE == 'push'
67- image :
68- name : $CI_REGISTRY_GO/golang:$GO_VERSION
69- entrypoint : [""]
70- tags :
71- - go
72- script :
73- - go mod tidy
74- - test -z "$(git diff 2> /dev/null)" || exit 'Go modules not tidied, issue \`go mod tidy\` and commit the result'
75- gofumpt :
76- stage : lint
77- needs : []
78- rules :
79- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
80- - if : $CI_PIPELINE_SOURCE == 'push'
81- image :
82- name : $CI_REGISTRY_GO/golang:$GO_VERSION
83- entrypoint : [""]
84- tags :
85- - go
86- script :
87- - make gofumpt
88- - test -z "$(git diff 2> /dev/null)" || exit 'Go code not formatted, issue \`make gofumpt\` and commit the result'
89- golangci_lint :
90- stage : lint
91- needs : []
92- rules :
93- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
94- - if : $CI_PIPELINE_SOURCE == 'push'
95- image :
96- name : $CI_REGISTRY_GO/golang:$GO_VERSION
97- entrypoint : [""]
98- tags :
99- - go
100- script :
101- - make lint-seq
102- commit-policy :
103- stage : lint
104- needs : []
105- rules :
106- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
107- image :
108- name : $CI_REGISTRY_GO/commit-check:5.2.0
109- entrypoint : [""]
110- tags :
111- - go
112- script :
113- - /check
114- unit-tests :
115- needs : ["diff", "tidy"]
116- rules :
117- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
118- - if : $CI_PIPELINE_SOURCE == 'push'
119- stage : unit-tests
120- image :
121- name : $CI_REGISTRY_GO/haproxy-alpine:3.1-go$GO_VERSION
122- entrypoint : [""]
123- tags :
124- - go
125- script :
126- - go build -v .
127- - go test -v ./...
128- docker-build :
129- stage : build
130- needs : []
131- rules :
132- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
133- - if : $CI_PIPELINE_SOURCE == 'push'
134- - if : $CI_PIPELINE_SOURCE == 'schedule'
135- image : $CI_REGISTRY_GO/docker:$DOCKER_VERSION-go$GO_VERSION
136- services :
137- - name : $CI_REGISTRY_GO/docker:$DOCKER_VERSION-dind
138- alias : docker
139- tags :
140- - go
141- before_script :
142- - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY_GO
143- - go version
144- - docker pull -q $CI_REGISTRY_GO/alpine:3
145- - docker image tag $CI_REGISTRY_GO/alpine:3 alpine:3
146- - docker pull -q $CI_REGISTRY_GO/golang:$GO_VERSION-alpine
147- - docker image tag $CI_REGISTRY_GO/golang:$GO_VERSION-alpine golang:$GO_VERSION-alpine
148- - sed -i "s~FROM golang~FROM $CI_REGISTRY_GO/golang~g" "build/Dockerfile"
149- - sed -i "s~FROM haproxytech/haproxy-alpine~FROM $CI_REGISTRY_GO/haproxy-alpine~g" "build/Dockerfile"
150- script :
151- - mkdir -p tar
152- - make build
153- - docker save -o tar/k8sIC.tar haproxytech/kubernetes-ingress:latest
154- artifacts :
155- when : on_success
156- paths :
157- - tar
158- expire_in : 60 minutes
159- .kind_deployment :
160- stage : e2e-tests
161- retry : 2
162- needs : ["diff", "tidy", "docker-build"]
163- rules :
164- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
165- - if : $CI_PIPELINE_SOURCE == 'push'
166- - if : $CI_PIPELINE_SOURCE == 'schedule'
167- image : $CI_REGISTRY_GO/docker:$DOCKER_VERSION-go$GO_VERSION
168- services :
169- - name : $CI_REGISTRY_GO/docker:$DOCKER_VERSION-dind
170- alias : docker
171- tags :
172- - go
173- artifacts :
174- paths :
175- - tar
176- expire_in : 1 minutes
177- exclude :
178- - tar/*
179- before_script :
180- - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY_GO
181- - docker load -i tar/k8sIC.tar
182- - go version
183- - go mod download &
184- # - docker pull -q $CI_REGISTRY_GO/alpine:3
185- # - docker image tag $CI_REGISTRY_GO/alpine:3 alpine:3
186- # - docker pull -q $CI_REGISTRY_GO/golang:$GO_VERSION-alpine
187- # - docker image tag $CI_REGISTRY_GO/golang:$GO_VERSION-alpine golang:$GO_VERSION-alpine
188- - docker pull -q $CI_REGISTRY_GO/haproxytech/http-echo:latest
189- - docker image tag $CI_REGISTRY_GO/haproxytech/http-echo:latest haproxytech/http-echo:latest
190- - docker pull -q $CI_REGISTRY_GO/haproxytech/proxy-protocol:latest
191- - docker image tag $CI_REGISTRY_GO/haproxytech/proxy-protocol:latest haproxytech/proxy-protocol:latest
192- - wget -nv -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64
193- - chmod +x /usr/local/bin/kind
194- - wget -nv -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl
195- - chmod +x /usr/local/bin/kubectl
196- - sed -i "s/K8S_VERSION/$K8S_VERSION/g" ".gitlab/kind-config.yaml"
197- - sed -i "s/KUBEADM_VER/$KUBEADM_VER/g" ".gitlab/kind-config.yaml"
198- - sed -i "s~CI_REGISTRY_GO~$CI_REGISTRY_GO~g" ".gitlab/kind-config.yaml"
199- - sed -i "s~FROM golang~FROM $CI_REGISTRY_GO/golang~g" "build/Dockerfile"
200- - sed -i "s~FROM haproxytech/haproxy-alpine~FROM $CI_REGISTRY_GO/haproxy-alpine~g" "build/Dockerfile"
201- - cat ./.gitlab/kind-config.yaml
202- - kind create cluster --name=dev --config=./.gitlab/kind-config.yaml
203- - sed -i -E -e "s/localhost|0\.0\.0\.0|127\.0\.0\.1/docker/g" "$HOME/.kube/config"
204- - sed -i -E -e "s/localhost|0\.0\.0\.0|127\.0\.0\.1/docker/g" "deploy/tests/e2e/client.go"
205- - until kubectl get nodes -o wide;do sleep 2; done
206- - kubectl get pods -A
207- after_script :
208- - kubectl get pods -A
209- - kind delete cluster --name=dev
210- parallel :
211- matrix :
212- - TEST_PART : ["parallel", "https", "sequential-1", "sequential-2"]
213- script :
214- - gotest --version
215- - CI_ENV=gitlab deploy/tests/create.sh
216- - kubectl get pods -A
217- - echo "running make -f Makefile.ci ci-e2e-$TEST_PART tests" && make -f Makefile.ci ci-e2e-$TEST_PART
218- .kind_deployment_schedules :
219- extends : .kind_deployment
220- rules :
221- - if : $CI_PIPELINE_SOURCE == "schedule"
222- allow_failure : true
223- e2e_k8s_30 :
224- stage : e2e_k8s_30
225- needs : ["docker-build"]
226- variables :
227- K8S_VERSION : v1.30.10
228- KUBEADM_VER : v1beta3
229- KUBECTL : v1.30.4
230- extends : .kind_deployment_schedules
231- e2e_k8s_31 :
232- stage : e2e_k8s_31
233- needs : ["docker-build"]
234- variables :
235- K8S_VERSION : v1.31.6
236- KUBEADM_VER : v1beta3
237- KUBECTL : v1.31.0
238- extends : .kind_deployment_schedules
239- e2e_k8s_32 :
240- stage : e2e_k8s_32
241- needs : ["docker-build"]
242- variables :
243- K8S_VERSION : v1.32.2
244- KUBEADM_VER : v1beta3
245- KUBECTL : v1.31.0
246- extends : .kind_deployment
247- rules :
248- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
249- - if : ' $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_NAMESPACE != "haproxy-controller"'
16+ DOCKER_VERSION : " 28.1"
17+ include :
18+ - local : .gitlab/bots.yml
19+ - local : .gitlab/diff.yml
20+ - local : .gitlab/lint.yml
21+ - local : .gitlab/unit-tests.yml
22+ - local : .gitlab/build.yml
23+ - local : .gitlab/e2e_k8s.yml
0 commit comments