Skip to content

Commit b448511

Browse files
authored
Merge pull request #1405 from NVIDIA/update-release-ci
[no-relnote] Update release pipeline to update nspect before release
2 parents c494b79 + d33f2b5 commit b448511

File tree

1 file changed

+65
-27
lines changed

1 file changed

+65
-27
lines changed

.nvidia-ci.yml

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -203,72 +203,110 @@ push-images-to-staging:
203203
OUT_IMAGE_NAME: "${NGC_STAGING_REGISTRY}/k8s-device-plugin"
204204
OUT_IMAGE_TAG: "${CI_COMMIT_SHORT_SHA}"
205205

206-
.publish-images:
206+
.ngc-publish-variables:
207+
variables:
208+
PROJECT_NAME: "k8s-device-plugin"
209+
VERSIONS_FILE: "build-info-${CI_PIPELINE_ID}.txt"
210+
before_script:
211+
- |
212+
if [ -n "${CI_COMMIT_TAG}" ]; then
213+
echo "${CI_COMMIT_SHORT_SHA} ${CI_COMMIT_TAG}" > "${VERSIONS_FILE}"
214+
else
215+
echo "${CI_COMMIT_SHORT_SHA} publish-${CI_COMMIT_SHORT_SHA}" > "${VERSIONS_FILE}"
216+
fi
217+
218+
.update-nspect:
207219
stage: ngc-publish
208220
needs:
209-
- scan-images
210221
- push-images-to-staging
222+
extends:
223+
- .ngc-publish-variables
211224
image:
212225
name: "${CNT_NGC_PUBLISH_IMAGE}"
213226
pull_policy: always
214227
variables:
228+
REPO_URL: "https://github.com/NVIDIA/${PROJECT_NAME}.git"
229+
script:
230+
- |
231+
cnt-ngc-publish nspect --versions-file "${VERSIONS_FILE}"
215232
233+
# Update the nspect staging environment to test the nspect publishing logic
234+
update-nspect-staging:
235+
extends:
236+
- .update-nspect
237+
rules:
238+
- if: $CI_COMMIT_TAG == null || $CI_COMMIT_TAG == ""
216239
variables:
217-
GITLAB_ACCESS_TOKEN: "${CNT_GITLAB_TOKEN}"
240+
ENV: "stage"
241+
RELEASE_VERSION: "test"
242+
NSPECT_CLIENT_ID: "${NSPECT_STAGING_CLIENT_ID}"
243+
NSPECT_CLIENT_SECRET: "${NSPECT_STAGING_CLIENT_SECRET}"
218244

219-
IN_IMAGE_TAG: "${CI_COMMIT_SHORT_SHA}"
220-
OUT_IMAGE_TAG: "${CI_COMMIT_TAG}"
245+
# Update the nspect production environment with the new release
246+
update-nspect:
247+
extends:
248+
- .update-nspect
249+
rules:
250+
- if: $CI_COMMIT_TAG
251+
variables:
252+
OSRB_BUG_ID: "${OSRB_BUG_ID}"
253+
ENV: "prod"
254+
RELEASE_VERSION: "${CI_COMMIT_TAG}"
255+
NSPECT_CLIENT_ID: "${NSPECT_PROD_CLIENT_ID}"
256+
NSPECT_CLIENT_SECRET: "${NSPECT_PROD_CLIENT_SECRET}"
221257

222-
VERSION_FILE: "build-info-${CI_PIPELINE_ID}.txt"
223-
PROJECT_NAME: "k8s-device-plugin"
258+
.publish-images:
259+
stage: ngc-publish
260+
extends:
261+
- .ngc-publish-variables
262+
image:
263+
name: "${CNT_NGC_PUBLISH_IMAGE}"
264+
pull_policy: always
265+
variables:
266+
GITLAB_ACCESS_TOKEN: "${CNT_GITLAB_TOKEN}"
224267
# Allow for setting nspect program version manually.
225268
# The default empty string value results in the key
226269
# being omitted from the publishing doc (which is
227270
# valid).
228271
NSPECT_PROGRAM_VERSION: ""
229-
before_script:
272+
script:
230273
- |
231-
if [ -n "${OVERRIDE_PUBLISHING_PROJECT_PATH}" ]; then
232-
NGC_PUBLISHING_PROJECT_PATH="${OVERRIDE_PUBLISHING_PROJECT_PATH}"
233-
fi
234-
235274
if [ -z "${NGC_PUBLISHING_PROJECT_PATH}" ]; then
236275
echo "NGC_PUBLISHING_PROJECT_PATH not set"
237276
exit 1
238277
fi
239278
240279
echo "publishing to ${NGC_PUBLISHING_PROJECT_PATH}"
241280
242-
rm -f ${VERSION_FILE}
243-
echo "${IN_IMAGE_TAG} ${OUT_IMAGE_TAG}" >> ${VERSION_FILE}
244-
cat ${VERSION_FILE}
245-
script:
246-
- |
247281
cnt-ngc-publish render \
248282
--project-name "${PROJECT_NAME}" \
249-
--versions-file "${VERSION_FILE}" \
250-
--output "${PROJECT_NAME}".yaml \
283+
--versions-file "${VERSIONS_FILE}" \
284+
--output "${PROJECT_NAME}.yaml" \
251285
--nspect-program-version "${NSPECT_PROGRAM_VERSION}"
252286
- cnt-ngc-publish merge-request --files "${PROJECT_NAME}.yaml"
253287
artifacts:
254288
paths:
255289
- "${VERSION_FILE}"
256290
- "${PROJECT_NAME}.yaml"
257291

258-
259-
publish-images-to-ngc:
292+
# Raise an MR to publish the image to NGC
293+
ngc-image-publish:
260294
extends:
261295
- .publish-images
262296
rules:
263297
- if: $CI_COMMIT_TAG
298+
needs:
299+
- job: update-nspect
300+
variables:
301+
NGC_PUBLISHING_PROJECT_PATH: "${NGC_PUBLISHING_PROD_PROJECT_PATH}"
264302

265-
# We create a dummy MR that exercises the publishing logic.
266-
# TODO: This MR should be closed automatically.
267-
publish-images-dummy:
303+
# Create a dummy MR that exercises the publishing logic
304+
mock-image-publish:
268305
extends:
269306
- .publish-images
270-
variables:
271-
OVERRIDE_PUBLISHING_PROJECT_PATH: "dl/container-dev/ngc-automation"
272-
OUT_IMAGE_TAG: "publish-${CI_COMMIT_SHORT_SHA}"
273307
rules:
274308
- if: $CI_COMMIT_TAG == null || $CI_COMMIT_TAG == ""
309+
needs:
310+
- job: update-nspect-staging
311+
variables:
312+
NGC_PUBLISHING_PROJECT_PATH: "${NGC_PUBLISHING_TEST_PROJECT_PATH}"

0 commit comments

Comments
 (0)