forked from NVIDIA/gpu-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.nvidia-ci.yml
105 lines (94 loc) · 3.1 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
default:
tags:
- type/docker
- docker/privileged
- cnt
- container-dev
- os/linux
include:
- local: '.common-ci.yml'
variables:
# Release "devel"-tagged images off the master branch
RELEASE_DEVEL_BRANCH: "master"
RELEASE_DEVEL_TAG: "devel"
# The .scan step forms the base of the image scan operation performed before releasing
# images.
.scan:
stage: scan
variables:
REGISTRY: "${CI_REGISTRY_IMAGE}"
VERSION: "${CI_COMMIT_SHA}"
# Define both OUT_IMAGE and OUT_IMAGE_TAG to allow for these to be used when scanning the
# "local" (tagged) image
OUT_IMAGE_TAG: "${CI_COMMIT_SHA}-${TARGET}"
OUT_IMAGE: "${IMAGE_NAME}"
except:
variables:
- $CI_COMMIT_MESSAGE =~ /\[skip[ _-]scans?\]/i
- $SKIP_SCANS
before_script:
- apk add --no-cache git
- apk add --no-cache python3 python3-dev py3-pip py3-wheel libmagic
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
- docker pull "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${CI_COMMIT_SHA}-${TARGET}"
- docker tag "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${CI_COMMIT_SHA}-${TARGET}" "${OUT_IMAGE}:${OUT_IMAGE_TAG}"
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab-master.nvidia.com/sectooling/scanning/contamer.git
- pip3 install -r contamer/requirements.txt
script:
- cd contamer
- python3 contamer.py -ls --fail-on-non-os ${CONTAMER_SUPPRESS_VULNS:+--suppress-vulns ${CONTAMER_SUPPRESS_VULNS}} -- "${OUT_IMAGE}:${OUT_IMAGE_TAG}"
scan:gpu-operator:
extends:
- .scan
- .target-gpu-operator
scan:gpu-operator-validator:
extends:
- .scan
- .target-gpu-operator-validator
# 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}" # This needs to change for the gpu-operator and gpu-operator-validator
.release:dockerhub:
extends: .release:external
variables:
OUT_REGISTRY_USER: "${REGISTRY_USER}"
OUT_REGISTRY_TOKEN: "${REGISTRY_TOKEN}"
OUT_REGISTRY: "${DOCKERHUB_REGISTRY}"
OUT_IMAGE: "${REGISTRY_IMAGE}" # This needs to change for the gpu-operator and gpu-operator-validator
release:ngc-gpu-operator:
extends:
- .release:ngc
- .target-gpu-operator
dependencies:
- deploy:sha-ci-gpu-operator
- scan:gpu-operator
release:ngc-gpu-operator-validator:
extends:
- .release:ngc
- .target-gpu-operator-validator
variables:
OUT_IMAGE: "${NGC_PROD_VALIDATOR_IMAGE}"
dependencies:
- deploy:sha-ci-gpu-operator-validator
- scan:gpu-operator-validator
release:dockerhub-gpu-operator:
extends:
- .release:dockerhub
- .target-gpu-operator
dependencies:
- deploy:sha-ci-gpu-operator
- scan:gpu-operator
release:dockerhub-gpu-operator-validator:
extends:
- .release:dockerhub
- .target-gpu-operator-validator
variables:
OUT_IMAGE: "${REGISTRY_IMAGE}-validator"
dependencies:
- deploy:sha-ci-gpu-operator-validator
- scan:gpu-operator-validator