2022-11-08 16:45:34 +00:00
|
|
|
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
|
2021-07-01 14:16:33 +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.
|
|
|
|
default:
|
2022-06-16 11:44:14 +00:00
|
|
|
image: docker
|
2021-07-01 14:16:33 +00:00
|
|
|
services:
|
2022-06-16 11:44:14 +00:00
|
|
|
- name: docker:dind
|
2021-07-01 14:16:33 +00:00
|
|
|
command: ["--experimental"]
|
|
|
|
|
|
|
|
variables:
|
2021-10-13 12:04:41 +00:00
|
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
2021-10-12 09:15:19 +00:00
|
|
|
BUILDIMAGE: "${CI_REGISTRY_IMAGE}/build:${CI_COMMIT_SHORT_SHA}"
|
2022-02-01 13:17:47 +00:00
|
|
|
BUILD_MULTI_ARCH_IMAGES: "true"
|
2021-10-12 09:15:19 +00:00
|
|
|
|
|
|
|
stages:
|
|
|
|
- image
|
|
|
|
- lint
|
|
|
|
- go-checks
|
|
|
|
- go-build
|
|
|
|
- unit-tests
|
2021-10-13 12:04:41 +00:00
|
|
|
- package-build
|
|
|
|
- image-build
|
|
|
|
- test
|
2021-10-12 09:15:19 +00:00
|
|
|
- scan
|
|
|
|
- release
|
2021-07-01 14:16:33 +00:00
|
|
|
|
2022-10-07 13:42:17 +00:00
|
|
|
.main-or-manual:
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_BRANCH == "main"
|
2022-10-10 12:34:51 +00:00
|
|
|
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != ""
|
2022-10-07 13:42:17 +00:00
|
|
|
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
|
|
when: manual
|
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
# Define the distribution targets
|
2021-11-25 19:02:31 +00:00
|
|
|
.dist-amazonlinux2:
|
2022-10-07 13:42:17 +00:00
|
|
|
rules:
|
|
|
|
- !reference [.main-or-manual, rules]
|
2021-11-25 19:02:31 +00:00
|
|
|
variables:
|
|
|
|
DIST: amazonlinux2
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: rpm
|
2021-11-25 19:02:31 +00:00
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
.dist-centos7:
|
2022-10-07 13:42:17 +00:00
|
|
|
rules:
|
|
|
|
- !reference [.main-or-manual, rules]
|
2021-10-13 12:04:41 +00:00
|
|
|
variables:
|
|
|
|
DIST: centos7
|
2022-03-16 17:41:21 +00:00
|
|
|
CVE_UPDATES: "cyrus-sasl-lib"
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: rpm
|
2021-10-13 12:04:41 +00:00
|
|
|
|
|
|
|
.dist-centos8:
|
|
|
|
variables:
|
|
|
|
DIST: centos8
|
2022-03-16 17:41:21 +00:00
|
|
|
CVE_UPDATES: "cyrus-sasl-lib"
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: rpm
|
2021-10-13 12:04:41 +00:00
|
|
|
|
2021-11-25 19:02:31 +00:00
|
|
|
.dist-debian10:
|
2022-10-07 13:42:17 +00:00
|
|
|
rules:
|
|
|
|
- !reference [.main-or-manual, rules]
|
2021-11-25 19:02:31 +00:00
|
|
|
variables:
|
|
|
|
DIST: debian10
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: debian
|
2021-11-25 19:02:31 +00:00
|
|
|
|
|
|
|
.dist-opensuse-leap15.1:
|
2022-10-07 13:42:17 +00:00
|
|
|
rules:
|
|
|
|
- !reference [.main-or-manual, rules]
|
2021-11-25 19:02:31 +00:00
|
|
|
variables:
|
|
|
|
DIST: opensuse-leap15.1
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: rpm
|
2021-11-25 19:02:31 +00:00
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
.dist-ubi8:
|
2022-10-07 13:42:17 +00:00
|
|
|
rules:
|
|
|
|
- !reference [.main-or-manual, rules]
|
2021-10-13 12:04:41 +00:00
|
|
|
variables:
|
|
|
|
DIST: ubi8
|
2022-03-16 17:41:21 +00:00
|
|
|
CVE_UPDATES: "cyrus-sasl-lib"
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: rpm
|
2021-10-13 12:04:41 +00:00
|
|
|
|
2021-11-25 19:02:31 +00:00
|
|
|
.dist-ubuntu16.04:
|
2022-10-07 13:42:17 +00:00
|
|
|
rules:
|
|
|
|
- !reference [.main-or-manual, rules]
|
2021-11-25 19:02:31 +00:00
|
|
|
variables:
|
|
|
|
DIST: ubuntu16.04
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: debian
|
2021-11-25 19:02:31 +00:00
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
.dist-ubuntu18.04:
|
|
|
|
variables:
|
|
|
|
DIST: ubuntu18.04
|
2022-03-16 17:41:21 +00:00
|
|
|
CVE_UPDATES: "libsasl2-2 libsasl2-modules-db"
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: debian
|
2021-10-13 12:04:41 +00:00
|
|
|
|
2022-03-18 11:50:24 +00:00
|
|
|
.dist-ubuntu20.04:
|
2022-10-07 13:42:17 +00:00
|
|
|
rules:
|
|
|
|
- !reference [.main-or-manual, rules]
|
2022-03-18 11:50:24 +00:00
|
|
|
variables:
|
|
|
|
DIST: ubuntu20.04
|
|
|
|
CVE_UPDATES: "libsasl2-2 libsasl2-modules-db"
|
2022-11-08 16:45:34 +00:00
|
|
|
PACKAGE_REPO_TYPE: debian
|
2022-03-18 11:50:24 +00:00
|
|
|
|
2021-11-25 19:02:31 +00:00
|
|
|
.dist-packaging:
|
|
|
|
variables:
|
|
|
|
DIST: packaging
|
|
|
|
|
|
|
|
# Define architecture targets
|
2021-10-13 12:04:41 +00:00
|
|
|
.arch-aarch64:
|
|
|
|
variables:
|
|
|
|
ARCH: aarch64
|
|
|
|
|
|
|
|
.arch-amd64:
|
|
|
|
variables:
|
|
|
|
ARCH: amd64
|
|
|
|
|
|
|
|
.arch-arm64:
|
|
|
|
variables:
|
|
|
|
ARCH: arm64
|
|
|
|
|
|
|
|
.arch-ppc64le:
|
2022-10-07 13:42:17 +00:00
|
|
|
rules:
|
|
|
|
- !reference [.main-or-manual, rules]
|
2021-10-13 12:04:41 +00:00
|
|
|
variables:
|
|
|
|
ARCH: ppc64le
|
|
|
|
|
|
|
|
.arch-x86_64:
|
|
|
|
variables:
|
|
|
|
ARCH: x86_64
|
|
|
|
|
2022-02-18 12:50:40 +00:00
|
|
|
# Define the platform targets
|
|
|
|
.platform-amd64:
|
|
|
|
variables:
|
|
|
|
PLATFORM: linux/amd64
|
|
|
|
|
|
|
|
.platform-arm64:
|
|
|
|
variables:
|
|
|
|
PLATFORM: linux/arm64
|
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
# Define test helpers
|
|
|
|
.integration:
|
|
|
|
stage: test
|
|
|
|
variables:
|
|
|
|
IMAGE_NAME: "${CI_REGISTRY_IMAGE}/container-toolkit"
|
|
|
|
VERSION: "${CI_COMMIT_SHORT_SHA}"
|
|
|
|
before_script:
|
|
|
|
- apk add --no-cache make bash jq
|
|
|
|
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
|
|
|
|
- docker pull "${IMAGE_NAME}:${VERSION}-${DIST}"
|
|
|
|
script:
|
|
|
|
- make -f build/container/Makefile test-${DIST}
|
|
|
|
|
|
|
|
# Define the test targets
|
2021-11-25 19:43:43 +00:00
|
|
|
test-packaging:
|
|
|
|
extends:
|
|
|
|
- .integration
|
|
|
|
- .dist-packaging
|
|
|
|
needs:
|
|
|
|
- image-packaging
|
|
|
|
|
2022-02-01 13:17:47 +00:00
|
|
|
# Download the regctl binary for use in the release steps
|
|
|
|
.regctl-setup:
|
|
|
|
before_script:
|
2022-11-10 13:43:17 +00:00
|
|
|
- export REGCTL_VERSION=v0.4.5
|
2022-02-01 13:17:47 +00:00
|
|
|
- apk add --no-cache curl
|
|
|
|
- mkdir -p bin
|
|
|
|
- curl -sSLo bin/regctl https://github.com/regclient/regclient/releases/download/${REGCTL_VERSION}/regctl-linux-amd64
|
|
|
|
- chmod a+x bin/regctl
|
|
|
|
- export PATH=$(pwd)/bin:${PATH}
|
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
# .release forms the base of the deployment jobs which push images to the CI registry.
|
|
|
|
# This is extended with the version to be deployed (e.g. the SHA or TAG) and the
|
|
|
|
# target os.
|
|
|
|
.release:
|
2022-02-01 13:17:47 +00:00
|
|
|
stage: release
|
2021-10-13 12:04:41 +00:00
|
|
|
variables:
|
|
|
|
# Define the source image for the release
|
|
|
|
IMAGE_NAME: "${CI_REGISTRY_IMAGE}/container-toolkit"
|
|
|
|
VERSION: "${CI_COMMIT_SHORT_SHA}"
|
|
|
|
# OUT_IMAGE_VERSION is overridden for external releases
|
|
|
|
OUT_IMAGE_VERSION: "${CI_COMMIT_SHORT_SHA}"
|
|
|
|
before_script:
|
2022-02-01 13:17:47 +00:00
|
|
|
- !reference [.regctl-setup, before_script]
|
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
# We ensure that the OUT_IMAGE_VERSION is set
|
|
|
|
- 'echo Version: ${OUT_IMAGE_VERSION} ; [[ -n "${OUT_IMAGE_VERSION}" ]] || exit 1'
|
|
|
|
|
|
|
|
# In the case where we are deploying a different version to the CI_COMMIT_SHA, we
|
|
|
|
# need to tag the image.
|
|
|
|
# Note: a leading 'v' is stripped from the version if present
|
|
|
|
- apk add --no-cache make bash
|
|
|
|
script:
|
|
|
|
# Log in to the "output" registry, tag the image and push the image
|
2022-02-01 13:17:47 +00:00
|
|
|
- 'echo "Logging in to CI registry ${CI_REGISTRY}"'
|
|
|
|
- regctl registry login "${CI_REGISTRY}" -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}"
|
|
|
|
- '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || echo "Logging in to output registry ${OUT_REGISTRY}"'
|
|
|
|
- '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"'
|
|
|
|
|
|
|
|
# Since OUT_IMAGE_NAME and OUT_IMAGE_VERSION are set, this will push the CI image to the
|
|
|
|
# Target
|
|
|
|
- make -f build/container/Makefile push-${DIST}
|
2021-10-13 12:04:41 +00:00
|
|
|
|
|
|
|
# Define a staging release step that pushes an image to an internal "staging" repository
|
|
|
|
# This is triggered for all pipelines (i.e. not only tags) to test the pipeline steps
|
|
|
|
# outside of the release process.
|
|
|
|
.release:staging:
|
|
|
|
extends:
|
|
|
|
- .release
|
|
|
|
variables:
|
|
|
|
OUT_REGISTRY_USER: "${CI_REGISTRY_USER}"
|
|
|
|
OUT_REGISTRY_TOKEN: "${CI_REGISTRY_PASSWORD}"
|
|
|
|
OUT_REGISTRY: "${CI_REGISTRY}"
|
|
|
|
OUT_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/staging/container-toolkit"
|
|
|
|
|
|
|
|
# Define an external release step that pushes an image to an external repository.
|
2022-04-12 12:51:49 +00:00
|
|
|
# This includes a devlopment image off main.
|
2021-10-13 12:04:41 +00:00
|
|
|
.release:external:
|
|
|
|
extends:
|
|
|
|
- .release
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
variables:
|
|
|
|
OUT_IMAGE_VERSION: "${CI_COMMIT_TAG}"
|
|
|
|
- if: $CI_COMMIT_BRANCH == $RELEASE_DEVEL_BRANCH
|
|
|
|
variables:
|
|
|
|
OUT_IMAGE_VERSION: "${DEVEL_RELEASE_IMAGE_VERSION}"
|
|
|
|
|
|
|
|
# Define the release jobs
|
|
|
|
release:staging-centos7:
|
|
|
|
extends:
|
|
|
|
- .release:staging
|
|
|
|
- .dist-centos7
|
|
|
|
needs:
|
|
|
|
- image-centos7
|
|
|
|
|
|
|
|
release:staging-ubi8:
|
|
|
|
extends:
|
|
|
|
- .release:staging
|
|
|
|
- .dist-ubi8
|
|
|
|
needs:
|
|
|
|
- image-ubi8
|
|
|
|
|
|
|
|
release:staging-ubuntu18.04:
|
|
|
|
extends:
|
|
|
|
- .release:staging
|
|
|
|
- .dist-ubuntu18.04
|
|
|
|
needs:
|
|
|
|
- test-toolkit-ubuntu18.04
|
|
|
|
- test-containerd-ubuntu18.04
|
|
|
|
- test-crio-ubuntu18.04
|
|
|
|
- test-docker-ubuntu18.04
|
2021-11-25 19:02:31 +00:00
|
|
|
|
2022-03-18 11:50:24 +00:00
|
|
|
release:staging-ubuntu20.04:
|
|
|
|
extends:
|
|
|
|
- .release:staging
|
|
|
|
- .dist-ubuntu20.04
|
|
|
|
needs:
|
2022-10-07 13:47:12 +00:00
|
|
|
- image-ubuntu20.04
|
2022-03-18 11:50:24 +00:00
|
|
|
|
2021-11-25 19:02:31 +00:00
|
|
|
release:staging-packaging:
|
|
|
|
extends:
|
|
|
|
- .release:staging
|
|
|
|
- .dist-packaging
|
|
|
|
needs:
|
2021-11-25 19:43:43 +00:00
|
|
|
- test-packaging
|