2
2
- diff
3
3
- lint
4
4
- unit-tests
5
+ - build
5
6
- e2e-tests
6
7
variables :
7
8
KUBECTL : v1.24.3
25
26
- branches
26
27
tidy :
27
28
stage : lint
29
+ needs : []
28
30
image :
29
31
name : $CI_REGISTRY_GO/golang:1.19
30
32
entrypoint : [""]
38
40
- branches
39
41
golangci_lint :
40
42
stage : lint
43
+ needs : []
41
44
image :
42
45
name : $CI_REGISTRY_GO/lint:1.33
43
46
entrypoint : [""]
@@ -50,6 +53,7 @@ golangci_lint:
50
53
- branches
51
54
lint-commit-msg :
52
55
stage : lint
56
+ needs : []
53
57
image :
54
58
name : $CI_REGISTRY_GO/check-commit:v2.1.0
55
59
entrypoint : [""]
@@ -60,6 +64,7 @@ lint-commit-msg:
60
64
only :
61
65
- merge_requests
62
66
unit-tests :
67
+ needs : ["diff", "tidy"]
63
68
stage : unit-tests
64
69
image :
65
70
name : $CI_REGISTRY_GO/haproxy-alpine:2.5-go1.19
@@ -72,8 +77,9 @@ unit-tests:
72
77
only :
73
78
- merge_requests
74
79
- branches
75
- .kind_deployment :
76
- stage : e2e-tests
80
+ docker-build :
81
+ stage : build
82
+ needs : []
77
83
image : $CI_REGISTRY_GO/docker:stable-go1.19
78
84
services :
79
85
- name : $CI_REGISTRY_GO/docker:18.09.7-dind
@@ -82,12 +88,46 @@ unit-tests:
82
88
- go
83
89
before_script :
84
90
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY_GO
85
- script :
86
91
- go version
87
- - docker pull $CI_REGISTRY_GO/alpine:3
92
+ - docker pull -q $CI_REGISTRY_GO/alpine:3
88
93
- 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
90
95
- docker image tag $CI_REGISTRY_GO/golang:1.19-alpine golang:1.19-alpine
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
91
131
- wget -nv -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64
92
132
- chmod +x /usr/local/bin/kind
93
133
- wget -nv -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl
@@ -102,16 +142,20 @@ unit-tests:
102
142
- sed -i -E -e "s/localhost|0\.0\.0\.0|127\.0\.0\.1/docker/g" "deploy/tests/e2e/client.go"
103
143
- until kubectl get nodes -o wide;do sleep 2; done
104
144
- kubectl get pods -A
105
- - CI_ENV=gitlab deploy/tests/create.sh
106
- - kubectl get pods -A
107
- - KIND_URL=docker CGO_ENABLED=0 go test -v ./deploy/tests/e2e/... --tags=e2e_parallel
108
- - KIND_URL=docker CGO_ENABLED=0 go test -v -p 1 ./deploy/tests/e2e/... --tags=e2e_sequential
109
145
after_script :
110
146
- kubectl get pods -A
111
147
- kind delete cluster --name=dev
112
148
only :
113
149
- merge_requests
114
150
- branches
151
+ parallel :
152
+ matrix :
153
+ - TEST_PART : [ "18#e2e_parallel", "1#e2e_sequential" ]
154
+ VAR_DUMMY : " YES"
155
+ script :
156
+ - CI_ENV=gitlab deploy/tests/create.sh
157
+ - kubectl get pods -A
158
+ - 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]}
115
159
.kind_deployment_schedules :
116
160
only :
117
161
- schedules
0 commit comments