forked from docker-library/buildpack-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (223 loc) · 8.34 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
241
242
243
244
245
246
name: GitHub CI
on:
pull_request:
branches:
- master
push:
branches:
- master
workflow_dispatch:
inputs:
wanted:
description: >
Build selected suites. Use "all" for all buildable suites, "active"
for all non-EOL suites, "eol" for all EOL-ed suites, or
comma-separated codenames. Default is "active".
type: string
default: 'active'
schedule:
- cron: 0 0 * * 0
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
generate-jobs:
name: Generate Jobs
runs-on: ubuntu-latest
outputs:
codenames: ${{ steps.processing.outputs.codenames }}
steps:
- name: Debian Releases Info
id: debian
uses: vicamo/actions-library/debian-releases@v1
- name: Ubuntu Releases Info
id: ubuntu
uses: vicamo/actions-library/ubuntu-releases@v1
- name: Post Processing
id: processing
env:
DEBIAN_JSON: ${{ steps.debian.outputs.json }}
UBUNTU_JSON: ${{ steps.ubuntu.outputs.json }}
run: |
platforms='[
["amd64", "linux/amd64"],
["arm", "linux/arm"],
["arm64", "linux/arm64/v8"],
["armel", "linux/arm/v5"],
["armhf", "linux/arm/v7"],
["i386", "linux/386"],
["loong64", "linux/loong64"],
["mips64el", "linux/mips64le"],
["ppc64el", "linux/ppc64le"],
["riscv64", "linux/riscv64"],
["s390x", "linux/s390x"],
["mips", "linux/mips"],
["mipsel", "linux/mipsle"],
["powerpc", "linux/ppc"],
["ppc64", "linux/ppc64"],
["s390", "linux/s390"],
["sparc", "linux/sparc"],
["sparc64", "linux/sparc64"],
["x32", "linux/amd64p32"],
["alpha", "linux/alpha"],
["hppa", "linux/hppa"],
["m68k", "linux/m68k"],
["sh4", "linux/sh4"]
]'
disabled_codename='["experimental"]'
disabled_arches='[
"hurd-amd64",
"hurd-i386",
"ia64",
"kfreebsd-amd64",
"kfreebsd-i386",
"s390",
"x32"
]'
codenames="$({ echo "${DEBIAN_JSON}"; echo "${UBUNTU_JSON}"; } |
jq -s 'map(.[])' |
jq -c -M 'map(select(.codename as $c |
'"${disabled_codename}"' |
index($c) == null)) |
map(. as $s |
$s.mirrors[0].pockets[$s.codename].architectures as $da |
$s |
{
"distribution":.distribution,
"codename":.codename,
"suite":.suite,
"active":.active,
"architectures":(.architectures - '"${disabled_arches}"' |
map({
"arch":.,
"platform":(. as $arch |
'"${platforms}"' |
map(select(.[0] == $arch))[0][1]),
}) |
tostring)
})')"
case "${{ inputs.wanted || 'sid' }}" in
all) ;;
active)
codenames="$(echo "${codenames}" | jq -c -M 'map(select(.active))')"
;;
eol)
codenames="$(echo "${codenames}" | jq -c -M 'map(select(.active | not))')"
;;
*)
wanted="$(echo "${{ inputs.wanted || 'sid' }}" | sed 's/ //g; s/\([^,]\+\)/"\1"/g')"
codenames="$(echo "${codenames}" |
jq -c -M 'map(. as $row |
['"${wanted}"'] | .[] | select($row.codename == .) |
$row)')"
;;
esac
echo "::group::Built JSON(codenames)"
echo "${codenames}" | jq
echo "::endgroup::"
echo "codenames=${codenames}" | tee -a "${GITHUB_OUTPUT}"
build:
needs: generate-jobs
strategy:
fail-fast: false
max-parallel: 1
matrix:
include: ${{ fromJson(needs.generate-jobs.outputs.codenames) }}
name: Build
runs-on: ubuntu-latest
env:
DISTRO: ${{ matrix.distribution }}
CODENAME: ${{ matrix.codename }}
SUITE: ${{ matrix.suite }}
REPOSITORY: 'vicamo/buildpack-deps'
DRY_RUN: ${{ github.ref_name != 'main' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Apply templates
run: |
if [ ! -e "${DISTRO}/${CODENAME}/Dockerfile" ]; then
./versions.sh "${DISTRO}/${CODENAME}"
./apply-templates.sh "${DISTRO}/${CODENAME}"
fi
- name: Set up QEMU (Ubuntu)
run: |
sudo apt-get update -q
sudo apt-get install -yq binfmt-support qemu-user-static
ls -al /proc/sys/fs/binfmt_misc
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.12.0
- name: Login to Docker Hub
if: ${{ github.ref_name == 'main' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prepare
id: prepare
run: |
set -x
builder_platforms_json="[$(docker buildx inspect|grep ^Platforms:|cut -d: -f2|tr -d \*|sed 's/\([^ ,]\+\)/"\1"/g')]"
architectures_json="$(echo '${{ matrix.architectures }}' |
jq -c -M 'map(select(.platform as $c |
'"${builder_platforms_json}"' |
index($c) != null)
)')"
platforms="$(echo "${architectures_json}" | jq -r 'map(.platform)|join(",")')"
echo "platforms=${platforms}" | tee -a "${GITHUB_OUTPUT}"
- name: Docker meta for curl images
id: meta-curl
uses: docker/metadata-action@v5
with:
images: ${{ env.REPOSITORY }}
tags: |
${{ matrix.codename }}-curl
${{ matrix.suite && format('{0}-curl', matrix.suite) || '' }}
${{ matrix.suite == 'stable' && 'latest-curl' || '' }}
flavor: |
latest=false
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Build curl images
id: build-curl
uses: docker/build-push-action@v5
with:
annotations: ${{ contains(steps.prepare.outputs.platforms, ',') && steps.meta-curl.outputs.annotations || '' }}
build-args: |
BASEIMAGE=vicamo/${{ matrix.distribution }}:${{ matrix.codename }}
context: ${{ matrix.distribution }}/${{ matrix.codename }}/curl
labels: ${{ steps.meta-curl.outputs.labels }}
load: true
platforms: ${{ steps.prepare.outputs.platforms }}
provenance: false
tags: ${{ steps.meta-curl.outputs.tags }}
- name: Docker meta for scm images
id: meta-scm
uses: docker/metadata-action@v5
with:
images: ${{ matrix.repository }}
tags: |
${{ matrix.codename }}-scm
${{ matrix.suite && format('{0}-scm', matrix.suite) || '' }}
${{ matrix.suite == 'stable' && 'latest-scm' || '' }}
flavor: |
latest=false
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Build scm images
id: build-scm
uses: docker/build-push-action@v5
with:
annotations: ${{ contains(steps.prepare.outputs.platforms, ',') && steps.meta-scm.outputs.annotations || '' }}
build-args: |
BASEIMAGE=${{ env.REPOSITORY }}:${{ matrix.codename }}-curl
context: ${{ matrix.distribution }}/${{ matrix.codename }}/scm
labels: ${{ steps.meta-scm.outputs.labels }}
load: true
platforms: ${{ steps.prepare.outputs.platforms }}
provenance: false
tags: ${{ steps.meta-scm.outputs.tags }}