2022-11-08 16:45:34 +00:00
|
|
|
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
|
2021-10-15 12:03:37 +00:00
|
|
|
#
|
|
|
|
# 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"
|
2022-04-12 12:51:49 +00:00
|
|
|
# Release "devel"-tagged images off the main branch
|
|
|
|
RELEASE_DEVEL_BRANCH: "main"
|
2021-10-27 11:25:12 +00:00
|
|
|
DEVEL_RELEASE_IMAGE_VERSION: "devel"
|
2021-10-15 12:03:37 +00:00
|
|
|
# On the multi-arch builder we don't need the qemu setup.
|
|
|
|
SKIP_QEMU_SETUP: "1"
|
2021-11-26 14:49:30 +00:00
|
|
|
# Define the public staging registry
|
2024-05-29 14:51:20 +00:00
|
|
|
STAGING_REGISTRY: ghcr.io/nvidia
|
2021-11-26 14:49:30 +00:00
|
|
|
STAGING_VERSION: ${CI_COMMIT_SHORT_SHA}
|
2022-11-08 16:45:34 +00:00
|
|
|
ARTIFACTORY_REPO_BASE: "https://urm.nvidia.com/artifactory/sw-gpu-cloudnative"
|
2023-03-01 08:44:27 +00:00
|
|
|
KITMAKER_RELEASE_FOLDER: "kitmaker"
|
2023-05-08 13:41:02 +00:00
|
|
|
PACKAGE_ARCHIVE_RELEASE_FOLDER: "releases"
|
2021-11-26 14:49:30 +00:00
|
|
|
|
|
|
|
.image-pull:
|
|
|
|
stage: image-build
|
|
|
|
variables:
|
|
|
|
IN_REGISTRY: "${STAGING_REGISTRY}"
|
|
|
|
IN_IMAGE_NAME: container-toolkit
|
|
|
|
IN_VERSION: "${STAGING_VERSION}"
|
|
|
|
OUT_REGISTRY_USER: "${CI_REGISTRY_USER}"
|
|
|
|
OUT_REGISTRY_TOKEN: "${CI_REGISTRY_PASSWORD}"
|
|
|
|
OUT_REGISTRY: "${CI_REGISTRY}"
|
|
|
|
OUT_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/container-toolkit"
|
2022-02-22 08:18:01 +00:00
|
|
|
PUSH_MULTIPLE_TAGS: "false"
|
2021-12-02 16:52:44 +00:00
|
|
|
# We delay the job start to allow the public pipeline to generate the required images.
|
2022-10-10 11:35:02 +00:00
|
|
|
rules:
|
|
|
|
- when: delayed
|
|
|
|
start_in: 30 minutes
|
2021-12-02 16:52:44 +00:00
|
|
|
timeout: 30 minutes
|
|
|
|
retry:
|
|
|
|
max: 2
|
|
|
|
when:
|
|
|
|
- job_execution_timeout
|
|
|
|
- stuck_or_timeout_failure
|
|
|
|
before_script:
|
2022-02-01 13:17:47 +00:00
|
|
|
- !reference [.regctl-setup, before_script]
|
|
|
|
- apk add --no-cache make bash
|
2021-12-02 16:52:44 +00:00
|
|
|
- >
|
2022-02-01 13:17:47 +00:00
|
|
|
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 )
|
2021-11-26 14:49:30 +00:00
|
|
|
script:
|
2022-02-01 13:17:47 +00:00
|
|
|
- regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"
|
2024-03-19 12:00:24 +00:00
|
|
|
- make -f deployments/container/Makefile IMAGE=${IN_REGISTRY}/${IN_IMAGE_NAME}:${IN_VERSION}-${DIST} OUT_IMAGE=${OUT_IMAGE_NAME}:${CI_COMMIT_SHORT_SHA}-${DIST} push-${DIST}
|
2021-11-26 14:49:30 +00:00
|
|
|
|
|
|
|
image-ubi8:
|
|
|
|
extends:
|
|
|
|
- .dist-ubi8
|
2022-10-10 12:34:51 +00:00
|
|
|
- .image-pull
|
2021-11-26 14:49:30 +00:00
|
|
|
|
2022-03-18 11:50:24 +00:00
|
|
|
image-ubuntu20.04:
|
|
|
|
extends:
|
|
|
|
- .dist-ubuntu20.04
|
2022-10-10 12:34:51 +00:00
|
|
|
- .image-pull
|
2022-03-18 11:50:24 +00:00
|
|
|
|
2021-11-26 14:49:30 +00:00
|
|
|
# The DIST=packaging target creates an image containing all built packages
|
|
|
|
image-packaging:
|
|
|
|
extends:
|
|
|
|
- .dist-packaging
|
2022-10-10 12:34:51 +00:00
|
|
|
- .image-pull
|
2021-10-15 12:03:37 +00:00
|
|
|
|
|
|
|
# We skip the integration tests for the internal CI:
|
|
|
|
.integration:
|
|
|
|
stage: test
|
|
|
|
before_script:
|
|
|
|
- echo "Skipped in internal CI"
|
|
|
|
script:
|
|
|
|
- echo "Skipped in internal CI"
|
|
|
|
|
|
|
|
# The .scan step forms the base of the image scan operation performed before releasing
|
|
|
|
# images.
|
|
|
|
.scan:
|
|
|
|
stage: scan
|
2021-10-28 00:26:46 +00:00
|
|
|
image: "${PULSE_IMAGE}"
|
2021-10-15 12:03:37 +00:00
|
|
|
variables:
|
|
|
|
IMAGE: "${CI_REGISTRY_IMAGE}/container-toolkit:${CI_COMMIT_SHORT_SHA}-${DIST}"
|
2023-02-02 11:03:34 +00:00
|
|
|
IMAGE_ARCHIVE: "container-toolkit-${DIST}-${ARCH}-${CI_JOB_ID}.tar"
|
2022-10-10 11:35:02 +00:00
|
|
|
rules:
|
2022-10-10 12:34:51 +00:00
|
|
|
- if: $SKIP_SCANS != "yes"
|
|
|
|
- when: manual
|
2021-10-15 12:03:37 +00:00
|
|
|
before_script:
|
|
|
|
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
|
|
|
|
# TODO: We should specify the architecture here and scan all architectures
|
2022-02-18 12:50:40 +00:00
|
|
|
- docker pull --platform="${PLATFORM}" "${IMAGE}"
|
2021-10-28 00:26:46 +00:00
|
|
|
- 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
|
2021-10-15 12:03:37 +00:00
|
|
|
script:
|
2021-11-16 16:38:43 +00:00
|
|
|
- pulse-cli -n $NSPECT_ID --ssa $SSA_TOKEN scan -i $IMAGE_ARCHIVE -p $CONTAINER_POLICY -o
|
2023-05-10 08:52:18 +00:00
|
|
|
- rm -f "${IMAGE_ARCHIVE}"
|
2021-10-28 00:26:46 +00:00
|
|
|
artifacts:
|
|
|
|
when: always
|
|
|
|
expire_in: 1 week
|
|
|
|
paths:
|
|
|
|
- pulse-cli.log
|
|
|
|
- licenses.json
|
|
|
|
- sbom.json
|
|
|
|
- vulns.json
|
|
|
|
- policy_evaluation.json
|
2021-10-15 12:03:37 +00:00
|
|
|
|
|
|
|
# Define the scan targets
|
2022-03-18 11:50:24 +00:00
|
|
|
scan-ubuntu20.04-amd64:
|
|
|
|
extends:
|
|
|
|
- .dist-ubuntu20.04
|
|
|
|
- .platform-amd64
|
2022-10-10 12:34:51 +00:00
|
|
|
- .scan
|
2022-03-18 11:50:24 +00:00
|
|
|
needs:
|
|
|
|
- image-ubuntu20.04
|
|
|
|
|
|
|
|
scan-ubuntu20.04-arm64:
|
|
|
|
extends:
|
|
|
|
- .dist-ubuntu20.04
|
|
|
|
- .platform-arm64
|
2022-10-10 12:34:51 +00:00
|
|
|
- .scan
|
2022-03-18 11:50:24 +00:00
|
|
|
needs:
|
|
|
|
- image-ubuntu20.04
|
|
|
|
- scan-ubuntu20.04-amd64
|
|
|
|
|
2022-02-18 12:50:40 +00:00
|
|
|
scan-ubi8-amd64:
|
|
|
|
extends:
|
|
|
|
- .dist-ubi8
|
|
|
|
- .platform-amd64
|
2022-10-10 12:34:51 +00:00
|
|
|
- .scan
|
2022-02-18 12:50:40 +00:00
|
|
|
needs:
|
|
|
|
- image-ubi8
|
|
|
|
|
|
|
|
scan-ubi8-arm64:
|
2021-10-15 12:03:37 +00:00
|
|
|
extends:
|
|
|
|
- .dist-ubi8
|
2022-02-18 12:50:40 +00:00
|
|
|
- .platform-arm64
|
2022-10-10 12:34:51 +00:00
|
|
|
- .scan
|
2021-10-15 12:03:37 +00:00
|
|
|
needs:
|
|
|
|
- image-ubi8
|
2022-02-18 12:50:40 +00:00
|
|
|
- scan-ubi8-amd64
|
2021-10-15 12:03:37 +00:00
|
|
|
|
2023-05-05 11:56:05 +00:00
|
|
|
scan-packaging:
|
|
|
|
extends:
|
|
|
|
- .dist-packaging
|
|
|
|
- .scan
|
|
|
|
needs:
|
|
|
|
- image-packaging
|
|
|
|
|
2021-10-15 12:03:37 +00:00
|
|
|
# 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}"
|
|
|
|
|
2022-11-08 16:45:34 +00:00
|
|
|
.release:packages:
|
|
|
|
stage: release
|
|
|
|
needs:
|
|
|
|
- image-packaging
|
|
|
|
variables:
|
2022-11-10 14:52:27 +00:00
|
|
|
VERSION: "${CI_COMMIT_SHORT_SHA}"
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REGISTRY: "${CI_REGISTRY}"
|
|
|
|
PACKAGE_REGISTRY_USER: "${CI_REGISTRY_USER}"
|
|
|
|
PACKAGE_REGISTRY_TOKEN: "${CI_REGISTRY_PASSWORD}"
|
|
|
|
PACKAGE_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/container-toolkit"
|
|
|
|
PACKAGE_IMAGE_TAG: "${CI_COMMIT_SHORT_SHA}-packaging"
|
2022-11-10 15:00:03 +00:00
|
|
|
KITMAKER_ARTIFACTORY_REPO: "${ARTIFACTORY_REPO_BASE}-generic-local/${KITMAKER_RELEASE_FOLDER}"
|
2023-05-10 08:52:18 +00:00
|
|
|
ARTIFACTS_DIR: "${CI_PROJECT_DIR}/artifacts"
|
2022-11-08 16:45:34 +00:00
|
|
|
script:
|
|
|
|
- !reference [.regctl-setup, before_script]
|
2023-01-23 13:53:19 +00:00
|
|
|
- apk add --no-cache bash git
|
2022-11-08 16:45:34 +00:00
|
|
|
- regctl registry login "${PACKAGE_REGISTRY}" -u "${PACKAGE_REGISTRY_USER}" -p "${PACKAGE_REGISTRY_TOKEN}"
|
2023-01-23 13:53:19 +00:00
|
|
|
- ./scripts/extract-packages.sh "${PACKAGE_IMAGE_NAME}:${PACKAGE_IMAGE_TAG}"
|
|
|
|
- ./scripts/release-kitmaker-artifactory.sh "${KITMAKER_ARTIFACTORY_REPO}"
|
2023-05-10 08:52:18 +00:00
|
|
|
- rm -rf ${ARTIFACTS_DIR}
|
2023-01-23 13:53:19 +00:00
|
|
|
|
|
|
|
# Define the package release targets
|
|
|
|
release:packages:kitmaker:
|
|
|
|
extends:
|
|
|
|
- .release:packages
|
2022-11-08 16:45:34 +00:00
|
|
|
|
2023-05-08 13:41:02 +00:00
|
|
|
release:archive:
|
|
|
|
extends:
|
|
|
|
- .release:external
|
|
|
|
needs:
|
|
|
|
- image-packaging
|
|
|
|
variables:
|
|
|
|
VERSION: "${CI_COMMIT_SHORT_SHA}"
|
|
|
|
PACKAGE_REGISTRY: "${CI_REGISTRY}"
|
|
|
|
PACKAGE_REGISTRY_USER: "${CI_REGISTRY_USER}"
|
|
|
|
PACKAGE_REGISTRY_TOKEN: "${CI_REGISTRY_PASSWORD}"
|
|
|
|
PACKAGE_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/container-toolkit"
|
|
|
|
PACKAGE_IMAGE_TAG: "${CI_COMMIT_SHORT_SHA}-packaging"
|
|
|
|
PACKAGE_ARCHIVE_ARTIFACTORY_REPO: "${ARTIFACTORY_REPO_BASE}-generic-local/${PACKAGE_ARCHIVE_RELEASE_FOLDER}"
|
|
|
|
script:
|
|
|
|
- apk add --no-cache bash git
|
|
|
|
- ./scripts/archive-packages.sh "${PACKAGE_ARCHIVE_ARTIFACTORY_REPO}"
|
|
|
|
|
2023-02-27 10:49:47 +00:00
|
|
|
release:staging-ubuntu20.04:
|
2021-11-26 14:49:30 +00:00
|
|
|
extends:
|
|
|
|
- .release:staging
|
2023-02-27 10:49:47 +00:00
|
|
|
- .dist-ubuntu20.04
|
2021-11-26 14:49:30 +00:00
|
|
|
needs:
|
2023-02-27 10:49:47 +00:00
|
|
|
- image-ubuntu20.04
|
2021-11-26 14:49:30 +00:00
|
|
|
|
2021-10-15 12:03:37 +00:00
|
|
|
# Define the external release targets
|
|
|
|
# Release to NGC
|
2022-03-18 11:50:24 +00:00
|
|
|
release:ngc-ubuntu20.04:
|
|
|
|
extends:
|
|
|
|
- .dist-ubuntu20.04
|
2022-10-10 12:34:51 +00:00
|
|
|
- .release:ngc
|
2022-03-18 11:50:24 +00:00
|
|
|
|
2021-10-15 12:03:37 +00:00
|
|
|
release:ngc-ubi8:
|
|
|
|
extends:
|
|
|
|
- .dist-ubi8
|
2022-10-10 12:34:51 +00:00
|
|
|
- .release:ngc
|
2023-05-05 11:56:05 +00:00
|
|
|
|
|
|
|
release:ngc-packaging:
|
|
|
|
extends:
|
|
|
|
- .dist-packaging
|
|
|
|
- .release:ngc
|
2024-05-29 15:29:07 +00:00
|
|
|
|
|
|
|
# Define the external image signing steps for NGC
|
|
|
|
# Download the ngc cli binary for use in the sign steps
|
|
|
|
.ngccli-setup:
|
|
|
|
before_script:
|
|
|
|
- apt-get update && apt-get install -y curl unzip jq
|
|
|
|
- |
|
|
|
|
if [ -z "${NGCCLI_VERSION}" ]; then
|
|
|
|
NGC_VERSION_URL="https://api.ngc.nvidia.com/v2/resources/nvidia/ngc-apps/ngc_cli/versions"
|
|
|
|
# Extract the latest version from the JSON data using jq
|
|
|
|
export NGCCLI_VERSION=$(curl -s $NGC_VERSION_URL | jq -r '.recipe.latestVersionIdStr')
|
|
|
|
fi
|
|
|
|
echo "NGCCLI_VERSION ${NGCCLI_VERSION}"
|
|
|
|
- curl -sSLo ngccli_linux.zip https://api.ngc.nvidia.com/v2/resources/nvidia/ngc-apps/ngc_cli/versions/${NGCCLI_VERSION}/files/ngccli_linux.zip
|
|
|
|
- unzip ngccli_linux.zip
|
|
|
|
- chmod u+x ngc-cli/ngc
|
|
|
|
|
|
|
|
# .sign forms the base of the deployment jobs which signs images in the CI registry.
|
|
|
|
# This is extended with the image name and version to be deployed.
|
|
|
|
.sign:ngc:
|
|
|
|
image: ubuntu:latest
|
|
|
|
stage: sign
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
variables:
|
|
|
|
NGC_CLI_API_KEY: "${NGC_REGISTRY_TOKEN}"
|
|
|
|
IMAGE_NAME: "${NGC_REGISTRY_IMAGE}"
|
|
|
|
IMAGE_TAG: "${CI_COMMIT_TAG}-${DIST}"
|
|
|
|
retry:
|
|
|
|
max: 2
|
|
|
|
before_script:
|
|
|
|
- !reference [.ngccli-setup, before_script]
|
|
|
|
# We ensure that the IMAGE_NAME and IMAGE_TAG is set
|
|
|
|
- 'echo Image Name: ${IMAGE_NAME} && [[ -n "${IMAGE_NAME}" ]] || exit 1'
|
|
|
|
- 'echo Image Tag: ${IMAGE_TAG} && [[ -n "${IMAGE_TAG}" ]] || exit 1'
|
|
|
|
script:
|
|
|
|
- 'echo "Signing the image ${IMAGE_NAME}:${IMAGE_TAG}"'
|
|
|
|
- ngc-cli/ngc registry image publish --source ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:${IMAGE_TAG} --public --discoverable --allow-guest --sign --org nvidia
|
|
|
|
|
|
|
|
sign:ngc-ubuntu20.04:
|
|
|
|
extends:
|
|
|
|
- .dist-ubuntu20.04
|
|
|
|
- .sign:ngc
|
|
|
|
needs:
|
|
|
|
- release:ngc-ubuntu20.04
|
|
|
|
|
|
|
|
sign:ngc-ubi8:
|
|
|
|
extends:
|
|
|
|
- .dist-ubi8
|
|
|
|
- .sign:ngc
|
|
|
|
needs:
|
|
|
|
- release:ngc-ubi8
|
|
|
|
|
|
|
|
sign:ngc-packaging:
|
|
|
|
extends:
|
|
|
|
- .dist-packaging
|
|
|
|
- .sign:ngc
|
|
|
|
needs:
|
|
|
|
- release:ngc-packaging
|