Skip to content

Commit 1cb3dae

Browse files
committed
clk rebase ga wip
1 parent c555c31 commit 1cb3dae

File tree

1 file changed

+209
-0
lines changed

1 file changed

+209
-0
lines changed

.github/workflows/clk-rebase.yml

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
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.2
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: Clone repositories
53+
run: |
54+
git config --global user.email "[email protected]"
55+
git config --global user.name "Brett Mastbergen"
56+
57+
git clone https://oauth2:[email protected]/ctrliq/kernel-src-tree-tools
58+
git clone https://oauth2:[email protected]/ctrliq/kernel-src-tree
59+
60+
- name: Perform rebase
61+
run: |
62+
cd kernel-src-tree
63+
64+
git checkout $STABLE_TRACKING_BRANCH
65+
git checkout $CLK_BRANCH
66+
67+
../kernel-src-tree-tools/lt_rebase.sh
68+
69+
- name: Build kernel
70+
run: |
71+
cd kernel-src-tree
72+
73+
# need some config tweaks for vng
74+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VSOCKETS
75+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_VSOCKETS
76+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_VSOCKETS_COMMON
77+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VSOCKETS
78+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P
79+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P_FD
80+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_9P_VIRTIO
81+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_FAILOVER
82+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_BLK_SD_DEV
83+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_SCSI_VIRTIO
84+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_NET
85+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NET_FAILOVER
86+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_CONSOLE
87+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_I6300ESB_WDT
88+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_BALLOON
89+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_MMIO
90+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_FUSE_FS
91+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_VIRTIO_FS
92+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_OVERLAY_FS
93+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_NETFS_SUPPORT
94+
./scripts/config --file ./ciq/configs/kernel-x86_64.config --enable CONFIG_9P_FS
95+
96+
../kernel-src-tree-tools/kernel_build.sh --skip-kabi --no-reboot | tee ../build.log
97+
98+
- name: Install test dependencies
99+
run: |
100+
# should be installed in kernel_kselftest.sh
101+
dnf install conntrack-tools e2fsprogs ethtool fuse iptables iputils ipvsadm kernel-tools nftables teamd traceroute -y
102+
103+
- name: Run selftests
104+
run: |
105+
cd kernel-src-tree
106+
107+
vng --qemu /usr/libexec/qemu-kvm --force-initramfs --disable-microvm --rw --network user --verbose --memory 16G -- ../kernel-src-tree-tools/kernel_kselftest.sh
108+
109+
# HACK HACK HACK
110+
#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'
111+
112+
- name: Extract results and push branches
113+
run: |
114+
cd kernel-src-tree
115+
116+
echo "Selftests passed:"
117+
OK_TESTS=$(grep -a ^ok ../kselftest-logs/selftest* | wc -l)
118+
echo $OK_TESTS
119+
120+
# Extract the stable version we rebased onto
121+
STABLE_VERSION=$(git log -1 --format=%s $STABLE_TRACKING_BRANCH | grep -oP 'Linux \K[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
122+
echo "Rebased to stable version: $STABLE_VERSION"
123+
124+
# Push the branches
125+
git push origin $CLK_NEXT_BRANCH
126+
git push origin $TMP_CLK_NEXT_BRANCH
127+
128+
# Check for config changes
129+
# Look for a commit at HEAD with message like "[CIQ] v6.12.29 - rebased configs"
130+
# that matches the stable version we're rebasing onto
131+
HEAD_COMMIT_MSG=$(git log -1 --format=%s HEAD)
132+
if echo "$HEAD_COMMIT_MSG" | grep -qF "[CIQ] v${STABLE_VERSION} - rebased configs"; then
133+
echo "Config change commit detected for v${STABLE_VERSION}"
134+
# Extract the config changes from the commit
135+
git show HEAD --stat > ../config_changes.txt
136+
else
137+
echo "No config change commit detected for v${STABLE_VERSION}"
138+
echo "None" > ../config_changes.txt
139+
fi
140+
141+
# Save data for PR creation
142+
echo "$STABLE_VERSION" > ../stable_version.txt
143+
echo "$OK_TESTS" > ../ok_tests.txt
144+
145+
- name: Upload selftest logs
146+
if: always()
147+
uses: actions/upload-artifact@v4
148+
with:
149+
name: kselftest-logs
150+
path: kselftest-logs/selftest*
151+
if-no-files-found: warn
152+
153+
- name: Upload build log
154+
if: always()
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: build-log
158+
path: build.log
159+
if-no-files-found: warn
160+
161+
- name: Create Pull Request
162+
if: success()
163+
run: |
164+
cd kernel-src-tree
165+
166+
STABLE_VERSION=$(cat ../stable_version.txt)
167+
OK_TESTS=$(cat ../ok_tests.txt)
168+
CONFIG_CHANGES=$(cat ../config_changes.txt)
169+
170+
# Extract abbreviated build log (first 20 and last 20 lines)
171+
#BUILD_LOG_SUMMARY=$(head -20 ../build.log && echo "" && echo "[snip]" && echo "" && tail -20 ../build.log)
172+
BUILD_LOG_SUMMARY=$(egrep -B 5 -A 5 "\[TIMER\]|^Starting Build" ../build.log)
173+
174+
# Get artifact URLs (will be available after workflow completes)
175+
RUN_ID="${{ github.run_id }}"
176+
REPO="${{ github.repository }}"
177+
SELFTEST_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
178+
BUILD_LOG_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
179+
180+
# Create PR body
181+
cat > /tmp/pr_body.md <<EOF
182+
## Automated Rebase to v${STABLE_VERSION}
183+
184+
### Config Changes
185+
\`\`\`
186+
${CONFIG_CHANGES}
187+
\`\`\`
188+
189+
### Build Log
190+
\`\`\`
191+
${BUILD_LOG_SUMMARY}
192+
\`\`\`
193+
194+
### Testing
195+
Selftests passed: **${OK_TESTS}** tests
196+
197+
### Artifacts
198+
- [Build Log](${BUILD_LOG_ARTIFACT_URL})
199+
- [Selftest Logs](${SELFTEST_ARTIFACT_URL})
200+
201+
EOF
202+
203+
# Create the PR
204+
gh pr create \
205+
--title "TESTING TESTING TESTING [CIQ 6.12] Rebase to v${STABLE_VERSION}" \
206+
--body-file /tmp/pr_body.md \
207+
--base ${CLK_NEXT_BRANCH} \
208+
--head ${TMP_CLK_NEXT_BRANCH}
209+

0 commit comments

Comments
 (0)