22 - diff
33 - lint
44 - unit-tests
5+ - build
56 - e2e-tests
67variables :
78 KUBECTL : v1.19.3
2526 - branches
2627tidy :
2728 stage : lint
29+ needs : []
2830 image :
2931 name : $CI_REGISTRY_GO/golang:1.19
3032 entrypoint : [""]
3840 - branches
3941golangci_lint :
4042 stage : lint
43+ needs : []
4144 image :
4245 name : $CI_REGISTRY_GO/lint:1.33
4346 entrypoint : [""]
@@ -50,6 +53,7 @@ golangci_lint:
5053 - branches
5154lint-commit-msg :
5255 stage : lint
56+ needs : []
5357 image :
5458 name : $CI_REGISTRY_GO/check-commit:v2.1.0
5559 entrypoint : [""]
@@ -60,6 +64,7 @@ lint-commit-msg:
6064 only :
6165 - merge_requests
6266unit-tests :
67+ needs : ["diff", "tidy"]
6368 stage : unit-tests
6469 image :
6570 name : $CI_REGISTRY_GO/haproxy-alpine:2.5-go1.19
@@ -72,8 +77,9 @@ unit-tests:
7277 only :
7378 - merge_requests
7479 - branches
75- .kind_deployment :
76- stage : e2e-tests
80+ docker-build :
81+ stage : build
82+ needs : []
7783 image : $CI_REGISTRY_GO/docker:stable-go1.19
7884 services :
7985 - name : $CI_REGISTRY_GO/docker:18.09.7-dind
@@ -82,13 +88,47 @@ unit-tests:
8288 - go
8389 before_script :
8490 - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY_GO
85- script :
8691 - go version
87- - docker pull $CI_REGISTRY_GO/alpine:3
92+ - docker pull -q $CI_REGISTRY_GO/alpine:3
8893 - docker image tag $CI_REGISTRY_GO/alpine:3 alpine:3
89- - docker pull $CI_REGISTRY_GO/golang:1.19-alpine
94+ - docker pull -q $CI_REGISTRY_GO/golang:1.19-alpine
9095 - docker image tag $CI_REGISTRY_GO/golang:1.19-alpine golang:1.19-alpine
91- - wget -q -o /dev/null -O &> /dev/null /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64
96+ - sed -i "s~FROM golang~FROM $CI_REGISTRY_GO/golang~g" "build/Dockerfile"
97+ - sed -i "s~FROM haproxytech/haproxy-alpine~FROM $CI_REGISTRY_GO/haproxy-alpine~g" "build/Dockerfile"
98+ script :
99+ - mkdir -p tar
100+ - make build
101+ - docker save -o tar/k8sIC.tar haproxytech/kubernetes-ingress:latest
102+ artifacts :
103+ when : on_success
104+ paths :
105+ - tar
106+ expire_in : 15 minutes
107+ .kind_deployment :
108+ stage : e2e-tests
109+ needs : ["diff", "tidy", "docker-build"]
110+ image : $CI_REGISTRY_GO/docker:stable-go1.19
111+ services :
112+ - name : $CI_REGISTRY_GO/docker:18.09.7-dind
113+ alias : docker
114+ tags :
115+ - go
116+ artifacts :
117+ paths :
118+ - tar
119+ expire_in : 30 minutes
120+ before_script :
121+ - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY_GO
122+ - docker load -i tar/k8sIC.tar
123+ - go version
124+ - go mod download &
125+ # - docker pull -q $CI_REGISTRY_GO/alpine:3
126+ # - docker image tag $CI_REGISTRY_GO/alpine:3 alpine:3
127+ # - docker pull -q $CI_REGISTRY_GO/golang:1.19-alpine
128+ # - docker image tag $CI_REGISTRY_GO/golang:1.19-alpine golang:1.19-alpine
129+ - docker pull -q $CI_REGISTRY_GO/haproxytech/http-echo:latest
130+ - docker image tag $CI_REGISTRY_GO/haproxytech/http-echo:latest haproxytech/http-echo:latest
131+ - wget -nv -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64
92132 - chmod +x /usr/local/bin/kind
93133 - wget -q -o /dev/null -O &> /dev/null /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl
94134 - chmod +x /usr/local/bin/kubectl
@@ -101,16 +141,20 @@ unit-tests:
101141 - sed -i -E -e "s/localhost|0\.0\.0\.0|127\.0\.0\.1/docker/g" "deploy/tests/e2e/client.go"
102142 - until kubectl get nodes -o wide;do sleep 2; done
103143 - kubectl get pods -A
104- - CI_ENV=gitlab deploy/tests/create.sh
105- - kubectl get pods -A
106- - KIND_URL=docker CGO_ENABLED=0 go test -v ./deploy/tests/e2e/... --tags=e2e_parallel
107- - KIND_URL=docker CGO_ENABLED=0 go test -v -p 1 ./deploy/tests/e2e/... --tags=e2e_sequential
108144 after_script :
109145 - kubectl get pods -A
110146 - kind delete cluster --name=dev
111147 only :
112148 - merge_requests
113149 - branches
150+ parallel :
151+ matrix :
152+ - TEST_PART : [ "18#e2e_parallel", "1#e2e_sequential" ]
153+ VAR_DUMMY : " YES"
154+ script :
155+ - CI_ENV=gitlab deploy/tests/create.sh
156+ - kubectl get pods -A
157+ - 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]}
114158.kind_deployment_schedules :
115159 only :
116160 - schedules
0 commit comments