Skip to content

Commit e4ef422

Browse files
committed
github actions: Replace CLK rebase virtme-ng build/test with multiarch pipeline
Now that the multiarch build and test pipeline is enabled for ciq-6.18.y and ciq-6.12.y branches, the bespoke virtme-ng build, kselftest, and PR creation logic in clk-rebase.yml is no longer needed. All CLK rebase needs to do is push the appropriately named branches; the multiarch pipeline picks them up and handles building, testing, and PR creation.
1 parent 2b9ef31 commit e4ef422

1 file changed

Lines changed: 7 additions & 222 deletions

File tree

.github/workflows/clk-rebase.yml

Lines changed: 7 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ on:
77

88
permissions:
99
contents: write
10-
pull-requests: write
1110

1211
jobs:
1312
clk-rebase:
1413
runs-on: kernel-build
1514
container:
1615
image: rockylinux:9
17-
options: --cpus 8 --privileged
1816
env:
1917
# For repository_dispatch events, use the branch from the payload
2018
# For workflow_dispatch, default to stable_6.18.y
@@ -55,25 +53,7 @@ jobs:
5553
- name: Install system dependencies
5654
run: |
5755
dnf install epel-release -y
58-
dnf groupinstall 'Development Tools' -y
59-
dnf install --enablerepo=crb bc dwarves elfutils-libelf-devel grubby grub2-tools iproute jq kernel-devel openssl-devel python3-GitPython qemu-kvm sudo virtme-ng -y
60-
61-
# kernel_kselftest.sh calls sudo even when running as root
62-
# Allow sudo to work without warnings in these cases
63-
echo "root ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
64-
65-
# Install GitHub CLI
66-
dnf install 'dnf-command(config-manager)' -y
67-
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
68-
dnf install gh -y
69-
70-
# the vm has curl-minimal installed. kernel_kselftest will balk when
71-
# it tries to install full curl later. Install the full version now
72-
# with --allowerasing
73-
dnf install curl --allowerasing -y
74-
75-
# work around install issue with iputils under vng
76-
dnf install -y --setopt=tsflags=nocaps iputils
56+
dnf install -y git python3-GitPython
7757
7858
- name: Checkout kernel-src-tree
7959
uses: actions/checkout@v4
@@ -113,212 +93,17 @@ jobs:
11393
11494
echo "Rebase completed successfully"
11595
116-
- name: Build kernel
117-
run: |
118-
set -e # Exit on any error
119-
cd kernel-src-tree
120-
121-
# need some config tweaks for vng
122-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VSOCKETS
123-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_VSOCKETS
124-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_VSOCKETS_COMMON
125-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P
126-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P_FD
127-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P_VIRTIO
128-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_FAILOVER
129-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_BLK_DEV_SD
130-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_SCSI_VIRTIO
131-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_NET
132-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_FAILOVER
133-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_CONSOLE
134-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_I6300ESB_WDT
135-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_BALLOON
136-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_MMIO
137-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_FUSE_FS
138-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_FS
139-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_OVERLAY_FS
140-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NETFS_SUPPORT
141-
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_9P_FS
142-
143-
../kernel-src-tree-tools/kernel_build.sh --skip-kabi --no-reboot | tee ../build.log
144-
145-
- name: Run selftests
146-
run: |
147-
set -e # Exit on any error
148-
cd kernel-src-tree
149-
150-
vng --qemu /usr/libexec/qemu-kvm --force-initramfs --disable-microvm --rw --network user --verbose --memory 16G -- ../kernel-src-tree-tools/kernel_kselftest.sh
151-
152-
- name: Generate fresh token for push and PR
153-
id: generate-push-token
154-
uses: actions/create-github-app-token@v1
155-
with:
156-
app-id: ${{ secrets.APP_ID }}
157-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
158-
repositories: |
159-
kernel-src-tree
160-
161-
- name: Extract results and push branches
162-
env:
163-
PUSH_TOKEN: ${{ steps.generate-push-token.outputs.token }}
96+
- name: Push branches
16497
run: |
16598
set -e # Exit on any error
16699
cd kernel-src-tree
167100
168-
echo "Selftests passed:"
169-
OK_TESTS=$(grep -a ^ok ../kselftest-logs/selftest* 2>/dev/null | wc -l || echo "0")
170-
echo $OK_TESTS
171-
172-
# Extract the stable version we rebased onto
173-
STABLE_VERSION=$(git log -1 --format=%s $STABLE_TRACKING_BRANCH | grep -oP 'Linux \K[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
174-
echo "Rebased to stable version: $STABLE_VERSION"
175-
176-
# Clear any cached credentials
101+
# Clear any cached credentials and configure the token for push
177102
git config --unset-all http.https://github.com/.extraheader || true
103+
git config --global url."https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/".insteadOf "https://github.com/"
178104
179-
# Configure git to use the token via URL insteadOf (GitHub Actions recommended method)
180-
git config --global url."https://x-access-token:${PUSH_TOKEN}@github.com/".insteadOf "https://github.com/"
181-
182-
# Push the branches
105+
# Push base branch first so it exists as a PR target
183106
git push origin $CLK_NEXT_BRANCH
184-
git push origin $TMP_CLK_NEXT_BRANCH
185-
186-
# Check for config changes
187-
# Look for a commit at HEAD with message like "[CIQ] v6.12.29 - rebased configs"
188-
# that matches the stable version we're rebasing onto
189-
HEAD_COMMIT_MSG=$(git log -1 --format=%s HEAD)
190-
if echo "$HEAD_COMMIT_MSG" | grep -qF "[CIQ] v${STABLE_VERSION} - rebased configs"; then
191-
echo "Config change commit detected for v${STABLE_VERSION}"
192-
# Extract the config changes from the commit
193-
git show HEAD --stat > ../config_changes.txt
194-
else
195-
echo "No config change commit detected for v${STABLE_VERSION}"
196-
echo "None" > ../config_changes.txt
197-
fi
198-
199-
# Save data for PR creation
200-
echo "$STABLE_VERSION" > ../stable_version.txt
201-
echo "$OK_TESTS" > ../ok_tests.txt
202-
203-
- name: Upload selftest logs
204-
if: always()
205-
uses: actions/upload-artifact@v4
206-
with:
207-
name: kselftest-logs
208-
path: kselftest-logs/selftest*
209-
if-no-files-found: warn
210-
211-
- name: Upload build log
212-
if: always()
213-
uses: actions/upload-artifact@v4
214-
with:
215-
name: build-log
216-
path: build.log
217-
if-no-files-found: warn
218-
219-
- name: Fetch previous PR kselftest results
220-
if: success()
221-
env:
222-
GH_TOKEN: ${{ steps.generate-push-token.outputs.token }}
223-
run: |
224-
set -e # Exit on any error
225-
cd kernel-src-tree
226-
227-
# Extract the major.minor version for matching (e.g., "6.12" from "6.12.y")
228-
CLK_VERSION=$(echo "$STABLE_BASE_VERSION" | grep -oP '^\d+\.\d+')
229-
echo "Looking for previous [CIQ ${CLK_VERSION}] PR..."
230-
231-
# Find the most recent merged PR to the same base branch with matching CIQ version
232-
if PREVIOUS_PR=$(gh pr list \
233-
--repo ${{ github.repository }} \
234-
--base ${CLK_NEXT_BRANCH} \
235-
--state merged \
236-
--limit 10 \
237-
--json number,title,body,mergedAt \
238-
--jq "map(select(.title | contains(\"[CIQ ${CLK_VERSION}]\"))) | sort_by(.mergedAt) | reverse | .[0]" 2>&1); then
239-
240-
if [ -n "$PREVIOUS_PR" ] && [ "$PREVIOUS_PR" != "null" ]; then
241-
# Extract the test count from the previous PR body
242-
PREVIOUS_PR_BODY=$(echo "$PREVIOUS_PR" | jq -r '.body')
243-
PREVIOUS_OK_TESTS=$(echo "$PREVIOUS_PR_BODY" | grep -oP 'Selftests passed:\s+\*\*\K[0-9]+' || echo "unknown")
244-
PREVIOUS_PR_NUMBER=$(echo "$PREVIOUS_PR" | jq -r '.number')
245-
246-
echo "Found previous PR #${PREVIOUS_PR_NUMBER} with ${PREVIOUS_OK_TESTS} passing tests"
247-
echo "$PREVIOUS_OK_TESTS" > ../previous_ok_tests.txt
248-
echo "$PREVIOUS_PR_NUMBER" > ../previous_pr_number.txt
249-
else
250-
echo "No previous [CIQ ${CLK_VERSION}] PR found"
251-
echo "unknown" > ../previous_ok_tests.txt
252-
echo "N/A" > ../previous_pr_number.txt
253-
fi
254-
else
255-
echo "WARNING: Failed to fetch previous PR information: $PREVIOUS_PR"
256-
echo "unknown" > ../previous_ok_tests.txt
257-
echo "N/A" > ../previous_pr_number.txt
258-
fi
259-
260-
- name: Create Pull Request
261-
if: success()
262-
env:
263-
GH_TOKEN: ${{ steps.generate-push-token.outputs.token }}
264-
run: |
265-
set -e # Exit on any error
266-
cd kernel-src-tree
267-
268-
STABLE_VERSION=$(cat ../stable_version.txt)
269-
OK_TESTS=$(cat ../ok_tests.txt)
270-
CONFIG_CHANGES=$(cat ../config_changes.txt)
271-
PREVIOUS_OK_TESTS=$(cat ../previous_ok_tests.txt)
272-
PREVIOUS_PR_NUMBER=$(cat ../previous_pr_number.txt)
273-
274-
# Extract the major.minor version for the PR title (e.g., "6.12" from "6.12.y")
275-
CLK_VERSION=$(echo "$STABLE_BASE_VERSION" | grep -oP '^\d+\.\d+')
276-
277-
# Extract abbreviated build log (first 20 and last 20 lines)
278-
BUILD_LOG_SUMMARY=$(egrep -B 5 -A 5 "\[TIMER\]|^Starting Build" ../build.log)
279-
280-
# Get artifact URLs (will be available after workflow completes)
281-
RUN_ID="${{ github.run_id }}"
282-
REPO="${{ github.repository }}"
283-
SELFTEST_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
284-
BUILD_LOG_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
285-
286-
# Build previous test results line if available
287-
if [ "$PREVIOUS_OK_TESTS" != "unknown" ] && [ "$PREVIOUS_PR_NUMBER" != "N/A" ]; then
288-
PREVIOUS_TEST_LINE="Previous: ${PREVIOUS_OK_TESTS} tests ([PR #${PREVIOUS_PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PREVIOUS_PR_NUMBER}))"
289-
else
290-
PREVIOUS_TEST_LINE=""
291-
fi
292-
293-
# Create PR body
294-
cat > /tmp/pr_body.md <<EOF
295-
## Automated Rebase to v${STABLE_VERSION}
296-
297-
### Config Changes
298-
\`\`\`
299-
${CONFIG_CHANGES}
300-
\`\`\`
301-
302-
### Build Log
303-
\`\`\`
304-
${BUILD_LOG_SUMMARY}
305-
\`\`\`
306-
307-
### Testing
308-
Selftests passed: **${OK_TESTS}** tests
309-
${PREVIOUS_TEST_LINE}
310-
311-
### Artifacts
312-
- [Build Log](${BUILD_LOG_ARTIFACT_URL})
313-
- [Selftest Logs](${SELFTEST_ARTIFACT_URL})
314-
315-
EOF
316-
317-
# Create the PR
318-
gh pr create \
319-
--title "[CIQ ${CLK_VERSION}] Rebase to v${STABLE_VERSION}" \
320-
--body-file /tmp/pr_body.md \
321-
--base ${CLK_NEXT_BRANCH} \
322-
--head ${TMP_CLK_NEXT_BRANCH} \
323-
--reviewer bmastbergen
324107
108+
# Push automation branch — this triggers the multiarch build/test pipeline
109+
git push origin $TMP_CLK_NEXT_BRANCH

0 commit comments

Comments
 (0)