Skip to content

Commit 87ea328

Browse files
committed
Restructure how we manage ubuntu releases
1 parent e7da0f3 commit 87ea328

File tree

100 files changed

+874
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+874
-193
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -15,72 +15,11 @@ updates:
1515
docker-actions:
1616
patterns:
1717
- docker/*
18-
- package-ecosystem: github-actions
19-
directory: /
20-
target-branch: release/jammy
21-
schedule:
22-
interval: daily
23-
time: '04:00'
24-
timezone: America/Toronto
25-
rebase-strategy: auto
26-
labels:
27-
- auto
28-
- dependencies
29-
- github-actions
30-
groups:
31-
docker-actions:
32-
patterns:
33-
- docker/*
34-
- package-ecosystem: github-actions
35-
directory: /
36-
target-branch: release/focal
37-
schedule:
38-
interval: daily
39-
time: '04:00'
40-
timezone: America/Toronto
41-
rebase-strategy: auto
42-
labels:
43-
- auto
44-
- dependencies
45-
- github-actions
46-
groups:
47-
docker-actions:
48-
patterns:
49-
- docker/*
5018
- package-ecosystem: docker
51-
directory: /
52-
schedule:
53-
interval: daily
54-
time: '04:00'
55-
timezone: America/Toronto
56-
cooldown:
57-
default-days: 7
58-
include:
59-
- ubuntu:*
60-
rebase-strategy: auto
61-
labels:
62-
- auto
63-
- dependencies
64-
- docker
65-
- package-ecosystem: docker
66-
directory: /
67-
target-branch: release/jammy
68-
schedule:
69-
interval: daily
70-
time: '04:00'
71-
timezone: America/Toronto
72-
cooldown:
73-
default-days: 7
74-
include:
75-
- ubuntu:*
76-
rebase-strategy: auto
77-
labels:
78-
- auto
79-
- dependencies
80-
- docker
81-
- package-ecosystem: docker
82-
directory: /
83-
target-branch: release/focal
19+
directories:
20+
- /releases/noble
21+
- /releases/jammy
22+
- /releases/focal
8423
schedule:
8524
interval: daily
8625
time: '04:00'

.github/labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
bash:
22
- changed-files:
33
- any-glob-to-any-file:
4-
- root/etc/s6-overlay/s6-rc.d/*/run
5-
- test/etc/s6-overlay/s6-rc.d/*/run
4+
- 'releases/*/root/etc/s6-overlay/s6-rc.d/*/run'
5+
- 'releases/*/test/root/etc/s6-overlay/s6-rc.d/*/run'
66
docker:
77
- changed-files:
88
- any-glob-to-any-file:

.github/scripts/update-packages.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
set -euo pipefail
44

5-
INSTALL_FILE="packages/generated/install.txt"
5+
RELEASE="${1:?Usage: $0 <release-dir>}"
6+
7+
INSTALL_FILE="${RELEASE}/packages/generated/install.txt"
68
DPKG_QUERY="dpkg-query -W -f '\${Package}=\${Version}\n'"
79

8-
BASE_IMAGE=$(sed -n 's/^FROM \(ubuntu:[a-z]*-[0-9]*\)$/\1/p' Dockerfile)
9-
REQUIRED=$(sed '/^$/d' packages/required.txt | tr '\n' ' ')
10-
TEMPORARY=$(sed '/^$/d' packages/temporary.txt | tr '\n' ' ')
10+
BASE_IMAGE=$(sed -n 's/^FROM \(ubuntu:[a-z]*-[0-9]*\)$/\1/p' "${RELEASE}/Dockerfile")
11+
REQUIRED=$(sed '/^$/d' "${RELEASE}/packages/required.txt" | tr '\n' ' ')
12+
TEMPORARY=$(sed '/^$/d' "${RELEASE}/packages/temporary.txt" | tr '\n' ' ')
1113

1214
# get base image package list
1315
BASE_LIST=$(

.github/workflows/backport.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/pull-request.yml

Lines changed: 73 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
11
name: Pull Request
2-
on:
3-
pull_request:
4-
branches:
5-
- main
6-
- release/*
2+
on: pull_request
73
permissions:
84
contents: read
95
defaults:
106
run:
117
shell: bash
128
concurrency:
13-
group: ${{github.event.pull_request.number}}
9+
group: ${{github.workflow_ref}}
1410
cancel-in-progress: true
1511
jobs:
12+
determine-releases:
13+
name: Determine Releases
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 5
16+
outputs:
17+
releases: ${{steps.releases.outputs.releases}}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v6.0.2
21+
- name: Determine releases
22+
id: releases
23+
run: |
24+
RELEASES=$(ls -d releases/*/ | xargs -n1 basename | jq -Rnc '[inputs]')
25+
echo "releases=${RELEASES}" >> "${GITHUB_OUTPUT}"
1626
check-packages:
1727
name: Check Packages
1828
runs-on: ubuntu-latest
1929
timeout-minutes: 10
2030
permissions:
2131
contents: write
2232
pull-requests: write
33+
needs:
34+
- determine-releases
35+
- check-base-image
2336
steps:
2437
- name: Checkout
2538
uses: actions/checkout@v6.0.2
2639
with:
2740
ref: ${{github.head_ref}}
2841
- name: Update packages
29-
id: updates
30-
run: bash .github/scripts/update-packages.sh
42+
run: |
43+
for RELEASE_DIR in releases/*/; do
44+
bash .github/scripts/update-packages.sh "${RELEASE_DIR%/}"
45+
done
3146
- name: Gather info
3247
id: info
3348
run: |
@@ -46,16 +61,38 @@ jobs:
4661
commit-message: ${{steps.info.outputs.title}}
4762
author: ${{steps.info.outputs.commit-author}}
4863
committer: ${{steps.info.outputs.commit-author}}
49-
add-paths: packages/generated/install.txt
64+
add-paths: releases/*/packages/generated/install.txt
5065
base: ${{github.event.pull_request.head.ref}}
5166
branch: auto/update-packages/pr-${{github.event.pull_request.number}}
5267
delete-branch: true
5368
draft: true
5469
title: ${{steps.info.outputs.title}}
55-
body: ${{steps.updates.outputs.update-body}}
70+
body: Automated package updates.
5671
labels: |
5772
dependencies
5873
auto
74+
check-base-image:
75+
name: Check Base Image
76+
runs-on: ubuntu-latest
77+
timeout-minutes: 5
78+
needs: determine-releases
79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v6.0.2
82+
- name: Verify base images match releases
83+
run: |
84+
for RELEASE_DIR in releases/*/; do
85+
RELEASE=$(basename "${RELEASE_DIR}")
86+
FROM_LINE=$(grep -E '^FROM ubuntu:' "${RELEASE_DIR}Dockerfile")
87+
IMAGE_TAG=${FROM_LINE#FROM ubuntu:}
88+
IMAGE_STREAM=${IMAGE_TAG%%-*}
89+
if [[ "${IMAGE_STREAM}" != "${RELEASE}" ]]; then
90+
echo "::error::Base image '${FROM_LINE}' does not match" \
91+
"release '${RELEASE}' (expected 'FROM ubuntu:${RELEASE}-...')"
92+
exit 1
93+
fi
94+
echo "Base image '${FROM_LINE}' matches release '${RELEASE}'"
95+
done
5996
check-formatting-all:
6097
name: Check Formatting (All)
6198
runs-on: ubuntu-latest
@@ -76,6 +113,8 @@ jobs:
76113
uses: actions/checkout@v6.0.2
77114
- name: Check formatting
78115
uses: hadolint/hadolint-action@v3.3.0
116+
with:
117+
recursive: true
79118
check-formatting-markdown:
80119
name: Check Formatting (Markdown)
81120
runs-on: ubuntu-latest
@@ -95,29 +134,28 @@ jobs:
95134
contents: read
96135
pull-requests: write
97136
needs:
137+
- determine-releases
138+
- check-base-image
98139
- check-packages
140+
strategy:
141+
fail-fast: false
142+
matrix:
143+
release: ${{fromJson(needs.determine-releases.outputs.releases)}}
99144
steps:
100145
- name: Checkout
101146
uses: actions/checkout@v6.0.2
102147
- name: Determine info
103148
id: info
104149
run: |
105-
PLATFORMS=(
106-
linux/amd64
107-
linux/arm/v7
108-
linux/arm64
109-
linux/ppc64le
110-
linux/riscv64
111-
linux/s390x
112-
)
113-
SAVE_IFS="$IFS"
114-
IFS=","
115-
PLATFORMS="${PLATFORMS[*]}"
116-
IFS="$SAVE_IFS"
150+
RELEASE_DIR="releases/${RELEASE}"
151+
PLATFORMS=$(paste -sd, "${RELEASE_DIR}/platforms.txt")
117152
TEMP_IMAGE='ci'
118153
echo "platforms=$PLATFORMS" >> $GITHUB_OUTPUT
119-
echo "ci-image-tag=$TEMP_IMAGE:image" >> $GITHUB_OUTPUT
120-
echo "ci-test-image-tag=$TEMP_IMAGE:test-image" >> $GITHUB_OUTPUT
154+
echo "ci-image-tag=$TEMP_IMAGE:${RELEASE}" >> $GITHUB_OUTPUT
155+
echo "ci-test-image-tag=$TEMP_IMAGE:${RELEASE}-test" >> $GITHUB_OUTPUT
156+
echo "release-dir=${RELEASE_DIR}" >> $GITHUB_OUTPUT
157+
env:
158+
RELEASE: ${{matrix.release}}
121159
- name: Set up Docker
122160
uses: docker/setup-docker-action@v5.0.0
123161
with:
@@ -130,22 +168,22 @@ jobs:
130168
- name: Build image
131169
uses: docker/build-push-action@v7.0.0
132170
with:
133-
context: .
171+
context: ./${{steps.info.outputs.release-dir}}
134172
platforms: ${{steps.info.outputs.platforms}}
135173
tags: ${{steps.info.outputs.ci-image-tag}}
136-
cache-from: type=gha
137-
cache-to: type=gha,mode=max
174+
cache-from: type=gha,scope=${{matrix.release}}
175+
cache-to: type=gha,scope=${{matrix.release}},mode=max
138176
load: true
139177
- name: Build test image
140178
uses: docker/build-push-action@v7.0.0
141179
with:
142-
context: ./test
180+
context: ./${{steps.info.outputs.release-dir}}/test
143181
build-contexts: |
144182
ci:image=docker-image://${{steps.info.outputs.ci-image-tag}}
145183
platforms: ${{steps.info.outputs.platforms}}
146184
tags: ${{steps.info.outputs.ci-test-image-tag}}
147-
cache-from: type=gha
148-
cache-to: type=gha,mode=max
185+
cache-from: type=gha,scope=${{matrix.release}}-test
186+
cache-to: type=gha,scope=${{matrix.release}}-test,mode=max
149187
load: true
150188
- name: Run tests
151189
run: >
@@ -164,13 +202,13 @@ jobs:
164202
- name: Hide outdated build details comments
165203
uses: int128/hide-comment-action@v1.53.0
166204
with:
167-
starts-with: <!-- build details -->
205+
starts-with: <!-- build details (${{matrix.release}}) -->
168206
- name: Create build details comment
169207
id: image-details
170208
run: |
171209
# Determine the remote image tag to compare against
172210
echo "::group::Determine remote image tag"
173-
VERSION=$(grep -E '^FROM ubuntu:[a-z]+-[0-9]+$' Dockerfile)
211+
VERSION=$(grep -E '^FROM ubuntu:[a-z]+-[0-9]+$' releases/${RELEASE}/Dockerfile)
174212
VERSION=${VERSION##*:}
175213
STREAM=${VERSION%-*}
176214
REMOTE_IMAGE_TAG=$REMOTE_IMAGE:$STREAM
@@ -185,7 +223,7 @@ jobs:
185223
fi
186224
echo "::endgroup::"
187225
# Build the comment body per platform
188-
BODY=$'<!-- build details -->\n\n'
226+
BODY=$'<!-- build details (${RELEASE}) -->\n\n'
189227
HAVE_REMOTE=true
190228
FAILED_PLATFORMS=()
191229
TOTAL_SIZE_NEW=0
@@ -269,7 +307,7 @@ jobs:
269307
elif (( OVERALL_DIFF < 0 )); then
270308
OVERALL_SIZE+=" \`$(echo $OVERALL_DIFF | numfmt $FMT)\`"
271309
fi
272-
BODY+=$'## Build Details\n\n'
310+
BODY+=$'## Build Details (${RELEASE})\n\n'
273311
if [[ "$HAVE_REMOTE" != "true" ]]; then
274312
BODY+=$'> [!WARNING]\n'
275313
BODY+=$'> Size comparison may be inaccurate.'
@@ -287,6 +325,7 @@ jobs:
287325
echo "::endgroup::"
288326
gh pr comment "$PULL_REQUEST_NUMBER" --body "$BODY"
289327
env:
328+
RELEASE: ${{matrix.release}}
290329
REMOTE_IMAGE: ghcr.io/${{github.repository_owner}}/base-ubuntu
291330
LOCAL_IMAGE_TAG: ${{steps.info.outputs.ci-image-tag}}
292331
PLATFORMS: ${{steps.info.outputs.platforms}}

0 commit comments

Comments
 (0)