This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
.nvidia-ci.yml
185 lines (164 loc) · 4.04 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
---
##
## Variables that control where build artifacts are places for scanning and testing:
## CI_REGISTRY
## CI_REGISTRY_IMAGE
## CI_REGISTRY_USER
## CI_REGISTRY_PASSWORD
##
## Variables that control where release artifacts go:
## NGC_REGISTRY
## NGC_REGISTRY_IMAGE
## NGC_REGISTRY_USER
## NGC_REGISTRY_TOKEN
## REGISTRY_TOKEN
## REGISTRY_USER
## REGISTRY_IMAGE
## DOCKERHUB_REGISTRY
# We include the public gitlab CI definition to reuse the steps defined there
include:
- local: '.common-ci.yml'
default:
tags:
- type/docker
- docker/privileged
- cnt
- container-dev
- os/linux
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
# Release "devel"-tagged images off the master branch
RELEASE_DEVEL_BRANCH: "master"
RELEASE_DEVEL_TAG: "devel"
stages:
- build
- test
- scan
- deploy
- release
# Note: The integration tests are disabled for this repository.
# Here we fail them, but allow the pipeline to continue.
skipped_integration:
stage: test
script:
- echo "Tests are not enabled"
- exit 0
# 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}/${IMAGE_NAME}:${CI_COMMIT_SHA}-${DIST}"
IMAGE_ARCHIVE: "toolkit-container.tar"
except:
variables:
- $CI_COMMIT_MESSAGE =~ /\[skip[ _-]scans?\]/i
- $SKIP_SCANS
before_script:
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- docker pull "${IMAGE}"
- docker save "${IMAGE}" -o "${IMAGE_ARCHIVE}"
script:
- 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
- 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
scan-centos7:
extends:
- .scan
- .target-centos7
scan-centos8:
extends:
- .scan
- .target-centos8
scan-ubuntu18:
extends:
- .scan
- .target-ubuntu18
scan-ubi8:
extends:
- .scan
- .target-ubi8
# Define the external release steps for NGC and Dockerhub
.release:ngc:
extends: .release:external
variables:
OUT_REGISTRY_USER: "${NGC_REGISTRY_USER}"
OUT_REGISTRY_TOKEN: "${NGC_REGISTRY_TOKEN}"
OUT_REGISTRY: "${NGC_REGISTRY}"
OUT_IMAGE: "${NGC_REGISTRY_IMAGE}"
.release:dockerhub:
extends: .release:external
variables:
OUT_REGISTRY_USER: "${REGISTRY_USER}"
OUT_REGISTRY_TOKEN: "${REGISTRY_TOKEN}"
OUT_REGISTRY: "${DOCKERHUB_REGISTRY}"
OUT_IMAGE: "${REGISTRY_IMAGE}"
release:ngc-centos7:
extends:
- .release:ngc
- .target-centos7
dependencies:
- deploy:sha-ci-centos7
- scan-centos7
release:ngc-centos8:
extends:
- .release:ngc
- .target-centos8
dependencies:
- deploy:sha-ci-centos8
- scan-centos8
release:ngc-ubuntu18:
extends:
- .release:ngc
- .target-ubuntu18
dependencies:
- deploy:sha-ci-ubuntu18
- scan-ubuntu18
release:ngc-ubi8:
extends:
- .release:ngc
- .target-ubi8
dependencies:
- deploy:sha-ci-ubi8
- scan-ubi8
release:dockerhub-centos7:
extends:
- .release:dockerhub
- .target-centos7
dependencies:
- deploy:sha-ci-centos7
- scan-centos7
release:dockerhub-centos8:
extends:
- .release:dockerhub
- .target-centos8
dependencies:
- deploy:sha-ci-centos8
- scan-centos8
release:dockerhub-ubuntu18:
extends:
- .release:dockerhub
- .target-ubuntu18
dependencies:
- deploy:sha-ci-ubuntu18
- scan-ubuntu18
release:dockerhub-ubi8:
extends:
- .release:dockerhub
- .target-ubi8
dependencies:
- deploy:sha-ci-ubi8
- scan-ubi8