Skip to content

Commit 2adb6cb

Browse files
committed
Get CI build working again after forking
deal with github mysteriously running actions with "ubuntu-latest" not resolving to 24.04. check for current ubuntu version and only do bwrap fix it >= 24.04 also, patch flakey flex mirrors, which were not working
1 parent 4eceb77 commit 2adb6cb

File tree

4 files changed

+103
-5
lines changed

4 files changed

+103
-5
lines changed

.github/workflows/bwrap.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
# against a commit != HEAD with depth=1, it errors out.
2727
fetch-depth: 0
2828
- name: Work around Ubuntu 24.04 bubblewrap bug
29-
run: sudo cp .github/workflows/bwrap.apparmor /etc/apparmor.d/bwrap && sudo systemctl reload apparmor
29+
run: bash .github/workflows/ubuntu_bwrap_fix.sh
3030
- name: Query cache for sources
3131
id: cache
3232
uses: actions/cache/restore@v4
@@ -75,7 +75,7 @@ jobs:
7575
# against a commit != HEAD with depth=1, it errors out.
7676
fetch-depth: 0
7777
- name: Work around Ubuntu 24.04 bubblewrap bug
78-
run: sudo cp .github/workflows/bwrap.apparmor /etc/apparmor.d/bwrap && sudo systemctl reload apparmor
78+
run: bash .github/workflows/ubuntu_bwrap_fix.sh
7979
- name: Get pass1_image
8080
uses: actions/download-artifact@v4
8181
with:
@@ -130,7 +130,7 @@ jobs:
130130
# against a commit != HEAD with depth=1, it errors out.
131131
fetch-depth: 0
132132
- name: Work around Ubuntu 24.04 bubblewrap bug
133-
run: sudo cp .github/workflows/bwrap.apparmor /etc/apparmor.d/bwrap && sudo systemctl reload apparmor
133+
run: bash .github/workflows/ubuntu_bwrap_fix.sh
134134
- name: Get pass2_image
135135
uses: actions/download-artifact@v4
136136
with:
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# SPDX-FileCopyrightText: 2025 reshi <[email protected]>
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
# We need a handwave to make ubuntu happy in order to run bwrap
5+
# see https://etbe.coker.com.au/2024/04/24/ubuntu-24-04-bubblewrap/
6+
7+
# But, in some cases, it seems that 'ubuntu-latest' does not always
8+
# 'resolve' to 20.04, so we do some hand waves to check for
9+
# os version >= 20.04 (otherwise the build can die when
10+
# trying to apply bwrap.apparmor)
11+
12+
# Figure out current ubuntu version
13+
# https://manpages.ubuntu.com/manpages/noble/man5/os-release.5.html
14+
#
15+
# The /etc/os-release and /usr/lib/os-release files contain
16+
# operating system identification data.
17+
#
18+
# The format of os-release is a newline-separated list of
19+
# environment-like shell-compatible variable assignments.
20+
#
21+
# The file /etc/os-release takes precedence over /usr/lib/os-release.
22+
# Applications should check for the former,
23+
# and exclusively use its data if it exists,
24+
# and only fall back to /usr/lib/os-release if it is missing.
25+
#
26+
# VERSION_ID=
27+
# A lower-case string
28+
# (mostly numeric, no spaces or other characters outside of 0-9,
29+
# a-z, ".", "_" and "-")
30+
# identifying the operating system version,
31+
# excluding any OS name information or release code name,
32+
# and suitable for processing by scripts
33+
# or usage in generated filenames.
34+
# This field is optional.
35+
#
36+
# Examples: "VERSION_ID=17", "VERSION_ID=11.04".
37+
38+
# Check for /etc/os-release or fall back to /usr/lib/os-release
39+
if [ -f /etc/os-release ]; then
40+
OS_RELEASE_FILE="/etc/os-release"
41+
elif [ -f /usr/lib/os-release ]; then
42+
OS_RELEASE_FILE="/usr/lib/os-release"
43+
else
44+
echo "Error: Neither /etc/os-release nor /usr/lib/os-release found."
45+
exit 1
46+
fi
47+
48+
# Extract 'VERSION_ID=' line.
49+
VERSION_ID_LINE=$(grep '^VERSION_ID=' "$OS_RELEASE_FILE")
50+
if [ -z "$VERSION_ID_LINE" ]; then
51+
echo "Error: VERSION_ID not found in $OS_RELEASE_FILE."
52+
echo "Contents of $OS_RELEASE_FILE:"
53+
cat "$OS_RELEASE_FILE"
54+
exit 1
55+
fi
56+
57+
# Extract major/minor version
58+
if [[ "$VERSION_ID_LINE" =~ ^VERSION_ID=\"([0-9]+)\.([0-9]+)\"$ ]]; then
59+
# Matches 'VERSION_ID="major.minor"' (e.g., "24.04")
60+
MAJOR="${BASH_REMATCH[1]}"
61+
MINOR="${BASH_REMATCH[2]}"
62+
echo "Ubuntu version: $MAJOR.$MINOR"
63+
elif [[ "$VERSION_ID_LINE" =~ ^VERSION_ID=\"([0-9]+)\"$ ]]; then
64+
# Matches 'VERSION_ID="major"' (e.g., "24")
65+
MAJOR="${BASH_REMATCH[1]}"
66+
MINOR="0"
67+
echo "Ubuntu version: $MAJOR.$MINOR (no minor version specified)"
68+
else
69+
echo "Error: VERSION_ID is malformed in $OS_RELEASE_FILE."
70+
echo "VERSION_ID_LINE: \"$VERSION_ID_LINE\""
71+
exit 1
72+
fi
73+
74+
# Check for version >= 24.04, do workaround if so
75+
check_version_ge() {
76+
local major=$1
77+
local minor=$2
78+
(( MAJOR > major || (MAJOR == major && MINOR >= minor) ))
79+
}
80+
if check_version_ge 24 4; then
81+
echo "Ubuntu version is >= 24.04, deploying bwrap work-around..."
82+
sudo cp .github/workflows/bwrap.apparmor /etc/apparmor.d/bwrap || {
83+
echo "Failed to copy AppArmor profile";
84+
exit 1;
85+
}
86+
echo "Reloading AppArmor service..."
87+
sudo systemctl reload apparmor || {
88+
# error msg from 'systemctl reload apparmor'
89+
# suggests looking at the following...
90+
echo "Failed to reload AppArmor. Checking status...";
91+
systemctl status apparmor.service;
92+
echo "Checking logs...";
93+
journalctl -xeu apparmor.service;
94+
exit 1;
95+
}
96+
else
97+
echo "Ubuntu version is < 24.04, skipping bwrap work-around..."
98+
fi

steps/flex-2.5.11/sources

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.11.tar.gz bc79b890f35ca38d66ff89a6e3758226131e51ccbd10ef78d5ff150b7bd73689
1+
http://ftp-tel.sjtu.edu.cn/sites/ftp.openpkg.org/sources/DST/flex/flex-2.5.11.tar.gz bc79b890f35ca38d66ff89a6e3758226131e51ccbd10ef78d5ff150b7bd73689

steps/flex-2.5.33/sources

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.33.tar.gz c40385e142989c91989413f3c5a31282b2ffdca16b69cd3ecfde537b8a474921
1+
http://ftp-tel.sjtu.edu.cn/sites/ftp.openpkg.org/sources/DST/flex/flex-2.5.33.tar.gz c40385e142989c91989413f3c5a31282b2ffdca16b69cd3ecfde537b8a474921

0 commit comments

Comments
 (0)