-
Notifications
You must be signed in to change notification settings - Fork 4
/
.nvidia-ci.yml
235 lines (213 loc) · 6.24 KB
/
.nvidia-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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
include:
- local: '.common-ci.yml'
default:
tags:
- cnt
- container-dev
- docker/multi-arch
- docker/privileged
- os/linux
- type/docker
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
# Don't release "devel-tagged" images
RELEASE_DEVEL_BRANCH: "DISABLED"
DEVEL_RELEASE_IMAGE_VERSION: "devel"
# On the multi-arch builder we don't need the qemu setup.
SKIP_QEMU_SETUP: "1"
# Define the public staging registry
STAGING_REGISTRY: ghcr.io/nvidia
STAGING_VERSION: ${CI_COMMIT_SHORT_SHA}
.image-pull:
stage: image-build
variables:
IN_REGISTRY: "${STAGING_REGISTRY}"
IN_IMAGE_NAME: k8s-samples
IN_VERSION: "${LOWER_CASE_SAMPLE}-${STAGING_VERSION}"
OUT_REGISTRY_USER: "${CI_REGISTRY_USER}"
OUT_REGISTRY_TOKEN: "${CI_REGISTRY_PASSWORD}"
OUT_REGISTRY: "${CI_REGISTRY}"
OUT_IMAGE_NAME: ${CI_REGISTRY_IMAGE}/cuda-samples
OUT_VERSION: ${LOWER_CASE_SAMPLE}-${CI_COMMIT_SHORT_SHA}
PUSH_MULTIPLE_TAGS: "false"
# We delay the job start to allow the public pipeline to generate the required images.
when: delayed
start_in: 30 minutes
timeout: 30 minutes
retry:
max: 2
when:
- job_execution_timeout
- stuck_or_timeout_failure
before_script:
- !reference [.regctl-setup, before_script]
- apk add --no-cache make bash
- >
regctl manifest get ${IN_REGISTRY}/${IN_IMAGE_NAME}:${IN_VERSION}-${DIST} --list > /dev/null && echo "${IN_REGISTRY}/${IN_IMAGE_NAME}:${IN_VERSION}-${DIST}" || ( echo "${IN_REGISTRY}/${IN_IMAGE_NAME}:${IN_VERSION}-${DIST} does not exist" && sleep infinity )
script:
- regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"
- make -f deployments/container/Makefile IMAGE=${IN_REGISTRY}/${IN_IMAGE_NAME}:${IN_VERSION}-${DIST} OUT_IMAGE=${OUT_IMAGE_NAME}:${OUT_VERSION}-${DIST} push-${DIST}
image-vectoradd-ubuntu22.04:
extends:
- .image-pull
- .dist-ubuntu22.04
- .sample-vectoradd
image-vectoradd-ubi8:
extends:
- .image-pull
- .dist-ubi8
- .sample-vectoradd
image-device-query-ubuntu22.04:
extends:
- .image-pull
- .dist-ubuntu22.04
- .sample-device-query
image-nbody-ubuntu22.04:
extends:
- .image-pull
- .dist-ubuntu22.04
- .sample-nbody
# The .scan step forms the base of the image scan operation performed before releasing
# images.
.scan:
stage: scan
image: "${PULSE_IMAGE}"
variables:
IMAGE: "${CI_REGISTRY_IMAGE}/cuda-samples:${LOWER_CASE_SAMPLE}-${CI_COMMIT_SHORT_SHA}-${DIST}"
IMAGE_ARCHIVE: "cuda-samples.tar"
except:
variables:
- $SKIP_SCANS && $SKIP_SCANS == "yes"
before_script:
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- docker pull --platform="${PLATFORM}" "${IMAGE}"
- docker save "${IMAGE}" -o "${IMAGE_ARCHIVE}"
- AuthHeader=$(echo -n $SSA_CLIENT_ID:$SSA_CLIENT_SECRET | base64 -w0)
- >
export SSA_TOKEN=$(curl --request POST --header "Authorization: Basic $AuthHeader" --header "Content-Type: application/x-www-form-urlencoded" ${SSA_ISSUER_URL} | jq ".access_token" | tr -d '"')
- if [ -z "$SSA_TOKEN" ]; then exit 1; else echo "SSA_TOKEN set!"; fi
script:
- pulse-cli -n $NSPECT_ID --ssa $SSA_TOKEN scan -i $IMAGE_ARCHIVE -p $CONTAINER_POLICY -o
artifacts:
when: always
expire_in: 1 week
paths:
- pulse-cli.log
- licenses.json
- sbom.json
- vulns.json
- policy_evaluation.json
# Define the scan targets
scan-vectoradd-ubuntu22.04-amd64:
extends:
- .scan
- .sample-vectoradd
- .dist-ubuntu22.04
- .platform-amd64
needs:
- image-vectoradd-ubuntu22.04
scan-vectoradd-ubuntu22.04-arm64:
extends:
- .scan
- .sample-vectoradd
- .dist-ubuntu22.04
- .platform-arm64
needs:
- image-vectoradd-ubuntu22.04
- scan-vectoradd-ubuntu22.04-amd64
scan-device-query-ubuntu22.04-amd64:
extends:
- .scan
- .sample-device-query
- .dist-ubuntu22.04
- .platform-amd64
needs:
- image-device-query-ubuntu22.04
scan-device-query-ubuntu22.04-arm64:
extends:
- .scan
- .sample-device-query
- .dist-ubuntu22.04
- .platform-arm64
needs:
- image-device-query-ubuntu22.04
- scan-device-query-ubuntu22.04-amd64
scan-vectoradd-ubi8-amd64:
extends:
- .scan
- .sample-vectoradd
- .dist-ubi8
- .platform-amd64
needs:
- image-vectoradd-ubi8
scan-vectoradd-ubi8-arm64:
extends:
- .scan
- .sample-vectoradd
- .dist-ubi8
- .platform-arm64
needs:
- image-vectoradd-ubi8
- scan-vectoradd-ubi8-amd64
scan-nbody-ubuntu22.04-amd64:
extends:
- .scan
- .sample-nbody
- .dist-ubuntu22.04
- .platform-amd64
needs:
- image-nbody-ubuntu22.04
scan-nbody-ubuntu22.04-arm64:
extends:
- .scan
- .sample-nbody
- .dist-ubuntu22.04
- .platform-arm64
needs:
- image-nbody-ubuntu22.04
- scan-nbody-ubuntu22.04-amd64
# Define external release helpers
.release:ngc:
extends:
- .release:external
variables:
OUT_REGISTRY_USER: "${NGC_REGISTRY_USER}"
OUT_REGISTRY_TOKEN: "${NGC_REGISTRY_TOKEN}"
OUT_REGISTRY: "${NGC_REGISTRY}"
OUT_IMAGE_NAME: "${NGC_REGISTRY_IMAGE}"
# Define the external release targets
# Release to NGC
release:ngc-vectoradd-ubuntu22.04:
extends:
- .release:ngc
- .dist-ubuntu22.04
- .sample-vectoradd
release:ngc-device-query-ubuntu22.04:
extends:
- .release:ngc
- .dist-ubuntu22.04
- .sample-device-query
release:ngc-vectoradd-ubi8:
extends:
- .release:ngc
- .dist-ubi8
- .sample-vectoradd
release:ngc-nbody-ubuntu22.04:
extends:
- .release:ngc
- .dist-ubuntu22.04
- .sample-nbody