Skip to content

Commit fa1be50

Browse files
committed
Rework internal CI
Signed-off-by: Evan Lezar <[email protected]>
1 parent 5119527 commit fa1be50

File tree

8 files changed

+259
-549
lines changed

8 files changed

+259
-549
lines changed

.common-ci.yml

Lines changed: 22 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -13,196 +13,45 @@
1313
# limitations under the License.
1414

1515
default:
16-
image: docker:stable
16+
image: docker
1717
services:
18-
- name: docker:stable-dind
18+
- name: docker:dind
1919
command: ["--experimental"]
2020

2121
variables:
2222
GIT_SUBMODULE_STRATEGY: recursive
2323
BUILD_MULTI_ARCH_IMAGES: "true"
2424

2525
stages:
26-
- image
27-
- lint
28-
- go-checks
29-
- go-build
30-
- unit-tests
31-
- package-build
32-
- image-build
33-
- test
26+
- pull
3427
- scan
35-
- aws_kube_setup
36-
- integration_tests
37-
- e2e_tests
38-
- aws_kube_clean
3928
- release
29+
- sign
4030

41-
# Define the distribution targets
42-
.dist-ubuntu22.04:
43-
variables:
44-
DIST: ubuntu22.04
45-
46-
.dist-ubi9:
47-
variables:
48-
DIST: ubi9
49-
50-
# Define the platform targets
51-
.platform-amd64:
52-
variables:
53-
PLATFORM: linux/amd64
54-
55-
.platform-arm64:
56-
variables:
57-
PLATFORM: linux/arm64
58-
59-
# Define the sample targets
60-
.sample-vectoradd:
61-
variables:
62-
SAMPLE: vectorAdd
63-
LOWER_CASE_SAMPLE: vectoradd
64-
65-
.sample-nbody:
66-
variables:
67-
SAMPLE: nbody
68-
LOWER_CASE_SAMPLE: nbody
69-
PUSH_SAMPLE_ONLY_TAG: "true"
70-
71-
.sample-device-query:
72-
variables:
73-
SAMPLE: deviceQuery
74-
LOWER_CASE_SAMPLE: devicequery
75-
76-
.sample-simple-multi-gpu:
77-
variables:
78-
SAMPLE: simpleMultiGPU
79-
LOWER_CASE_SAMPLE: simplemultigpu
80-
81-
# Define the sample targets
82-
.sample-vulkan:
83-
variables:
84-
SAMPLE: vulkan
85-
LOWER_CASE_SAMPLE: vulkan
86-
87-
.sample-nvbandwidth:
88-
variables:
89-
SAMPLE: nvbandwidth
90-
LOWER_CASE_SAMPLE: nvbandwidth
91-
92-
# Make buildx available as a docker CLI plugin
93-
.buildx-setup:
94-
before_script:
95-
- export BUILDX_VERSION=v0.6.3
96-
- apk add --no-cache curl
97-
- mkdir -p ~/.docker/cli-plugins
98-
- curl -sSLo ~/.docker/cli-plugins/docker-buildx "https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-amd64"
99-
- chmod a+x ~/.docker/cli-plugins/docker-buildx
100-
101-
- docker buildx create --use --platform=linux/amd64,linux/arm64
102-
103-
- '[[ -n "${SKIP_QEMU_SETUP}" ]] || docker run --rm --privileged multiarch/qemu-user-static --reset -p yes'
31+
.pipeline-trigger-rules:
32+
rules:
33+
# We trigger the pipeline if started manually
34+
- if: $CI_PIPELINE_SOURCE == "web"
35+
# We trigger the pipeline on the main branch
36+
- if: $CI_COMMIT_BRANCH == "main"
37+
# We trigger the pipeline on the release- branches
38+
- if: $CI_COMMIT_BRANCH =~ /^release-.*$/
39+
# We trigger the pipeline on tags
40+
- if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != ""
41+
42+
workflow:
43+
rules:
44+
# We trigger the pipeline on a merge request
45+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
46+
# We then add all the regular triggers
47+
- !reference [.pipeline-trigger-rules, rules]
10448

10549
# Download the regctl binary for use in the release steps
10650
.regctl-setup:
10751
before_script:
108-
- export REGCTL_VERSION=v0.3.10
52+
- export REGCTL_VERSION=v0.4.5
10953
- apk add --no-cache curl
11054
- mkdir -p bin
11155
- curl -sSLo bin/regctl https://github.com/regclient/regclient/releases/download/${REGCTL_VERSION}/regctl-linux-amd64
11256
- chmod a+x bin/regctl
11357
- export PATH=$(pwd)/bin:${PATH}
114-
115-
# .release forms the base of the deployment jobs which push images to the CI registry.
116-
# This is extended with the version to be deployed (e.g. the SHA or TAG) and the
117-
# target os.
118-
.release:
119-
stage: release
120-
variables:
121-
# Define the source image for the release
122-
IMAGE_NAME: "${CI_REGISTRY_IMAGE}/cuda-samples"
123-
VERSION: "${CI_COMMIT_SHORT_SHA}"
124-
# OUT_IMAGE_VERSION is overridden for external releases
125-
OUT_IMAGE_VERSION: "${CI_COMMIT_SHORT_SHA}"
126-
before_script:
127-
- !reference [.regctl-setup, before_script]
128-
129-
# We ensure that the OUT_IMAGE_VERSION is set
130-
- 'echo Version: ${OUT_IMAGE_VERSION} ; [[ -n "${OUT_IMAGE_VERSION}" ]] || exit 1'
131-
132-
- apk add --no-cache make bash
133-
script:
134-
# Log in to the "output" registry, tag the image and push the image
135-
- 'echo "Logging in to CI registry ${CI_REGISTRY}"'
136-
- regctl registry login "${CI_REGISTRY}" -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}"
137-
- '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || echo "Logging in to output registry ${OUT_REGISTRY}"'
138-
- '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"'
139-
140-
# Since OUT_IMAGE_NAME and OUT_IMAGE_VERSION are set, this will push the CI image to the
141-
# Target
142-
- make -f deployments/container/Makefile push-${DIST}
143-
144-
# Define a staging release step that pushes an image to an internal "staging" repository
145-
# This is triggered for all pipelines (i.e. not only tags) to test the pipeline steps
146-
# outside of the release process.
147-
.release:staging:
148-
extends:
149-
- .release
150-
variables:
151-
OUT_REGISTRY_USER: "${CI_REGISTRY_USER}"
152-
OUT_REGISTRY_TOKEN: "${CI_REGISTRY_PASSWORD}"
153-
OUT_REGISTRY: "${CI_REGISTRY}"
154-
OUT_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/staging/cuda-samples"
155-
156-
# Define an external release step that pushes an image to an external repository.
157-
# This includes a devlopment image off main.
158-
.release:external:
159-
extends:
160-
- .release
161-
rules:
162-
- if: $CI_COMMIT_TAG
163-
variables:
164-
OUT_IMAGE_VERSION: "${CI_COMMIT_TAG}"
165-
- if: $CI_COMMIT_BRANCH == $RELEASE_DEVEL_BRANCH
166-
variables:
167-
OUT_IMAGE_VERSION: "${DEVEL_RELEASE_IMAGE_VERSION}"
168-
169-
# Define the release jobs
170-
release:staging-vectoradd-ubi9:
171-
extends:
172-
- .release:staging
173-
- .dist-ubi9
174-
- .sample-vectoradd
175-
needs:
176-
- image-vectoradd-ubi9
177-
178-
release:staging-vectoradd-ubuntu22.04:
179-
extends:
180-
- .release:staging
181-
- .dist-ubuntu22.04
182-
- .sample-vectoradd
183-
needs:
184-
- image-vectoradd-ubuntu22.04
185-
186-
release:staging-device-query-ubuntu22.04:
187-
extends:
188-
- .release:staging
189-
- .dist-ubuntu22.04
190-
- .sample-device-query
191-
needs:
192-
- image-device-query-ubuntu22.04
193-
194-
release:staging-vulkan:
195-
extends:
196-
- .release:staging
197-
- .dist-ubuntu22.04
198-
- .sample-vulkan
199-
needs:
200-
- image-vulkan-ubuntu22.04
201-
202-
release:staging-nvbandwidth:
203-
extends:
204-
- .release:staging
205-
- .dist-ubuntu22.04
206-
- .sample-nvbandwidth
207-
needs:
208-
- image-nvbandwidth-ubuntu22.04

.github/workflows/image.yaml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,13 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
dist:
36-
- ubuntu22.04
37-
- ubi9
3835
sample:
39-
- vectorAdd
36+
- devicequery
4037
- nbody
41-
- deviceQuery
4238
- nvbandwidth
43-
- simpleMultiGPU
39+
- simplemultigpu
40+
- vectoradd
4441
- vulkan
45-
exclude:
46-
- dist: ubi9
47-
sample: deviceQuery
48-
- dist: ubi9
49-
sample: nbody
50-
- dist: ubi9
51-
sample: nvbandwidth
52-
- dist: ubi9
53-
sample: simpleMultiGPU
54-
- dist: ubi9
55-
sample: vulkan
5642

5743
steps:
5844
- uses: actions/checkout@v4
@@ -80,5 +66,5 @@ jobs:
8066
PUSH_ON_BUILD: true
8167
BUILD_MULTI_ARCH_IMAGES: ${{ inputs.build_multi_arch_images }}
8268
run: |
83-
echo "Building ${{ matrix.sample }} on ${{ matrix.dist }}"
84-
SAMPLE=${{ matrix.sample }} make -f deployments/container/Makefile build-${{ matrix.dist }}
69+
echo "Building ${{ matrix.sample }}"
70+
make -f deployments/container/Makefile build-${{ matrix.sample }}

0 commit comments

Comments
 (0)