Skip to content

Commit 7e1beb7

Browse files
committed
[no-relnote] Update gitlab CI for new image names
We now release all images with vX.Y.Z and vX.Y.Z-packaging tags. This change updates the gitlab CI to allow for this. Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent d560888 commit 7e1beb7

File tree

3 files changed

+156
-572
lines changed

3 files changed

+156
-572
lines changed

.common-ci.yml

Lines changed: 1 addition & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,7 @@ variables:
2222
BUILD_MULTI_ARCH_IMAGES: "true"
2323

2424
stages:
25-
- trigger
26-
- image
27-
- lint
28-
- go-checks
29-
- go-build
30-
- unit-tests
31-
- package-build
32-
- image-build
33-
- test
25+
- pull
3426
- scan
3527
- release
3628
- sign
@@ -53,108 +45,6 @@ workflow:
5345
# We then add all the regular triggers
5446
- !reference [.pipeline-trigger-rules, rules]
5547

56-
# The main or manual job is used to filter out distributions or architectures that are not required on
57-
# every build.
58-
.main-or-manual:
59-
rules:
60-
- !reference [.pipeline-trigger-rules, rules]
61-
- if: $CI_PIPELINE_SOURCE == "schedule"
62-
when: manual
63-
64-
# The trigger-pipeline job adds a manualy triggered job to the pipeline on merge requests.
65-
trigger-pipeline:
66-
stage: trigger
67-
script:
68-
- echo "starting pipeline"
69-
rules:
70-
- !reference [.main-or-manual, rules]
71-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
72-
when: manual
73-
allow_failure: false
74-
- when: always
75-
76-
# Define the distribution targets
77-
.dist-centos7:
78-
rules:
79-
- !reference [.main-or-manual, rules]
80-
variables:
81-
DIST: centos7
82-
83-
.dist-centos8:
84-
variables:
85-
DIST: centos8
86-
87-
.dist-ubi8:
88-
rules:
89-
- !reference [.main-or-manual, rules]
90-
variables:
91-
DIST: ubi8
92-
93-
.dist-ubuntu18.04:
94-
variables:
95-
DIST: ubuntu18.04
96-
97-
.dist-ubuntu20.04:
98-
variables:
99-
DIST: ubuntu20.04
100-
101-
.dist-packaging:
102-
variables:
103-
DIST: packaging
104-
105-
# Define architecture targets
106-
.arch-aarch64:
107-
variables:
108-
ARCH: aarch64
109-
110-
.arch-amd64:
111-
variables:
112-
ARCH: amd64
113-
114-
.arch-arm64:
115-
variables:
116-
ARCH: arm64
117-
118-
.arch-ppc64le:
119-
rules:
120-
- !reference [.main-or-manual, rules]
121-
variables:
122-
ARCH: ppc64le
123-
124-
.arch-x86_64:
125-
variables:
126-
ARCH: x86_64
127-
128-
# Define the platform targets
129-
.platform-amd64:
130-
variables:
131-
PLATFORM: linux/amd64
132-
133-
.platform-arm64:
134-
variables:
135-
PLATFORM: linux/arm64
136-
137-
# Define test helpers
138-
.integration:
139-
stage: test
140-
variables:
141-
IMAGE_NAME: "${CI_REGISTRY_IMAGE}/container-toolkit"
142-
VERSION: "${CI_COMMIT_SHORT_SHA}"
143-
before_script:
144-
- apk add --no-cache make bash jq
145-
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
146-
- docker pull "${IMAGE_NAME}:${VERSION}-${DIST}"
147-
script:
148-
- make -f deployments/container/Makefile test-${DIST}
149-
150-
# Define the test targets
151-
test-packaging:
152-
extends:
153-
- .integration
154-
- .dist-packaging
155-
needs:
156-
- image-packaging
157-
15848
# Download the regctl binary for use in the release steps
15949
.regctl-setup:
16050
before_script:
@@ -164,84 +54,3 @@ test-packaging:
16454
- curl -sSLo bin/regctl https://github.com/regclient/regclient/releases/download/${REGCTL_VERSION}/regctl-linux-amd64
16555
- chmod a+x bin/regctl
16656
- export PATH=$(pwd)/bin:${PATH}
167-
168-
# .release forms the base of the deployment jobs which push images to the CI registry.
169-
# This is extended with the version to be deployed (e.g. the SHA or TAG) and the
170-
# target os.
171-
.release:
172-
stage: release
173-
variables:
174-
# Define the source image for the release
175-
IMAGE_NAME: "${CI_REGISTRY_IMAGE}/container-toolkit"
176-
VERSION: "${CI_COMMIT_SHORT_SHA}"
177-
# OUT_IMAGE_VERSION is overridden for external releases
178-
OUT_IMAGE_VERSION: "${CI_COMMIT_SHORT_SHA}"
179-
before_script:
180-
- !reference [.regctl-setup, before_script]
181-
# We ensure that the components of the output image are set:
182-
- 'echo Image Name: ${OUT_IMAGE_NAME} ; [[ -n "${OUT_IMAGE_NAME}" ]] || exit 1'
183-
- 'echo Version: ${OUT_IMAGE_VERSION} ; [[ -n "${OUT_IMAGE_VERSION}" ]] || exit 1'
184-
185-
- apk add --no-cache make bash
186-
script:
187-
# Log in to the "output" registry, tag the image and push the image
188-
- 'echo "Logging in to CI registry ${CI_REGISTRY}"'
189-
- regctl registry login "${CI_REGISTRY}" -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}"
190-
- '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || echo "Logging in to output registry ${OUT_REGISTRY}"'
191-
- '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"'
192-
193-
# Since OUT_IMAGE_NAME and OUT_IMAGE_VERSION are set, this will push the CI image to the
194-
# Target
195-
- make -f deployments/container/Makefile push-${DIST}
196-
197-
# Define a staging release step that pushes an image to an internal "staging" repository
198-
# This is triggered for all pipelines (i.e. not only tags) to test the pipeline steps
199-
# outside of the release process.
200-
.release:staging:
201-
extends:
202-
- .release
203-
variables:
204-
OUT_REGISTRY_USER: "${NGC_REGISTRY_USER}"
205-
OUT_REGISTRY_TOKEN: "${NGC_REGISTRY_TOKEN}"
206-
OUT_REGISTRY: "${NGC_REGISTRY}"
207-
OUT_IMAGE_NAME: "${NGC_REGISTRY_STAGING_IMAGE_NAME}"
208-
209-
# Define an external release step that pushes an image to an external repository.
210-
# This includes a devlopment image off main.
211-
.release:external:
212-
extends:
213-
- .release
214-
variables:
215-
FORCE_PUBLISH_IMAGES: "yes"
216-
rules:
217-
- if: $CI_COMMIT_TAG
218-
variables:
219-
OUT_IMAGE_VERSION: "${CI_COMMIT_TAG}"
220-
- if: $CI_COMMIT_BRANCH == $RELEASE_DEVEL_BRANCH
221-
variables:
222-
OUT_IMAGE_VERSION: "${DEVEL_RELEASE_IMAGE_VERSION}"
223-
224-
# Define the release jobs
225-
release:staging-ubi8:
226-
extends:
227-
- .release:staging
228-
- .dist-ubi8
229-
needs:
230-
- image-ubi8
231-
232-
release:staging-ubuntu20.04:
233-
extends:
234-
- .release:staging
235-
- .dist-ubuntu20.04
236-
needs:
237-
- test-toolkit-ubuntu20.04
238-
- test-containerd-ubuntu20.04
239-
- test-crio-ubuntu20.04
240-
- test-docker-ubuntu20.04
241-
242-
release:staging-packaging:
243-
extends:
244-
- .release:staging
245-
- .dist-packaging
246-
needs:
247-
- test-packaging

0 commit comments

Comments
 (0)