-
Notifications
You must be signed in to change notification settings - Fork 322
/
Copy path.nvidia-ci.yml
174 lines (162 loc) · 6.17 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
default:
tags:
- type/docker
- docker/privileged
- cnt
- container-dev
- os/linux
include:
- local: '.common-ci.yml'
contamer:
extends: .scan
script:
- apk add --no-cache bash findutils libmagic curl make git
- apk add --no-cache python3 python3-dev py3-pip py3-wheel
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab-master.nvidia.com/sectooling/scanning/contamer.git
- cd contamer
- pip3 install -r requirements.txt
- docker tag ${CI_REGISTRY_IMAGE}:${VERSION} ${CI_PROJECT_NAME}:${VERSION}
- python3 contamer.py -ls --fail-on-non-os ${CONTAMER_SUPPRESS_VULNS:+--suppress-vulns ${CONTAMER_SUPPRESS_VULNS}} -- ${CI_PROJECT_NAME}:${VERSION}
contamer:validator:
extends: .scan
script:
- apk add --no-cache bash findutils libmagic curl make git
- apk add --no-cache python3 python3-dev py3-pip py3-wheel
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab-master.nvidia.com/sectooling/scanning/contamer.git
- cd contamer
- pip3 install -r requirements.txt
- docker tag ${CI_REGISTRY_IMAGE}/${VALIDATOR_IMAGE_NAME}:${VERSION} ${VALIDATOR_IMAGE_NAME}:${VERSION}
- python3 contamer.py -ls --fail-on-non-os ${CONTAMER_SUPPRESS_VULNS:+--suppress-vulns ${CONTAMER_SUPPRESS_VULNS}} -- ${VALIDATOR_IMAGE_NAME}:${VERSION}
release:ngc:
stage: release
dependencies:
- build-image
- versioning
image: docker:stable
services:
- docker:stable-dind
variables:
GIT_STRATEGY: clone
only:
refs:
- master
- /^v\d+\.\d+\.\d+$/
script:
- source .VERSION_INFO
# Push Operator Container to NGC
- docker login -u "${NGC_REGISTRY_USER}" -p "${NGC_REGISTRY_TOKEN}" "${NGC_REGISTRY}"
- docker pull "${CI_REGISTRY_IMAGE}:${VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}:${VERSION}" "${NGC_PROD_IMAGE}:${VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}:${VERSION}" "${NGC_PROD_IMAGE}:latest"
- docker push ${NGC_PROD_IMAGE}:${VERSION}
- docker push ${NGC_PROD_IMAGE}:latest
release:ngc:validator:
stage: release
dependencies:
- build-image
- versioning
image: docker:stable
services:
- docker:stable-dind
variables:
GIT_STRATEGY: clone
only:
refs:
- master
- /^v\d+\.\d+\.\d+$/
script:
- source .VERSION_INFO
# Push Operator Validator Container to NGC
- docker login -u "${NGC_REGISTRY_USER}" -p "${NGC_REGISTRY_TOKEN}" "${NGC_REGISTRY}"
- docker pull "${CI_REGISTRY_IMAGE}/${VALIDATOR_IMAGE_NAME}:${VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}/${VALIDATOR_IMAGE_NAME}:${VERSION}" "${NGC_PROD_VALIDATOR_IMAGE}:${VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}/${VALIDATOR_IMAGE_NAME}:${VERSION}" "${NGC_PROD_VALIDATOR_IMAGE}:latest"
- docker push ${NGC_PROD_VALIDATOR_IMAGE}:${VERSION}
- docker push ${NGC_PROD_VALIDATOR_IMAGE}:latest
release:dockerhub:
stage: release
dependencies:
- build-image
- versioning
image: docker:stable
services:
- docker:stable-dind
variables:
GIT_STRATEGY: clone
only:
refs:
- master
- /^v\d+\.\d+\.\d+$/
script:
# Push Operator Container to Dockerhub
- source .VERSION_INFO
- docker login -u "${REGISTRY_USER}" -p "${REGISTRY_TOKEN}" "${DOCKERHUB_REGISTRY}"
- docker pull "${CI_REGISTRY_IMAGE}:${VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}:${VERSION}" "${DH_PROD_IMAGE}:${VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}:${VERSION}" "${DH_PROD_IMAGE}:latest"
- docker push "${DH_PROD_IMAGE}:${VERSION}"
- docker push "${DH_PROD_IMAGE}:latest"
release:dockerhub:validator:
stage: release
dependencies:
- build-image
- versioning
image: docker:stable
services:
- docker:stable-dind
variables:
GIT_STRATEGY: clone
only:
refs:
- master
- /^v\d+\.\d+\.\d+$/
script:
# Push Operator Validator Container to Dockerhub
- source .VERSION_INFO
- docker login -u "${REGISTRY_USER}" -p "${REGISTRY_TOKEN}" "${DOCKERHUB_REGISTRY}"
- docker pull "${CI_REGISTRY_IMAGE}/${VALIDATOR_IMAGE_NAME}:${VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}/${VALIDATOR_IMAGE_NAME}:${VERSION}" "${DH_PROD_VALIDATOR_IMAGE}:${VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}/${VALIDATOR_IMAGE_NAME}:${VERSION}" "${DH_PROD_VALIDATOR_IMAGE}:latest"
- docker push "${DH_PROD_VALIDATOR_IMAGE}:${VERSION}"
- docker push "${DH_PROD_VALIDATOR_IMAGE}:latest"
release:helm:
stage: release
dependencies:
- versioning
image: docker:stable
services:
- docker:stable-dind
variables:
GIT_STRATEGY: clone
only:
variables:
- $RELEASE_HELM == "true"
refs:
- master
- /^v\d+\.\d+\.\d+$/
script:
- source .VERSION_INFO
- apk add --update curl openssl bash git openssh make
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
- mkdir ~/.ssh && echo "$PRIVATE_SSH_KEY" &> ~/.ssh/id_rsa && chmod 0600 ~/.ssh/id_rsa
- git config --global user.email "[email protected]"
- git config --global user.name "Cloud Native (build automation)"
# Package helm chart into temporary directory
- mkdir -p "${SUBCHART_DIR}"
- rm -rf new-chart && mkdir new-chart
- REPOSITORY="$(dirname "${CI_REGISTRY_IMAGE}")"
- helm package --version "${VERSION}" --app-version "${VERSION}" -d new-chart deployments/gpu-operator
# Generate new index for the chart repo merging with existing one
- git checkout .
- git fetch origin gh-pages && git checkout gh-pages
- helm repo index new-chart --merge ${SUBCHART_DIR}/index.yaml --url https://nvidia.github.io/gpu-operator/${SUBCHART_DIR}
# copy into final chart and create commit
- mv new-chart/*.tgz new-chart/index.yaml ${SUBCHART_DIR}
- git add $(find . ${SUBCHART_DIR} -maxdepth 1 -name "*.tgz" -o -name index.yaml)
- git commit -m "Release version ${VERSION}"
# CI_REPOSITORY_URL=https://gitlab-ci-token:[email protected]/gitlab-examples/ci-debug-trace.git
# should be [email protected]:/gitlab-examples/ci-debug-trace.git
- PUSH_REPO=$(echo "${CI_REPOSITORY_URL}" | sed -e "s|.*@\(.*\)|git@\1|" -e "s|/|:/|" )
- git remote set-url --push origin "${PUSH_REPO}"
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- git push origin gh-pages