Skip to content

Commit e5ff024

Browse files
committed
MON-196408 [CI] Use ghcr.io (github containers) to store fat containers from pipelines
- docker-builder-packaging-plugins: build and push directly to ghcr.io instead of Harbor - docker-builder-testing-plugins: build and push directly to ghcr.io instead of Harbor - perl-cpan-libraries: remove get-packaging-images intermediary job, pull directly from ghcr.io - plugins-robot-tests: remove push-test-image-to-ghcr intermediary job, pull directly from ghcr.io - plugins: remove Harbor secrets from plugins-robot-tests call
1 parent 9aa42d2 commit e5ff024

5 files changed

Lines changed: 58 additions & 155 deletions

File tree

.github/workflows/docker-builder-packaging-plugins.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,26 @@ jobs:
9494

9595
runs-on: ${{ matrix.runner }}
9696

97+
permissions:
98+
packages: write
99+
97100
steps:
98101
- name: Checkout sources
99102
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
100103

101-
- name: Login to Registry
104+
- name: Login to proxy registry
102105
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
103106
with:
104-
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
107+
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
105108
username: ${{ secrets.HARBOR_CENTREON_PUSH_USERNAME }}
106109
password: ${{ secrets.HARBOR_CENTREON_PUSH_TOKEN }}
107110

108-
- name: Login to proxy registry
111+
- name: Login to GitHub Container Registry
109112
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
110113
with:
111-
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
112-
username: ${{ secrets.HARBOR_CENTREON_PUSH_USERNAME }}
113-
password: ${{ secrets.HARBOR_CENTREON_PUSH_TOKEN }}
114+
registry: ghcr.io
115+
username: ${{ github.actor }}
116+
password: ${{ github.token }}
114117

115118
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
116119

@@ -121,7 +124,7 @@ jobs:
121124
build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}"
122125
pull: true
123126
push: true
124-
tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
127+
tags: ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
125128

126129
set-skip-label:
127130
needs: [get-environment, dockerize]

.github/workflows/docker-builder-testing-plugins.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,26 @@ jobs:
6565

6666
runs-on: ${{ matrix.runner }}
6767

68+
permissions:
69+
packages: write
70+
6871
steps:
6972
- name: Checkout sources
7073
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7174

72-
- name: Login to Registry
75+
- name: Login to proxy registry
7376
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
7477
with:
75-
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
78+
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
7679
username: ${{ secrets.HARBOR_CENTREON_PUSH_USERNAME }}
7780
password: ${{ secrets.HARBOR_CENTREON_PUSH_TOKEN }}
7881

79-
- name: Login to proxy registry
82+
- name: Login to GitHub Container Registry
8083
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
8184
with:
82-
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
83-
username: ${{ secrets.HARBOR_CENTREON_PUSH_USERNAME }}
84-
password: ${{ secrets.HARBOR_CENTREON_PUSH_TOKEN }}
85+
registry: ghcr.io
86+
username: ${{ github.actor }}
87+
password: ${{ github.token }}
8588

8689
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
8790

@@ -95,7 +98,7 @@ jobs:
9598
"PNPM_VERSION=10.24.0"
9699
pull: true
97100
push: true
98-
tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/testing-plugins-${{ matrix.image }}:latest
101+
tags: ghcr.io/${{ github.repository }}/testing-plugins-${{ matrix.image }}:latest
99102

100103
set-skip-label:
101104
needs: [get-environment, dockerize]

.github/workflows/perl-cpan-libraries.yml

Lines changed: 26 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -144,60 +144,8 @@ jobs:
144144
name: partial-matrix-*
145145
failOnError: false
146146

147-
get-packaging-images:
148-
needs: [get-environment]
149-
if: |
150-
needs.get-environment.outputs.skip_workflow == 'false' &&
151-
needs.get-environment.outputs.stability != 'stable'
152-
strategy:
153-
fail-fast: false
154-
max-parallel: 3
155-
matrix:
156-
include:
157-
- image: packaging-plugins-alma8
158-
- image: packaging-plugins-alma9
159-
- image: packaging-plugins-alma10
160-
- image: packaging-plugins-bullseye
161-
- image: packaging-plugins-bookworm
162-
- image: packaging-plugins-trixie
163-
- image: packaging-plugins-jammy
164-
- image: packaging-plugins-noble
165-
- image: packaging-plugins-bullseye-arm64
166-
- image: packaging-plugins-bookworm-arm64
167-
- image: packaging-plugins-trixie-arm64
168-
runs-on: ${{ contains(matrix.image, 'arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
169-
steps:
170-
- name: Login to Registry
171-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
172-
with:
173-
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
174-
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
175-
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
176-
177-
- name: Login to Proxy Registry
178-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
179-
with:
180-
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
181-
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
182-
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
183-
184-
- name: Pull and save image
185-
env:
186-
DOCKER_IMAGE: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
187-
IMAGE_NAME: ${{ matrix.image }}
188-
run: |
189-
docker image prune -af
190-
docker pull "${DOCKER_IMAGE}:latest"
191-
docker save -o "./${IMAGE_NAME}" "${DOCKER_IMAGE}:latest"
192-
shell: bash
193-
194-
- uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
195-
with:
196-
path: ./${{ matrix.image }}
197-
key: ${{ matrix.image }}-${{ github.sha }}-${{ github.run_id }}
198-
199147
package-rpm:
200-
needs: [get-environment, generate-matrices, get-packaging-images]
148+
needs: [get-environment, generate-matrices]
201149
if: |
202150
needs.get-environment.outputs.skip_workflow == 'false' &&
203151
needs.get-environment.outputs.stability != 'stable'
@@ -213,22 +161,22 @@ jobs:
213161
steps:
214162
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
215163

216-
- name: Restore packaging image from cache
217-
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
164+
- name: Login to GitHub Container Registry
165+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
218166
with:
219-
path: ./${{ matrix.image }}
220-
key: ${{ matrix.image }}-${{ github.sha }}-${{ github.run_id }}
221-
fail-on-cache-miss: true
167+
registry: ghcr.io
168+
username: ${{ github.actor }}
169+
password: ${{ github.token }}
222170

223-
- name: Load packaging image
171+
- name: Pull packaging image from ghcr.io
224172
env:
225-
IMAGE_NAME: ${{ matrix.image }}
226-
run: docker load --input "./${IMAGE_NAME}"
173+
GHCR_IMAGE: ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
174+
run: docker pull "${GHCR_IMAGE}"
227175
shell: bash
228176

229177
- if: ${{ matrix.spec_file == '' }}
230178
env:
231-
DOCKER_IMAGE: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
179+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
232180
VERSION: ${{ matrix.version || matrix.cpan_version }}
233181
RPM_DEPENDENCIES: ${{ matrix.rpm_dependencies }}
234182
RPM_PROVIDES: ${{ matrix.rpm_provides }}
@@ -246,20 +194,20 @@ jobs:
246194
-e VERSION -e RPM_DEPENDENCIES -e RPM_PROVIDES \
247195
-e NO_AUTO_DEPENDS -e PREINSTALL_CPANLIBS -e PREINSTALL_PACKAGES \
248196
-e PKG_NAME -e PKG_EXT -e DISTRIB -e REVISION \
249-
"${DOCKER_IMAGE}:latest" \
197+
"${DOCKER_IMAGE}" \
250198
bash .github/scripts/perl-cpan-libraries/package-cpan-rpm.sh
251199
shell: bash
252200

253201
- if: ${{ matrix.spec_file != '' }}
254202
env:
255-
DOCKER_IMAGE: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
203+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
256204
SPEC_FILE: ${{ matrix.spec_file }}
257205
run: |
258206
docker run --rm \
259207
-v "$(pwd):/work" \
260208
--workdir /work \
261209
-e SPEC_FILE \
262-
"${DOCKER_IMAGE}:latest" \
210+
"${DOCKER_IMAGE}" \
263211
bash -c '
264212
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
265213
rpmbuild --undefine=_disable_source_fetch -ba "$SPEC_FILE"
@@ -349,7 +297,7 @@ jobs:
349297
key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
350298

351299
package-deb:
352-
needs: [get-environment, generate-matrices, get-packaging-images]
300+
needs: [get-environment, generate-matrices]
353301
if: |
354302
needs.get-environment.outputs.skip_workflow == 'false' &&
355303
needs.get-environment.outputs.stability != 'stable'
@@ -364,17 +312,17 @@ jobs:
364312
steps:
365313
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
366314

367-
- name: Restore packaging image from cache
368-
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
315+
- name: Login to GitHub Container Registry
316+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
369317
with:
370-
path: ./${{ matrix.image }}
371-
key: ${{ matrix.image }}-${{ github.sha }}-${{ github.run_id }}
372-
fail-on-cache-miss: true
318+
registry: ghcr.io
319+
username: ${{ github.actor }}
320+
password: ${{ github.token }}
373321

374-
- name: Load packaging image
322+
- name: Pull packaging image from ghcr.io
375323
env:
376-
IMAGE_NAME: ${{ matrix.image }}
377-
run: docker load --input "./${IMAGE_NAME}"
324+
GHCR_IMAGE: ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
325+
run: docker pull "${GHCR_IMAGE}"
378326
shell: bash
379327

380328
- name: Parse distrib name
@@ -385,7 +333,7 @@ jobs:
385333

386334
- if: ${{ matrix.use_dh_make_perl == 'false' }}
387335
env:
388-
DOCKER_IMAGE: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
336+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
389337
VERSION: ${{ matrix.version || matrix.cpan_version }}
390338
DEB_DEPENDENCIES: ${{ matrix.deb_dependencies }}
391339
DEB_PROVIDES: ${{ matrix.deb_provides }}
@@ -406,13 +354,13 @@ jobs:
406354
-e NO_AUTO_DEPENDS -e PREINSTALL_CPANLIBS -e PREINSTALL_PACKAGES \
407355
-e PKG_NAME -e PKG_EXT -e DISTRIB -e REVISION \
408356
-e DISTRIB_SEPARATOR -e DISTRIB_SUFFIX \
409-
"${DOCKER_IMAGE}:latest" \
357+
"${DOCKER_IMAGE}" \
410358
bash .github/scripts/perl-cpan-libraries/package-cpan-deb-fpm.sh
411359
shell: bash
412360

413361
- if: ${{ matrix.use_dh_make_perl == 'true' }}
414362
env:
415-
DOCKER_IMAGE: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
363+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ matrix.image }}:latest
416364
VERSION: ${{ matrix.version || matrix.cpan_version }}
417365
PREINSTALL_CPANLIBS: ${{ matrix.preinstall_cpanlibs }}
418366
PREINSTALL_PACKAGES: ${{ matrix.preinstall_packages }}
@@ -428,7 +376,7 @@ jobs:
428376
-e VERSION -e PREINSTALL_CPANLIBS -e PREINSTALL_PACKAGES \
429377
-e PKG_NAME -e DISTRIB -e REVISION \
430378
-e DISTRIB_SEPARATOR -e DISTRIB_SUFFIX \
431-
"${DOCKER_IMAGE}:latest" \
379+
"${DOCKER_IMAGE}" \
432380
bash .github/scripts/perl-cpan-libraries/package-cpan-deb-dhmaker.sh
433381
shell: bash
434382

.github/workflows/plugins-robot-tests.yml

Lines changed: 12 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -45,57 +45,8 @@ on:
4545
description: "Robot tags to include in tests"
4646
type: string
4747
default: ""
48-
secrets:
49-
registry_username:
50-
required: true
51-
registry_password:
52-
required: true
53-
5448
jobs:
55-
test-image-to-cache:
56-
runs-on: ${{ contains(inputs.image, 'arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
57-
steps:
58-
- name: Checkout sources
59-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60-
61-
- name: Login to Registry
62-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
63-
with:
64-
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
65-
username: ${{ secrets.registry_username }}
66-
password: ${{ secrets.registry_password }}
67-
68-
- name: Login to Proxy Registry
69-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
70-
with:
71-
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
72-
username: ${{ secrets.registry_username }}
73-
password: ${{ secrets.registry_password }}
74-
75-
- name: Load image
76-
env:
77-
DOCKER_IMAGE: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ inputs.image }}
78-
run: |
79-
docker image prune -af
80-
docker pull $DOCKER_IMAGE
81-
shell: bash
82-
83-
- name: Save image on disk
84-
env:
85-
IMAGE_NAME: ${{ inputs.image }}
86-
DOCKER_IMAGE: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ inputs.image }}
87-
run: |
88-
docker save -o ./$IMAGE_NAME $DOCKER_IMAGE
89-
shell: bash
90-
91-
- name: Save image into cache
92-
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
93-
with:
94-
path: ./${{ inputs.image }}
95-
key: ${{ inputs.image }}-${{ github.sha }}-${{ github.run_id }}
96-
9749
robot-test:
98-
needs: [test-image-to-cache]
9950
runs-on: ${{ contains(inputs.image, 'arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
10051

10152
strategy:
@@ -110,12 +61,18 @@ jobs:
11061
- name: Checkout sources
11162
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
11263

113-
- name: Get the cached docker image for tests
114-
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
64+
- name: Login to GitHub Container Registry
65+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
11566
with:
116-
path: ./${{ inputs.image }}
117-
key: ${{ inputs.image }}-${{ github.sha }}-${{ github.run_id }}
118-
fail-on-cache-miss: true
67+
registry: ghcr.io
68+
username: ${{ github.actor }}
69+
password: ${{ github.token }}
70+
71+
- name: Pull test image from ghcr.io
72+
env:
73+
GHCR_IMAGE: ghcr.io/${{ github.repository }}/${{ inputs.image }}:latest
74+
run: docker pull "${GHCR_IMAGE}"
75+
shell: bash
11976

12077
- name: Get the cached plugins
12178
if: ${{ inputs.get-packages == 'True' }}
@@ -132,15 +89,10 @@ jobs:
13289
key: ${{ inputs.plugins-json-cache-key }}
13390
fail-on-cache-miss: true
13491

135-
- name: Load image
136-
env:
137-
IMAGE_NAME: ${{ inputs.image }}
138-
run: docker load --input ./$IMAGE_NAME
139-
14092
- name: Install, test and remove plugin
14193
shell: bash
14294
env:
143-
DOCKER_IMAGE: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ inputs.image }}
95+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ inputs.image }}:latest
14496
PACKAGE_EXTENSION: ${{ inputs.package-extension }}
14597
RUNNER_ID: ${{ matrix.index }}
14698
SKIP_ROBOT_TESTS: ${{ inputs.skip-robot-tests }}

.github/workflows/plugins.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,6 @@ jobs:
432432
plugins-json-cache-key: plugins-${{ github.sha }}-${{ github.run_id }}
433433
skip-robot-tests: ${{ matrix.skip_robot_tests }}
434434
exclude-robot-tags: centreon-generic-snmp
435-
secrets:
436-
registry_username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
437-
registry_password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
438435

439436
deliver-packages:
440437
needs: [get-environment, get-plugins, test-plugins]

0 commit comments

Comments
 (0)