Skip to content

Commit 19b6dea

Browse files
committed
clk rebase ga wip
1 parent bbb6051 commit 19b6dea

File tree

1 file changed

+222
-0
lines changed

1 file changed

+222
-0
lines changed

.github/workflows/clk-rebase.yml

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
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+
- name: Extract results and push branches
127+
run: |
128+
cd kernel-src-tree
129+
130+
echo "Selftests passed:"
131+
OK_TESTS=$(grep -a ^ok ../kselftest-logs/selftest* | wc -l)
132+
echo $OK_TESTS
133+
134+
# Extract the stable version we rebased onto
135+
STABLE_VERSION=$(git log -1 --format=%s $STABLE_TRACKING_BRANCH | grep -oP 'Linux \K[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
136+
echo "Rebased to stable version: $STABLE_VERSION"
137+
138+
# Push the branches
139+
git push origin $CLK_NEXT_BRANCH
140+
git push origin $TMP_CLK_NEXT_BRANCH
141+
142+
# Check for config changes
143+
# Look for a commit at HEAD with message like "[CIQ] v6.12.29 - rebased configs"
144+
# that matches the stable version we're rebasing onto
145+
HEAD_COMMIT_MSG=$(git log -1 --format=%s HEAD)
146+
if echo "$HEAD_COMMIT_MSG" | grep -qF "[CIQ] v${STABLE_VERSION} - rebased configs"; then
147+
echo "Config change commit detected for v${STABLE_VERSION}"
148+
# Extract the config changes from the commit
149+
git show HEAD --stat > ../config_changes.txt
150+
else
151+
echo "No config change commit detected for v${STABLE_VERSION}"
152+
echo "None" > ../config_changes.txt
153+
fi
154+
155+
# Save data for PR creation
156+
echo "$STABLE_VERSION" > ../stable_version.txt
157+
echo "$OK_TESTS" > ../ok_tests.txt
158+
159+
- name: Upload selftest logs
160+
if: always()
161+
uses: actions/upload-artifact@v4
162+
with:
163+
name: kselftest-logs
164+
path: kselftest-logs/selftest*
165+
if-no-files-found: warn
166+
167+
- name: Upload build log
168+
if: always()
169+
uses: actions/upload-artifact@v4
170+
with:
171+
name: build-log
172+
path: build.log
173+
if-no-files-found: warn
174+
175+
- name: Create Pull Request
176+
if: success()
177+
run: |
178+
cd kernel-src-tree
179+
180+
STABLE_VERSION=$(cat ../stable_version.txt)
181+
OK_TESTS=$(cat ../ok_tests.txt)
182+
CONFIG_CHANGES=$(cat ../config_changes.txt)
183+
184+
# Extract abbreviated build log (first 20 and last 20 lines)
185+
BUILD_LOG_SUMMARY=$(egrep -B 5 -A 5 "\[TIMER\]|^Starting Build" ../build.log)
186+
187+
# Get artifact URLs (will be available after workflow completes)
188+
RUN_ID="${{ github.run_id }}"
189+
REPO="${{ github.repository }}"
190+
SELFTEST_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
191+
BUILD_LOG_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
192+
193+
# Create PR body
194+
cat > /tmp/pr_body.md <<EOF
195+
## Automated Rebase to v${STABLE_VERSION}
196+
197+
### Config Changes
198+
\`\`\`
199+
${CONFIG_CHANGES}
200+
\`\`\`
201+
202+
### Build Log
203+
\`\`\`
204+
${BUILD_LOG_SUMMARY}
205+
\`\`\`
206+
207+
### Testing
208+
Selftests passed: **${OK_TESTS}** tests
209+
210+
### Artifacts
211+
- [Build Log](${BUILD_LOG_ARTIFACT_URL})
212+
- [Selftest Logs](${SELFTEST_ARTIFACT_URL})
213+
214+
EOF
215+
216+
# Create the PR
217+
gh pr create \
218+
--title "TESTING TESTING TESTING [CIQ 6.12] Rebase to v${STABLE_VERSION}" \
219+
--body-file /tmp/pr_body.md \
220+
--base ${CLK_NEXT_BRANCH} \
221+
--head ${TMP_CLK_NEXT_BRANCH}
222+

0 commit comments

Comments
 (0)