-
Notifications
You must be signed in to change notification settings - Fork 303
Expand file tree
/
Copy pathdocker-builder-testing-plugins.yml
More file actions
199 lines (180 loc) · 6.42 KB
/
Copy pathdocker-builder-testing-plugins.yml
File metadata and controls
199 lines (180 loc) · 6.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: docker-builder-testing-plugins
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- ".github/workflows/docker-builder-testing-plugins.yml"
- ".github/docker/testing/*"
pull_request:
paths:
- ".github/workflows/docker-builder-testing-plugins.yml"
- ".github/docker/testing/*"
jobs:
dependency-scan:
uses: centreon/security-tools/.github/workflows/dependency-analysis.yml@main
get-environment:
needs: [dependency-scan]
uses: ./.github/workflows/get-environment.yml
dockerize:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
dockerfile: alma8
image: testing
distrib: alma8
arch: amd64
- runner: ubuntu-24.04
dockerfile: alma9
image: testing
distrib: alma9
arch: amd64
- runner: ubuntu-24.04
dockerfile: alma10
image: testing
distrib: alma10
arch: amd64
- runner: ubuntu-24.04
dockerfile: bullseye
image: testing
distrib: bullseye
arch: amd64
- runner: ubuntu-24.04-arm
dockerfile: bullseye
image: testing
distrib: bullseye
arch: arm64
- runner: ubuntu-24.04
dockerfile: bookworm
image: testing
distrib: bookworm
arch: amd64
- runner: ubuntu-24.04
dockerfile: trixie
image: testing
distrib: trixie
arch: amd64
- runner: ubuntu-24.04
dockerfile: jammy
image: testing
distrib: jammy
arch: amd64
- runner: ubuntu-24.04
dockerfile: noble
image: testing
distrib: noble
arch: amd64
runs-on: ${{ matrix.runner }}
permissions:
packages: write
steps:
- name: Checkout sources
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Login to proxy registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
username: ${{ secrets.HARBOR_CENTREON_PUSH_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PUSH_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
with:
images: ghcr.io/${{ github.repository }}/${{ matrix.image }}
labels: |
org.opencontainers.image.description=Testing image for Centreon Plugins
com.centreon.stability=${{ needs.get-environment.outputs.stability }}
com.centreon.version=${{ needs.get-environment.outputs.version }}
- uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
file: .github/docker/testing/Dockerfile.testing-plugins-${{ matrix.dockerfile }}
context: .
build-args: |
"REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}"
"NODE_VERSION=24"
"PNPM_VERSION=10.24.0"
pull: true
push: true
tags: ghcr.io/${{ github.repository }}/${{ matrix.image }}:${{ matrix.distrib }}-${{ matrix.arch }}
labels: ${{ steps.meta.outputs.labels }}
compute-merge-matrix:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.compute.outputs.matrix }}
steps:
- name: Checkout sources
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Compute merge matrix
id: compute
shell: bash
run: |
matrix=$(yq -o=json '.jobs.dockerize.strategy.matrix.include' \
.github/workflows/docker-builder-testing-plugins.yml | \
jq -c '
group_by([.image, .distrib]) |
map({
image: .[0].image,
distrib: .[0].distrib,
archs: (map(.arch) | join(" "))
}) |
{include: .}
')
echo "matrix=$matrix" >> $GITHUB_OUTPUT
merge:
needs: [get-environment, dockerize, compute-merge-matrix]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
runs-on: ubuntu-24.04
permissions:
packages: write
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.compute-merge-matrix.outputs.matrix) }}
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Create multi-platform manifest
shell: bash
run: |
SOURCE=""
for arch in ${{ matrix.archs }}; do
SOURCE="$SOURCE ghcr.io/${{ github.repository }}/${{ matrix.image }}:${{ matrix.distrib }}-$arch"
done
docker buildx imagetools create \
--tag ghcr.io/${{ github.repository }}/${{ matrix.image }}:${{ matrix.distrib }} \
$SOURCE
set-skip-label:
needs: [get-environment, merge]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/set-pull-request-skip-label.yml