|
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | 15 | default: |
16 | | - image: docker:stable |
| 16 | + image: docker |
17 | 17 | services: |
18 | | - - name: docker:stable-dind |
| 18 | + - name: docker:dind |
19 | 19 | command: ["--experimental"] |
20 | 20 |
|
21 | 21 | variables: |
22 | 22 | GIT_SUBMODULE_STRATEGY: recursive |
23 | 23 | BUILD_MULTI_ARCH_IMAGES: "true" |
24 | 24 |
|
25 | 25 | stages: |
26 | | - - image |
27 | | - - lint |
28 | | - - go-checks |
29 | | - - go-build |
30 | | - - unit-tests |
31 | | - - package-build |
32 | | - - image-build |
33 | | - - test |
| 26 | + - pull |
34 | 27 | - scan |
35 | | - - aws_kube_setup |
36 | | - - integration_tests |
37 | | - - e2e_tests |
38 | | - - aws_kube_clean |
39 | 28 | - release |
| 29 | + - sign |
40 | 30 |
|
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 | | - PUSH_SAMPLE_ONLY_TAG: "false" |
65 | | - |
66 | | -.sample-nbody: |
67 | | - variables: |
68 | | - SAMPLE: nbody |
69 | | - LOWER_CASE_SAMPLE: nbody |
70 | | - PUSH_SAMPLE_ONLY_TAG: "true" |
71 | | - |
72 | | -.sample-device-query: |
73 | | - variables: |
74 | | - SAMPLE: deviceQuery |
75 | | - LOWER_CASE_SAMPLE: devicequery |
76 | | - PUSH_SAMPLE_ONLY_TAG: "true" |
77 | | - |
78 | | -.sample-simple-multi-gpu: |
79 | | - variables: |
80 | | - SAMPLE: simpleMultiGPU |
81 | | - LOWER_CASE_SAMPLE: simplemultigpu |
82 | | - PUSH_SAMPLE_ONLY_TAG: "true" |
83 | | - |
84 | | -# Define the sample targets |
85 | | -.sample-vulkan: |
86 | | - variables: |
87 | | - SAMPLE: vulkan |
88 | | - LOWER_CASE_SAMPLE: vulkan |
89 | | - PUSH_SAMPLE_ONLY_TAG: "true" |
90 | | - |
91 | | -.sample-nvbandwidth: |
92 | | - variables: |
93 | | - SAMPLE: nvbandwidth |
94 | | - LOWER_CASE_SAMPLE: nvbandwidth |
95 | | - PUSH_SAMPLE_ONLY_TAG: "true" |
96 | | - |
97 | | -# Make buildx available as a docker CLI plugin |
98 | | -.buildx-setup: |
99 | | - before_script: |
100 | | - - export BUILDX_VERSION=v0.6.3 |
101 | | - - apk add --no-cache curl |
102 | | - - mkdir -p ~/.docker/cli-plugins |
103 | | - - curl -sSLo ~/.docker/cli-plugins/docker-buildx "https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-amd64" |
104 | | - - chmod a+x ~/.docker/cli-plugins/docker-buildx |
105 | | - |
106 | | - - docker buildx create --use --platform=linux/amd64,linux/arm64 |
107 | | - |
108 | | - - '[[ -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] |
109 | 48 |
|
110 | 49 | # Download the regctl binary for use in the release steps |
111 | 50 | .regctl-setup: |
112 | 51 | before_script: |
113 | | - - export REGCTL_VERSION=v0.3.10 |
| 52 | + - export REGCTL_VERSION=v0.9.0 |
114 | 53 | - apk add --no-cache curl |
115 | 54 | - mkdir -p bin |
116 | 55 | - curl -sSLo bin/regctl https://github.com/regclient/regclient/releases/download/${REGCTL_VERSION}/regctl-linux-amd64 |
117 | 56 | - chmod a+x bin/regctl |
118 | 57 | - export PATH=$(pwd)/bin:${PATH} |
119 | | - |
120 | | -# .release forms the base of the deployment jobs which push images to the CI registry. |
121 | | -# This is extended with the version to be deployed (e.g. the SHA or TAG) and the |
122 | | -# target os. |
123 | | -.release: |
124 | | - stage: |
125 | | - release |
126 | | - variables: |
127 | | - # Define the source image for the release |
128 | | - IMAGE_NAME: "${CI_REGISTRY_IMAGE}/cuda-samples" |
129 | | - VERSION: "${CI_COMMIT_SHORT_SHA}" |
130 | | - # OUT_IMAGE_VERSION is overridden for external releases |
131 | | - OUT_IMAGE_VERSION: "${CI_COMMIT_SHORT_SHA}" |
132 | | - before_script: |
133 | | - - !reference [.regctl-setup, before_script] |
134 | | - |
135 | | - # We ensure that the OUT_IMAGE_VERSION is set |
136 | | - - 'echo Version: ${OUT_IMAGE_VERSION} ; [[ -n "${OUT_IMAGE_VERSION}" ]] || exit 1' |
137 | | - |
138 | | - - apk add --no-cache make bash |
139 | | - script: |
140 | | - # Log in to the "output" registry, tag the image and push the image |
141 | | - - 'echo "Logging in to CI registry ${CI_REGISTRY}"' |
142 | | - - regctl registry login "${CI_REGISTRY}" -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" |
143 | | - - '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || echo "Logging in to output registry ${OUT_REGISTRY}"' |
144 | | - - '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"' |
145 | | - |
146 | | - # Since OUT_IMAGE_NAME and OUT_IMAGE_VERSION are set, this will push the CI image to the |
147 | | - # Target |
148 | | - - make -f deployments/container/Makefile push-${DIST} |
149 | | - |
150 | | -# Define a staging release step that pushes an image to an internal "staging" repository |
151 | | -# This is triggered for all pipelines (i.e. not only tags) to test the pipeline steps |
152 | | -# outside of the release process. |
153 | | -.release:staging: |
154 | | - extends: |
155 | | - - .release |
156 | | - variables: |
157 | | - OUT_REGISTRY_USER: "${CI_REGISTRY_USER}" |
158 | | - OUT_REGISTRY_TOKEN: "${CI_REGISTRY_PASSWORD}" |
159 | | - OUT_REGISTRY: "${CI_REGISTRY}" |
160 | | - OUT_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/staging/cuda-samples" |
161 | | - |
162 | | -# Define an external release step that pushes an image to an external repository. |
163 | | -# This includes a devlopment image off main. |
164 | | -.release:external: |
165 | | - extends: |
166 | | - - .release |
167 | | - rules: |
168 | | - - if: $CI_COMMIT_TAG |
169 | | - variables: |
170 | | - OUT_IMAGE_VERSION: "${CI_COMMIT_TAG}" |
171 | | - - if: $CI_COMMIT_BRANCH == $RELEASE_DEVEL_BRANCH |
172 | | - variables: |
173 | | - OUT_IMAGE_VERSION: "${DEVEL_RELEASE_IMAGE_VERSION}" |
174 | | - |
175 | | -# Define the release jobs |
176 | | -release:staging-vectoradd-ubi9: |
177 | | - extends: |
178 | | - - .release:staging |
179 | | - - .dist-ubi9 |
180 | | - - .sample-vectoradd |
181 | | - needs: |
182 | | - - image-vectoradd-ubi9 |
183 | | - |
184 | | -release:staging-vectoradd-ubuntu22.04: |
185 | | - extends: |
186 | | - - .release:staging |
187 | | - - .dist-ubuntu22.04 |
188 | | - - .sample-vectoradd |
189 | | - needs: |
190 | | - - image-vectoradd-ubuntu22.04 |
191 | | - |
192 | | -release:staging-device-query-ubuntu22.04: |
193 | | - extends: |
194 | | - - .release:staging |
195 | | - - .dist-ubuntu22.04 |
196 | | - - .sample-device-query |
197 | | - needs: |
198 | | - - image-device-query-ubuntu22.04 |
199 | | - |
200 | | -release:staging-vulkan: |
201 | | - extends: |
202 | | - - .release:staging |
203 | | - - .dist-ubuntu22.04 |
204 | | - - .sample-vulkan |
205 | | - needs: |
206 | | - - image-vulkan-ubuntu22.04 |
207 | | - |
208 | | -release:staging-nvbandwidth: |
209 | | - extends: |
210 | | - - .release:staging |
211 | | - - .dist-ubuntu22.04 |
212 | | - - .sample-nvbandwidth |
213 | | - needs: |
214 | | - - image-nvbandwidth-ubuntu22.04 |
0 commit comments