Skip to content

Commit 2af0661

Browse files
committed
ci: work in container-local /build instead of bind-mounted workspace
1 parent 980e91e commit 2af0661

1 file changed

Lines changed: 26 additions & 33 deletions

File tree

.github/workflows/kernel-beta-update.yml

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,49 +46,39 @@ concurrency:
4646

4747
jobs:
4848
# Gate the heavy trixie job on whether extra/git_hash actually moved.
49-
# The on.push trigger has no paths: filter because GitHub's path filter
50-
# silently drops matches outside the first 300 changed files in a diff
51-
# (kernel bumps routinely change 18k+ files via modules/), so a
52-
# workflow-level filter would miss real kernel-shipping commits.
49+
# Compares the file's content at the push's parent and tip via
50+
# raw.githubusercontent.com - no checkout needed, nothing touches the
51+
# workspace.
5352
detect:
5453
runs-on: [self-hosted, linux, linux-bridge]
54+
container:
55+
image: debian:stable
5556
outputs:
5657
run: ${{ steps.check.outputs.run }}
5758
steps:
58-
- if: github.event_name == 'push'
59-
uses: actions/checkout@v6
60-
with:
61-
fetch-depth: 1
62-
sparse-checkout: extra/git_hash
63-
sparse-checkout-cone-mode: false
6459
- id: check
6560
env:
6661
BEFORE: ${{ github.event.before }}
6762
run: |
63+
apt-get update -qq
64+
apt-get install -y -qq --no-install-recommends curl
6865
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
6966
echo "run=true" >> "$GITHUB_OUTPUT"
7067
exit 0
7168
fi
72-
# First push to the branch -> no previous state to compare.
7369
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
7470
echo "first push to branch; treating as changed"
7571
echo "run=true" >> "$GITHUB_OUTPUT"
7672
exit 0
7773
fi
78-
# Fetch just the previous tip, shallow. If it isn't reachable
79-
# (force-push, history rewrite, etc.) fall back to running.
80-
if ! git fetch --depth=1 origin "$BEFORE" 2>/dev/null; then
81-
echo "before SHA $BEFORE unreachable; treating as changed"
82-
echo "run=true" >> "$GITHUB_OUTPUT"
83-
exit 0
84-
fi
85-
before_blob=$(git ls-tree FETCH_HEAD -- extra/git_hash | awk '{print $3}')
86-
after_blob=$(git ls-tree HEAD -- extra/git_hash | awk '{print $3}')
87-
if [ "$before_blob" = "$after_blob" ]; then
74+
url="https://raw.githubusercontent.com/${{ github.repository }}"
75+
before=$(curl -fsSL "$url/$BEFORE/extra/git_hash" 2>/dev/null | tr -d '[:space:]')
76+
after=$(curl -fsSL "$url/${{ github.sha }}/extra/git_hash" 2>/dev/null | tr -d '[:space:]')
77+
if [ -n "$after" ] && [ "$before" = "$after" ]; then
8878
echo "extra/git_hash unchanged across this push; skipping"
8979
echo "run=false" >> "$GITHUB_OUTPUT"
9080
else
91-
echo "extra/git_hash changed; proceeding"
81+
echo "extra/git_hash changed (or could not be fetched); proceeding"
9282
echo "run=true" >> "$GITHUB_OUTPUT"
9383
fi
9484
@@ -114,55 +104,58 @@ jobs:
114104
DEBFULLNAME: ${{ vars.CI_AUTHOR_NAME }}
115105
DEBEMAIL: ${{ vars.CI_AUTHOR_EMAIL }}
116106
steps:
107+
# All file work happens under /build (container-local). The bind-mounted
108+
# workspace stays empty so host-side cleanup never has to fight
109+
# root-owned files left behind by the container.
117110
- name: Install dependencies
118111
run: |
119112
apt-get update -qq
120113
apt-get install -y -qq --no-install-recommends \
114+
curl \
121115
devscripts \
122116
git \
123117
git-buildpackage \
124118
python3-minimal \
125119
quilt
120+
mkdir -p /build
126121
127122
- name: Sync bridge from GitLab
123+
working-directory: /build
128124
env:
129125
BRIDGE_PROJECT: ${{ secrets.BRIDGE_PROJECT }}
130126
BRIDGE_TOKEN: ${{ secrets.BRIDGE_TOKEN }}
131127
run: |
132128
host="${GITLAB_BASE#https://}"
133129
clone_url="https://oauth2:${BRIDGE_TOKEN}@${host}/${BRIDGE_PROJECT}.git"
134-
find . -mindepth 1 -delete 2>/dev/null || true
135-
git clone --depth 1 "$clone_url" .
136-
137-
- name: Checkout extra/git_hash
138-
uses: actions/checkout@v6
139-
with:
140-
sparse-checkout: extra/git_hash
141-
sparse-checkout-cone-mode: false
142-
path: firmware
130+
git clone --depth 1 "$clone_url" bridge
143131
144132
- name: Resolve kernel ref
145133
id: kernel
134+
working-directory: /build
146135
run: |
147136
if [ -n "${{ inputs.ref }}" ]; then
148137
ref="${{ inputs.ref }}"
149138
else
150-
ref=$(tr -d '[:space:]' < firmware/extra/git_hash)
139+
ref=$(curl -fsSL \
140+
"https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/extra/git_hash" \
141+
| tr -d '[:space:]')
151142
fi
152143
[ -n "$ref" ] || { echo "no kernel ref resolved" >&2; exit 1; }
153144
echo "ref=$ref" >> "$GITHUB_OUTPUT"
154145
155146
- name: Sync linux-packaging from GitLab
147+
working-directory: /build
156148
run: |
157149
host="${GITLAB_BASE#https://}"
158150
clone_url="https://oauth2:${GITLAB_TOKEN}@${host}/${GITLAB_PROJECT}.git"
159151
git clone "$clone_url" linux-packaging
160152
161153
- name: Run bridge
154+
working-directory: /build
162155
run: |
163156
git config --global --add safe.directory "$LINUX_SRC"
164157
git -C "$LINUX_SRC" fetch --all --tags --prune
165-
./bridge beta \
158+
./bridge/bridge beta \
166159
${{ inputs.dry_run && '--dry-run' || '' }} \
167160
--packaging ./linux-packaging \
168161
--linux "$LINUX_SRC" \

0 commit comments

Comments
 (0)