-
Notifications
You must be signed in to change notification settings - Fork 1
240 lines (227 loc) · 10.8 KB
/
ci.yml
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: ci
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
list:
description: 'Comma-separated list of directories in the form: ["dir1", "dir2"]'
required: true
default: ''
jobs:
# Job to run change detection
changes:
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'images' output variable
images: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
- name: Determine Paths to Build for Auto Trigger
uses: dorny/paths-filter@v3
id: filter
with:
# Use context to get the branch where commits were pushed.
# If there is only one long-lived branch (e.g. master),
# you can specify it directly.
# If it's not configured, the repository default branch is used.
base: ${{ github.ref }}
filters: |
acme/certbot: 'acme/certbot/**'
acme/certbot-dns-cloudflare: 'acme/certbot-dns-cloudflare/**'
acme/lego: 'acme/lego/**'
aws-cli: 'aws-cli/**'
black: 'black/**'
buildpack-deps/ubuntu/focal: 'buildpack-deps/ubuntu/focal/**'
buildpack-deps/ubuntu/jammy: 'buildpack-deps/ubuntu/jammy/**'
buildpack-deps/ubuntu/noble: 'buildpack-deps/ubuntu/noble/**'
cinc/cinc-auditor: 'cinc/cinc-auditor/**'
doctl: 'doctl/**'
couchdb: 'couchdb/**'
dokken/almalinux-8: 'dokken/almalinux-8/**'
dokken/almalinux-9: 'dokken/almalinux-9/**'
dokken/amazonlinux-2: 'dokken/amazonlinux-2/**'
dokken/amazonlinux-2023: 'dokken/amazonlinux-2023/**'
dokken/centos-stream-9: 'dokken/centos-stream-9/**'
dokken/cinc: 'dokken/cinc/**'
dokken/debian-11: 'dokken/debian-11/**'
dokken/debian-12: 'dokken/debian-12/**'
dokken/eurolinux-9: 'dokken/eurolinux-9/**'
dokken/opensuse-leap-15.3: 'dokken/opensuse-leap-15.3/**'
dokken/opensuse-leap-15.4: 'dokken/opensuse-leap-15.4/**'
dokken/opensuse-leap-15.5: 'dokken/opensuse-leap-15.5/**'
dokken/opensuse-leap-15.6: 'dokken/opensuse-leap-15.6/**'
dokken/oraclelinux-8: 'dokken/oraclelinux-8/**'
dokken/oraclelinux-9: 'dokken/oraclelinux-9/**'
dokken/rockylinux-8: 'dokken/rockylinux-8/**'
dokken/rockylinux-9: 'dokken/rockylinux-9/**'
dokken/ubuntu-20.04: 'dokken/ubuntu-20.04/**'
dokken/ubuntu-22.04: 'dokken/ubuntu-22.04/**'
dokken/ubuntu-24.04: 'dokken/ubuntu-24.04/**'
flake8: 'flake8/**'
github-cli: 'github-cli/**'
glab: 'glab/**'
go2chef: 'go2chef/**'
golang/1.20/jammy: 'golang/1.20/jammy/**'
golang/1.21/jammy: 'golang/1.21/jammy/**'
golang/1.22/jammy: 'golang/1.22/jammy/**'
golang/1.23/jammy: 'golang/1.23/jammy/**'
grafana/grafana-oss: 'grafana/grafana-oss/**'
hadolint: 'hadolint/**'
hashicorp/terraform: 'hashicorp/terraform/**'
jfrog/jfrog-cli: 'jfrog/jfrog-cli/**'
ldap-utils: 'ldap-utils/**'
markdownlint: 'markdownlint/**'
meshcmd: 'meshcmd/**'
netbox: 'netbox/**'
node/18/jammy-slim: 'node/18/jammy-slim/**'
node/20/jammy-slim: 'node/20/jammy-slim/**'
node/22/jammy-slim: 'node/22/jammy-slim/**'
op: 'op/**'
paperspace-cli: 'paperspace-cli/**'
portainer-ce: 'portainer-ce/**'
postgres/15/jammy: 'postgres/15/jammy/**'
postgres/16/jammy: 'postgres/16/jammy/**'
prometheus/alertmanager: 'prometheus/alertmanager/**'
prometheus/blackbox_exporter: 'prometheus/blackbox_exporter/**'
prometheus/collectd_exporter: 'prometheus/collectd_exporter/**'
prometheus/node_exporter: 'prometheus/node_exporter/**'
prometheus/prometheus: 'prometheus/prometheus/**'
pspace: 'pspace/**'
pulumi/pulumi-base: 'pulumi/pulumi-base/**'
pulumi/pulumi-python: 'pulumi/pulumi-python/**'
redis/7.2/jammy: 'redis/7.2/jammy/**'
ruby/3.1/jammy: 'ruby/3.1/jammy/**'
ruby/3.1/slim-jammy: 'ruby/3.1/slim-jammy/**'
ruby/3.2/jammy: 'ruby/3.2/jammy/**'
ruby/3.2/slim-jammy: 'ruby/3.2/slim-jammy/**'
ruby/3.3/jammy: 'ruby/3.3/jammy/**'
ruby/3.3/slim-jammy: 'ruby/3.3/slim-jammy/**'
shellcheck: 'shellcheck/**'
smokeping: 'smokeping/**'
ubuntu-autoinstall: 'ubuntu-autoinstall/**'
# Job to build and test each of the modified images
build:
needs: changes
strategy:
matrix:
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['image1', 'image2'] if both image folders contains changes
image: ${{ fromJSON(needs.changes.outputs.images) }}
if: ${{ needs.changes.outputs.images != '[]' && needs.changes.outputs.images != '' && github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get build parameters
shell: bash
working-directory: ${{ matrix.image }}
run: |
echo "run-lint-stage=$($(git rev-parse --show-toplevel)/bin/run-lint-stage.sh)" >> $GITHUB_ENV
echo "run-test-stage=$($(git rev-parse --show-toplevel)/bin/run-test-stage.sh)" >> $GITHUB_ENV
echo "test-entrypoint=$($(git rev-parse --show-toplevel)/bin/test-entrypoint.sh)" >> $GITHUB_ENV
cat $GITHUB_ENV
- uses: polymathrobotics/container-build-publish-action@main
with:
workdir: ${{ matrix.image }}
build-type: 'hosted'
run-lint-stage: ${{ env.run-lint-stage }}
run-test-stage: ${{ env.run-test-stage }}
test-entrypoint: ${{ env.test-entrypoint }}
dockerhub-username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }}
# Job to build and test each of the modified images
manual-build:
strategy:
matrix:
directory: ${{ fromJSON(github.event.inputs.list) }}
if: ${{ github.event.inputs.list != '' && github.event.inputs.list != '[]' && github.event_name == 'workflow_dispatch' }}
runs-on: [self-hosted, multi-arch]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get build parameters
shell: bash
working-directory: ${{ matrix.directory }}
run: |
echo "run-lint-stage=$($(git rev-parse --show-toplevel)/bin/run-lint-stage.sh)" >> $GITHUB_ENV
echo "run-test-stage=$($(git rev-parse --show-toplevel)/bin/run-test-stage.sh)" >> $GITHUB_ENV
echo "test-entrypoint=$($(git rev-parse --show-toplevel)/bin/test-entrypoint.sh)" >> $GITHUB_ENV
cat $GITHUB_ENV
- uses: polymathrobotics/container-build-publish-action@main
with:
workdir: ${{ matrix.directory }}
build-type: 'local'
run-lint-stage: ${{ env.run-lint-stage }}
run-test-stage: ${{ env.run-test-stage }}
test-entrypoint: ${{ env.test-entrypoint }}
dockerhub-username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }}
# Job to run change detection
self-hosted-changes:
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: [self-hosted, multi-arch]
outputs:
images: ${{ steps.self-hosted-filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: self-hosted-filter
with:
base: ${{ github.ref }}
filters: |
python/3.9/focal: 'python/3.9/focal/**'
python/3.9/slim-focal: 'python/3.9/slim-focal/**'
python/3.9/jammy: 'python/3.9/jammy/**'
python/3.9/slim-jammy: 'python/3.9/slim-jammy/**'
python/3.9/noble: 'python/3.9/noble/**'
python/3.9/slim-noble: 'python/3.9/slim-noble/**'
python/3.10/focal: 'python/3.10/focal/**'
python/3.10/slim-focal: 'python/3.10/slim-focal/**'
python/3.10/jammy: 'python/3.10/jammy/**'
python/3.10/slim-jammy: 'python/3.10/slim-jammy/**'
python/3.10/noble: 'python/3.10/noble/**'
python/3.10/slim-noble: 'python/3.10/slim-noble/**'
ros/humble/ubuntu/jammy: 'ros/humble/ubuntu/jammy/**'
ros/iron/ubuntu/jammy: 'ros/iron/ubuntu/jammy/**'
ros/jazzy/ubuntu/noble: 'ros/jazzy/ubuntu/noble/**'
ros/noetic/ubuntu/focal: 'ros/noetic/ubuntu/focal/**'
ros/rolling/ubuntu/jammy: 'ros/rolling/ubuntu/jammy/**'
ros/rolling/ubuntu/noble: 'ros/rolling/ubuntu/noble/**'
polymath-ros/humble/ubuntu/jammy: 'polymath-ros/humble/ubuntu/jammy/**'
polymath-ros/iron/ubuntu/jammy: 'polymath-ros/iron/ubuntu/jammy/**'
polymath-ros/jazzy/ubuntu/noble: 'polymath-ros/jazzy/ubuntu/noble/**'
polymath-ros/rolling/ubuntu/jammy: 'polymath-ros/rolling/ubuntu/jammy/**'
# Job to build and test each of the modified images
self-hosted-build:
needs: self-hosted-changes
strategy:
matrix:
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['image1', 'image2'] if both image folders contains changes
image: ${{ fromJSON(needs.self-hosted-changes.outputs.images) }}
if: ${{ needs.self-hosted-changes.outputs.images != '[]' && needs.self-hosted-changes.outputs.images != '' && github.event_name != 'workflow_dispatch'}}
runs-on: [self-hosted, multi-arch]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get build parameters
shell: bash
working-directory: ${{ matrix.image }}
run: |
echo "run-lint-stage=$($(git rev-parse --show-toplevel)/bin/run-lint-stage.sh)" >> $GITHUB_ENV
echo "run-test-stage=$($(git rev-parse --show-toplevel)/bin/run-test-stage.sh)" >> $GITHUB_ENV
echo "test-entrypoint=$($(git rev-parse --show-toplevel)/bin/test-entrypoint.sh)" >> $GITHUB_ENV
cat $GITHUB_ENV
- uses: polymathrobotics/container-build-publish-action@main
with:
workdir: ${{ matrix.image }}
build-type: 'local'
run-lint-stage: ${{ env.run-lint-stage }}
run-test-stage: ${{ env.run-test-stage }}
test-entrypoint: ${{ env.test-entrypoint }}
dockerhub-username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }}