Skip to content

Commit 302b4fc

Browse files
committed
Backfill old tags
1 parent dbf6d61 commit 302b4fc

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
contexts:
1616
required: false
1717
type: string
18+
strip-apk-pinning:
19+
description: "Remove apk OS package pins from dockerfiles"
20+
required: false
21+
type: boolean
22+
default: false
1823
outputs:
1924
digest:
2025
description: "Digest argument for Gradle"
@@ -39,6 +44,11 @@ jobs:
3944
- name: Checkout
4045
uses: "actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8" # v6
4146

47+
# allow running this job on old tags
48+
- name: Strip APK pinning
49+
if: ${{ inputs.strip-apk-pinning || false }}
50+
run: ./ci/strip-apk-pinning.sh "$(echo "${{ inputs.tags }}" | awk '{print $1}')"
51+
4252
- name: Set up Docker Buildx
4353
id: buildx
4454
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3

.github/workflows/push.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
tag:
1010
type: string
1111
required: true
12+
strip-apk-pinning:
13+
description: "Remove apk OS package pins from dockerfiles"
14+
required: false
15+
type: boolean
16+
default: false
1217
concurrency:
1318
group: ${{ github.ref }}
1419
cancel-in-progress: true
@@ -37,6 +42,7 @@ jobs:
3742
image: base
3843
repository: ${{ vars.repository }}
3944
tags: ${{ needs.tags.outputs.tags }}
45+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
4046
secrets: inherit
4147
permissions:
4248
contents: read
@@ -49,6 +55,7 @@ jobs:
4955
image: activemq
5056
repository: ${{ vars.repository }}
5157
tags: ${{ needs.tags.outputs.tags }}
58+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
5259
secrets: inherit
5360
permissions:
5461
contents: read
@@ -61,6 +68,7 @@ jobs:
6168
image: alpaca
6269
repository: ${{ vars.repository }}
6370
tags: ${{ needs.tags.outputs.tags }}
71+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
6472
secrets: inherit
6573
permissions:
6674
contents: read
@@ -73,6 +81,7 @@ jobs:
7381
image: blazegraph
7482
repository: ${{ vars.repository }}
7583
tags: ${{ needs.tags.outputs.tags }}
84+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
7685
secrets: inherit
7786
permissions:
7887
contents: read
@@ -85,6 +94,7 @@ jobs:
8594
image: cantaloupe
8695
repository: ${{ vars.repository }}
8796
tags: ${{ needs.tags.outputs.tags }}
97+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
8898
secrets: inherit
8999
permissions:
90100
contents: read
@@ -97,6 +107,7 @@ jobs:
97107
image: crayfish
98108
repository: ${{ vars.repository }}
99109
tags: ${{ needs.tags.outputs.tags }}
110+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
100111
secrets: inherit
101112
permissions:
102113
contents: read
@@ -109,6 +120,7 @@ jobs:
109120
image: crayfits
110121
repository: ${{ vars.repository }}
111122
tags: ${{ needs.tags.outputs.tags }}
123+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
112124
secrets: inherit
113125
permissions:
114126
contents: read
@@ -121,6 +133,7 @@ jobs:
121133
image: drupal
122134
repository: ${{ vars.repository }}
123135
tags: ${{ needs.tags.outputs.tags }}
136+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
124137
secrets: inherit
125138
permissions:
126139
contents: read
@@ -133,6 +146,7 @@ jobs:
133146
image: fcrepo6
134147
repository: ${{ vars.repository }}
135148
tags: ${{ needs.tags.outputs.tags }}
149+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
136150
secrets: inherit
137151
permissions:
138152
contents: read
@@ -145,6 +159,7 @@ jobs:
145159
image: fits
146160
repository: ${{ vars.repository }}
147161
tags: ${{ needs.tags.outputs.tags }}
162+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
148163
secrets: inherit
149164
permissions:
150165
contents: read
@@ -157,6 +172,7 @@ jobs:
157172
image: handle
158173
repository: ${{ vars.repository }}
159174
tags: ${{ needs.tags.outputs.tags }}
175+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
160176
secrets: inherit
161177
permissions:
162178
contents: read
@@ -169,6 +185,7 @@ jobs:
169185
image: homarus
170186
repository: ${{ vars.repository }}
171187
tags: ${{ needs.tags.outputs.tags }}
188+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
172189
secrets: inherit
173190
permissions:
174191
contents: read
@@ -181,6 +198,7 @@ jobs:
181198
image: houdini
182199
repository: ${{ vars.repository }}
183200
tags: ${{ needs.tags.outputs.tags }}
201+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
184202
secrets: inherit
185203
permissions:
186204
contents: read
@@ -193,6 +211,7 @@ jobs:
193211
image: hypercube
194212
repository: ${{ vars.repository }}
195213
tags: ${{ needs.tags.outputs.tags }}
214+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
196215
secrets: inherit
197216
permissions:
198217
contents: read
@@ -205,6 +224,7 @@ jobs:
205224
image: imagemagick
206225
repository: ${{ vars.repository }}
207226
tags: ${{ needs.tags.outputs.tags }}
227+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
208228
secrets: inherit
209229
permissions:
210230
contents: read
@@ -217,6 +237,7 @@ jobs:
217237
image: java
218238
repository: ${{ vars.repository }}
219239
tags: ${{ needs.tags.outputs.tags }}
240+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
220241
secrets: inherit
221242
permissions:
222243
contents: read
@@ -229,6 +250,7 @@ jobs:
229250
image: leptonica
230251
repository: ${{ vars.repository }}
231252
tags: ${{ needs.tags.outputs.tags }}
253+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
232254
secrets: inherit
233255
permissions:
234256
contents: read
@@ -241,6 +263,7 @@ jobs:
241263
image: mariadb
242264
repository: ${{ vars.repository }}
243265
tags: ${{ needs.tags.outputs.tags }}
266+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
244267
secrets: inherit
245268
permissions:
246269
contents: read
@@ -253,6 +276,7 @@ jobs:
253276
image: mergepdf
254277
repository: ${{ vars.repository }}
255278
tags: ${{ needs.tags.outputs.tags }}
279+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
256280
secrets: inherit
257281
permissions:
258282
contents: read
@@ -265,6 +289,7 @@ jobs:
265289
image: milliner
266290
repository: ${{ vars.repository }}
267291
tags: ${{ needs.tags.outputs.tags }}
292+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
268293
secrets: inherit
269294
permissions:
270295
contents: read
@@ -277,6 +302,7 @@ jobs:
277302
image: nginx
278303
repository: ${{ vars.repository }}
279304
tags: ${{ needs.tags.outputs.tags }}
305+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
280306
secrets: inherit
281307
permissions:
282308
contents: read
@@ -289,6 +315,7 @@ jobs:
289315
image: postgresql
290316
repository: ${{ vars.repository }}
291317
tags: ${{ needs.tags.outputs.tags }}
318+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
292319
secrets: inherit
293320
permissions:
294321
contents: read
@@ -301,6 +328,7 @@ jobs:
301328
image: riprap
302329
repository: ${{ vars.repository }}
303330
tags: ${{ needs.tags.outputs.tags }}
331+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
304332
secrets: inherit
305333
permissions:
306334
contents: read
@@ -313,6 +341,7 @@ jobs:
313341
image: scyllaridae
314342
repository: ${{ vars.repository }}
315343
tags: ${{ needs.tags.outputs.tags }}
344+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
316345
secrets: inherit
317346
permissions:
318347
contents: read
@@ -325,6 +354,7 @@ jobs:
325354
image: solr
326355
repository: ${{ vars.repository }}
327356
tags: ${{ needs.tags.outputs.tags }}
357+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
328358
secrets: inherit
329359
permissions:
330360
contents: read
@@ -337,6 +367,7 @@ jobs:
337367
image: test
338368
repository: ${{ vars.repository }}
339369
tags: ${{ needs.tags.outputs.tags }}
370+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
340371
secrets: inherit
341372
permissions:
342373
contents: read
@@ -349,6 +380,7 @@ jobs:
349380
image: tomcat
350381
repository: ${{ vars.repository }}
351382
tags: ${{ needs.tags.outputs.tags }}
383+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
352384
secrets: inherit
353385
permissions:
354386
contents: read
@@ -361,6 +393,7 @@ jobs:
361393
image: transkribus
362394
repository: ${{ vars.repository }}
363395
tags: ${{ needs.tags.outputs.tags }}
396+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
364397
secrets: inherit
365398
permissions:
366399
contents: read
@@ -373,6 +406,7 @@ jobs:
373406
image: transcriber
374407
repository: ${{ vars.repository }}
375408
tags: ${{ needs.tags.outputs.tags }}
409+
strip-apk-pinning: ${{ inputs.strip-apk-pinning || false }}
376410
secrets: inherit
377411
permissions:
378412
contents: read

ci/strip-apk-pinning.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Remove apk OS package pinning from all dockerfiles
5+
# This allows rebuilding old tags with the latest
6+
# OS packages available in the base image's package manager.
7+
#
8+
# Usage: ./ci/build-with-os-versions.sh <tag>
9+
# tag - The git tag to build from (must exist)
10+
11+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12+
readonly SCRIPT_DIR
13+
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
14+
readonly ROOT_DIR
15+
16+
usage() {
17+
echo "Usage: $0 <tag>"
18+
echo ""
19+
echo "Arguments:"
20+
echo " tag - The git tag to build from (must exist)"
21+
echo ""
22+
echo "Examples:"
23+
echo " $0 1.0.0 # Build all images locally with tag 1.0.0"
24+
exit 1
25+
}
26+
if [[ $# -lt 1 ]]; then
27+
usage
28+
fi
29+
30+
TAG="${1}"
31+
32+
# Verify the git tag exists before proceeding
33+
git fetch origin tag "${TAG}"
34+
git checkout "${TAG}"
35+
36+
# Determine images directory (old tags use root, newer tags use ./images)
37+
if [[ -d "${ROOT_DIR}/images" ]]; then
38+
IMAGES_DIR="${ROOT_DIR}/images"
39+
else
40+
IMAGES_DIR="${ROOT_DIR}"
41+
fi
42+
43+
# Remove OS package version pinning from Dockerfiles
44+
echo "==> Removing OS package version pinning from Dockerfiles..."
45+
for dockerfile in "${IMAGES_DIR}"/*/Dockerfile; do
46+
if [[ ! -f "${dockerfile}" ]]; then
47+
continue
48+
fi
49+
sed -i.bak 's/==[^ ]*//g' "${dockerfile}"
50+
rm "${dockerfile}.bak"
51+
done

0 commit comments

Comments
 (0)