Skip to content

Commit e147ab8

Browse files
committed
clk rebase ga wip
1 parent bbb6051 commit e147ab8

File tree

1 file changed

+226
-0
lines changed

1 file changed

+226
-0
lines changed

.github/workflows/clk-rebase.yml

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
name: CLK Rebase
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- stable_6.*.y
7+
- clk-rebase-ga
8+
9+
jobs:
10+
clk-rebase:
11+
runs-on: kernel-build
12+
container:
13+
image: rockylinux:9
14+
options: --cpus 8 --privileged
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
# For push events, use the branch that triggered the workflow
18+
# For manual dispatch, default to stable_6.12.y
19+
#STABLE_TRACKING_BRANCH: ${{ github.ref_name || 'stable_6.12.y' }}
20+
STABLE_TRACKING_BRANCH: ${{ 'stable_6.12.y' }}
21+
steps:
22+
- name: Set version variables
23+
run: |
24+
# Extract version from STABLE_TRACKING_BRANCH (e.g., stable_6.12.y -> 6.12.y)
25+
STABLE_BASE_VERSION=$(echo "$STABLE_TRACKING_BRANCH" | sed 's/^stable_//')
26+
echo "STABLE_BASE_VERSION=$STABLE_BASE_VERSION" >> $GITHUB_ENV
27+
28+
# Construct branch names from the base version
29+
echo "CLK_BRANCH=ciq-$STABLE_BASE_VERSION" >> $GITHUB_ENV
30+
echo "CLK_NEXT_BRANCH=ciq-${STABLE_BASE_VERSION}-next" >> $GITHUB_ENV
31+
echo "TMP_CLK_NEXT_BRANCH={automation_tmp}_ciq-${STABLE_BASE_VERSION}-next" >> $GITHUB_ENV
32+
33+
- name: Install system dependencies
34+
run: |
35+
dnf install epel-release -y
36+
dnf groupinstall 'Development Tools' -y
37+
dnf install --enablerepo=crb bc dwarves elfutils-libelf-devel grubby grub2-tools iproute kernel-devel openssl-devel qemu-kvm sudo virtme-ng -y
38+
39+
# so root can call sudo without complaint
40+
echo "root ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
41+
42+
# Install GitHub CLI
43+
dnf install 'dnf-command(config-manager)' -y
44+
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
45+
dnf install gh -y
46+
47+
# the vm has curl-minimal installed. kernel_kselftest will balk when
48+
# it tries to install full curl later. Install the full version now
49+
# with --allowerasing
50+
dnf install curl --allowerasing -y
51+
52+
- name: Checkout kernel-src-tree
53+
uses: actions/checkout@v4
54+
with:
55+
repository: ctrliq/kernel-src-tree
56+
token: ${{ secrets.GITHUB_TOKEN }}
57+
path: kernel-src-tree
58+
fetch-depth: 0
59+
60+
- name: Checkout kernel-src-tree-tools
61+
uses: actions/checkout@v4
62+
with:
63+
repository: ctrliq/kernel-src-tree-tools
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
path: kernel-src-tree-tools
66+
67+
- name: Configure git
68+
run: |
69+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
70+
git config --global user.name "github-actions[bot]"
71+
72+
- name: Perform rebase
73+
run: |
74+
cd kernel-src-tree
75+
76+
git checkout $STABLE_TRACKING_BRANCH
77+
git checkout $CLK_BRANCH
78+
79+
../kernel-src-tree-tools/lt_rebase.sh
80+
81+
- name: Build kernel
82+
run: |
83+
cd kernel-src-tree
84+
85+
# need some config tweaks for vng
86+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VSOCKETS
87+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_VSOCKETS
88+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_VSOCKETS_COMMON
89+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P
90+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P_FD
91+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P_VIRTIO
92+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_FAILOVER
93+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_BLK_DEV_SD
94+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_SCSI_VIRTIO
95+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_NET
96+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_FAILOVER
97+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_CONSOLE
98+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_I6300ESB_WDT
99+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_BALLOON
100+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_MMIO
101+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_FUSE_FS
102+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_FS
103+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_OVERLAY_FS
104+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NETFS_SUPPORT
105+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_9P_FS
106+
107+
../kernel-src-tree-tools/kernel_build.sh --skip-kabi --no-reboot | tee ../build.log
108+
109+
- name: Install test dependencies
110+
run: |
111+
# work around install issue with iputils
112+
dnf install -y --setopt=tsflags=nocaps iputils
113+
114+
# should be installed in kernel_kselftest.sh
115+
dnf install -y python3-pyyaml python3-jsonschema
116+
117+
- name: Run selftests
118+
run: |
119+
cd kernel-src-tree
120+
121+
# HACK HACK HACK net/forwarding takes forever, skip it
122+
sed -i 's/SKIP_TARGETS="lkdtm"/SKIP_TARGETS="lkdtm net\/forwarding"/g' ../kernel-src-tree-tools/kernel_kselftest.sh
123+
124+
vng --qemu /usr/libexec/qemu-kvm --force-initramfs --disable-microvm --rw --network user --verbose --memory 16G -- ../kernel-src-tree-tools/kernel_kselftest.sh
125+
126+
# HACK HACK HACK
127+
#vng --qemu /usr/libexec/qemu-kvm --force-initramfs --disable-microvm --rw --network user --verbose --memory 16G -- sh -c 'mkdir ../kselftest-logs ; echo ok foo:bar > ../kselftest-logs/selftest-$(uname -r).log'
128+
129+
- name: Extract results and push branches
130+
run: |
131+
cd kernel-src-tree
132+
133+
echo "Selftests passed:"
134+
OK_TESTS=$(grep -a ^ok ../kselftest-logs/selftest* | wc -l)
135+
echo $OK_TESTS
136+
137+
# Extract the stable version we rebased onto
138+
STABLE_VERSION=$(git log -1 --format=%s $STABLE_TRACKING_BRANCH | grep -oP 'Linux \K[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
139+
echo "Rebased to stable version: $STABLE_VERSION"
140+
141+
# Push the branches
142+
git push origin $CLK_NEXT_BRANCH
143+
git push origin $TMP_CLK_NEXT_BRANCH
144+
145+
# Check for config changes
146+
# Look for a commit at HEAD with message like "[CIQ] v6.12.29 - rebased configs"
147+
# that matches the stable version we're rebasing onto
148+
HEAD_COMMIT_MSG=$(git log -1 --format=%s HEAD)
149+
if echo "$HEAD_COMMIT_MSG" | grep -qF "[CIQ] v${STABLE_VERSION} - rebased configs"; then
150+
echo "Config change commit detected for v${STABLE_VERSION}"
151+
# Extract the config changes from the commit
152+
git show HEAD --stat > ../config_changes.txt
153+
else
154+
echo "No config change commit detected for v${STABLE_VERSION}"
155+
echo "None" > ../config_changes.txt
156+
fi
157+
158+
# Save data for PR creation
159+
echo "$STABLE_VERSION" > ../stable_version.txt
160+
echo "$OK_TESTS" > ../ok_tests.txt
161+
162+
- name: Upload selftest logs
163+
if: always()
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: kselftest-logs
167+
path: kselftest-logs/selftest*
168+
if-no-files-found: warn
169+
170+
- name: Upload build log
171+
if: always()
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: build-log
175+
path: build.log
176+
if-no-files-found: warn
177+
178+
- name: Create Pull Request
179+
if: success()
180+
run: |
181+
cd kernel-src-tree
182+
183+
STABLE_VERSION=$(cat ../stable_version.txt)
184+
OK_TESTS=$(cat ../ok_tests.txt)
185+
CONFIG_CHANGES=$(cat ../config_changes.txt)
186+
187+
# Extract abbreviated build log (first 20 and last 20 lines)
188+
#BUILD_LOG_SUMMARY=$(head -20 ../build.log && echo "" && echo "[snip]" && echo "" && tail -20 ../build.log)
189+
BUILD_LOG_SUMMARY=$(egrep -B 5 -A 5 "\[TIMER\]|^Starting Build" ../build.log)
190+
191+
# Get artifact URLs (will be available after workflow completes)
192+
RUN_ID="${{ github.run_id }}"
193+
REPO="${{ github.repository }}"
194+
SELFTEST_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
195+
BUILD_LOG_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
196+
197+
# Create PR body
198+
cat > /tmp/pr_body.md <<EOF
199+
## Automated Rebase to v${STABLE_VERSION}
200+
201+
### Config Changes
202+
\`\`\`
203+
${CONFIG_CHANGES}
204+
\`\`\`
205+
206+
### Build Log
207+
\`\`\`
208+
${BUILD_LOG_SUMMARY}
209+
\`\`\`
210+
211+
### Testing
212+
Selftests passed: **${OK_TESTS}** tests
213+
214+
### Artifacts
215+
- [Build Log](${BUILD_LOG_ARTIFACT_URL})
216+
- [Selftest Logs](${SELFTEST_ARTIFACT_URL})
217+
218+
EOF
219+
220+
# Create the PR
221+
gh pr create \
222+
--title "TESTING TESTING TESTING [CIQ 6.12] Rebase to v${STABLE_VERSION}" \
223+
--body-file /tmp/pr_body.md \
224+
--base ${CLK_NEXT_BRANCH} \
225+
--head ${TMP_CLK_NEXT_BRANCH}
226+

0 commit comments

Comments
 (0)