-
Notifications
You must be signed in to change notification settings - Fork 299
/
.gitlab-ci.yml
212 lines (189 loc) · 5.1 KB
/
.gitlab-ci.yml
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
include:
- local: '.common-ci.yml'
- project: nvidia/container-infrastructure/aws-kube-ci
file: aws-kube-ci.yml
ref: 23.09.29
variables:
GIT_SUBMODULE_PATHS: aws-kube-ci
helm-lint:
stage: config-checks
allow_failure: true
image:
name: alpine/git
entrypoint: ['/usr/bin/env']
before_script:
- apk add --update curl curl-dev openssl bash git openssh make
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
script:
- helm lint deployments/gpu-operator/
.dev-image:
variables:
IMAGE_NAME: "${CI_REGISTRY_IMAGE}"
IMAGE_TAG: "${CI_COMMIT_REF_SLUG}"
build-dev-image:
extends:
- .dev-image
stage: image
script:
- apk --no-cache add make bash
- make .build-image
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- make .push-build-image
.requires-build-image:
image: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}-build
.config-check:
extends:
- .requires-build-image
stage: config-checks
validate-csv:
extends:
- .config-check
script:
- make validate-csv
validate-helm-values:
extends:
- .config-check
before_script:
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
script:
- make validate-helm-values
go-checks:
extends:
- .requires-build-image
stage: go-checks
script:
- make check
go-build:
extends:
- .requires-build-image
stage: go-build
script:
- make build
unit-tests:
extends:
- .requires-build-image
stage: unit-tests
script:
- make coverage
# Define the image build targets
.image-build:
stage: image-build
variables:
IMAGE_NAME: "${CI_REGISTRY_IMAGE}"
VERSION: "${CI_COMMIT_SHORT_SHA}"
PUSH_ON_BUILD: "true"
before_script:
- !reference [.buildx-setup, before_script]
- apk add --no-cache bash make
- 'echo "Logging in to CI registry ${CI_REGISTRY}"'
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
script:
- make build-${DIST}
build:gpu-operator:
extends:
- .image-build
- .dist-ubi9
- .target-gpu-operator
build:gpu-operator-validator:
extends:
- .image-build
- .dist-ubi9
- .target-gpu-operator-validator
.e2e_defaults:
variables:
TF_VAR_project_name: "gpu-operator"
TF_VAR_kubernetes_version: "v1.27.6"
TF_VAR_additional_ingress_ip_ranges: '["216.228.112.0/26", "217.111.27.192/26"]'
# These should match the images generated by the deploy step.
# TODO: Should these use the staging release instead?
OPERATOR_VERSION: "${CI_COMMIT_SHORT_SHA}"
OPERATOR_IMAGE: "${CI_REGISTRY_IMAGE}"
VALIDATOR_VERSION: "${CI_COMMIT_SHORT_SHA}"
VALIDATOR_IMAGE: "${CI_REGISTRY_IMAGE}/gpu-operator-validator"
GPU_PRODUCT_NAME: "Tesla-T4"
extends:
- .dist-ubi9
except:
variables:
- $CI_COMMIT_MESSAGE =~ /skip-end-to-end-tests/
- $SKIP_TESTS =~ /^y/
- $CI_PIPELINE_SOURCE == "schedule"
.e2e_tests:
extends:
- .e2e_defaults
stage: e2e_tests
image: alpine
variables:
SKIP_LAUNCH: "true"
before_script:
- apk add --no-cache openssh-client rsync bash
script:
- source aws-kube-ci/hostname
- export private_key="${CI_PROJECT_DIR}/aws-kube-ci/${private_key}"
- export instance_hostname="${instance_hostname}"
- export TEST_CASE="${TEST_CASE}"
- rc=0
- ${CI_PROJECT_DIR}/tests/ci-run-e2e.sh ${OPERATOR_IMAGE} ${OPERATOR_VERSION} ${VALIDATOR_IMAGE} ${VALIDATOR_VERSION} ${GPU_PRODUCT_NAME} ${TEST_CASE} || rc=$?
- ${CI_PROJECT_DIR}/tests/scripts/pull.sh /tmp/logs logs
- exit $rc
artifacts:
when: always
paths:
- logs/
e2e_tests_containerd:
extends:
- .e2e_tests
dependencies:
- aws_kube_setup_containerd
needs:
- aws_kube_setup_containerd
variables:
CONTAINER_RUNTIME: "containerd"
TEST_CASE: "./tests/cases/defaults.sh"
e2e_tests_nvidiadriver:
extends:
- .e2e_tests
dependencies:
- aws_kube_setup_nvidiadriver
needs:
- aws_kube_setup_nvidiadriver
variables:
CONTAINER_RUNTIME: "containerd"
TEST_CASE: "./tests/cases/nvidia-driver.sh"
.launch_infra:
extends:
- .aws_kube_setup
- .e2e_defaults
variables:
TF_VAR_project_name: "gpu-operator"
TF_VAR_additional_ingress_ip_ranges: '["216.228.112.0/26", "217.111.27.192/26"]'
aws_kube_setup_containerd:
extends:
- .launch_infra
variables:
TF_VAR_container_runtime: "containerd"
TF_VAR_project_name: "gpu-operator-containerd"
aws_kube_setup_nvidiadriver:
extends:
- .launch_infra
variables:
TF_VAR_container_runtime: "containerd"
TF_VAR_project_name: "gpu-operator-nvidiadriver"
aws_kube_clean_containerd:
extends:
- .aws_kube_clean
- .e2e_defaults
variables:
TF_VAR_container_runtime: "containerd"
TF_VAR_project_name: "gpu-operator-containerd"
dependencies:
- aws_kube_setup_containerd
aws_kube_clean_nvidiadriver:
extends:
- .aws_kube_clean
- .e2e_defaults
variables:
TF_VAR_container_runtime: "containerd"
TF_VAR_project_name: "gpu-operator-nvidiadriver"
dependencies:
- aws_kube_setup_nvidiadriver