Skip to content

Commit f54a54b

Browse files
committed
clk rebase ga wip
1 parent c4f6b9e commit f54a54b

File tree

1 file changed

+212
-0
lines changed

1 file changed

+212
-0
lines changed

.github/workflows/clk-rebase.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
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: 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+
# work around install issue with iputils
101+
dnf install -y --setopt=tsflags=nocaps iputils
102+
103+
# should be installed in kernel_kselftest.sh
104+
dnf install -y python3-pyyaml python3-jsonschema
105+
106+
- name: Run selftests
107+
run: |
108+
cd kernel-src-tree
109+
110+
vng --qemu /usr/libexec/qemu-kvm --force-initramfs --disable-microvm --rw --network user --verbose --memory 16G -- ../kernel-src-tree-tools/kernel_kselftest.sh
111+
112+
# HACK HACK HACK
113+
#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'
114+
115+
- name: Extract results and push branches
116+
run: |
117+
cd kernel-src-tree
118+
119+
echo "Selftests passed:"
120+
OK_TESTS=$(grep -a ^ok ../kselftest-logs/selftest* | wc -l)
121+
echo $OK_TESTS
122+
123+
# Extract the stable version we rebased onto
124+
STABLE_VERSION=$(git log -1 --format=%s $STABLE_TRACKING_BRANCH | grep -oP 'Linux \K[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
125+
echo "Rebased to stable version: $STABLE_VERSION"
126+
127+
# Push the branches
128+
git push origin $CLK_NEXT_BRANCH
129+
git push origin $TMP_CLK_NEXT_BRANCH
130+
131+
# Check for config changes
132+
# Look for a commit at HEAD with message like "[CIQ] v6.12.29 - rebased configs"
133+
# that matches the stable version we're rebasing onto
134+
HEAD_COMMIT_MSG=$(git log -1 --format=%s HEAD)
135+
if echo "$HEAD_COMMIT_MSG" | grep -qF "[CIQ] v${STABLE_VERSION} - rebased configs"; then
136+
echo "Config change commit detected for v${STABLE_VERSION}"
137+
# Extract the config changes from the commit
138+
git show HEAD --stat > ../config_changes.txt
139+
else
140+
echo "No config change commit detected for v${STABLE_VERSION}"
141+
echo "None" > ../config_changes.txt
142+
fi
143+
144+
# Save data for PR creation
145+
echo "$STABLE_VERSION" > ../stable_version.txt
146+
echo "$OK_TESTS" > ../ok_tests.txt
147+
148+
- name: Upload selftest logs
149+
if: always()
150+
uses: actions/upload-artifact@v4
151+
with:
152+
name: kselftest-logs
153+
path: kselftest-logs/selftest*
154+
if-no-files-found: warn
155+
156+
- name: Upload build log
157+
if: always()
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: build-log
161+
path: build.log
162+
if-no-files-found: warn
163+
164+
- name: Create Pull Request
165+
if: success()
166+
run: |
167+
cd kernel-src-tree
168+
169+
STABLE_VERSION=$(cat ../stable_version.txt)
170+
OK_TESTS=$(cat ../ok_tests.txt)
171+
CONFIG_CHANGES=$(cat ../config_changes.txt)
172+
173+
# Extract abbreviated build log (first 20 and last 20 lines)
174+
#BUILD_LOG_SUMMARY=$(head -20 ../build.log && echo "" && echo "[snip]" && echo "" && tail -20 ../build.log)
175+
BUILD_LOG_SUMMARY=$(egrep -B 5 -A 5 "\[TIMER\]|^Starting Build" ../build.log)
176+
177+
# Get artifact URLs (will be available after workflow completes)
178+
RUN_ID="${{ github.run_id }}"
179+
REPO="${{ github.repository }}"
180+
SELFTEST_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
181+
BUILD_LOG_ARTIFACT_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
182+
183+
# Create PR body
184+
cat > /tmp/pr_body.md <<EOF
185+
## Automated Rebase to v${STABLE_VERSION}
186+
187+
### Config Changes
188+
\`\`\`
189+
${CONFIG_CHANGES}
190+
\`\`\`
191+
192+
### Build Log
193+
\`\`\`
194+
${BUILD_LOG_SUMMARY}
195+
\`\`\`
196+
197+
### Testing
198+
Selftests passed: **${OK_TESTS}** tests
199+
200+
### Artifacts
201+
- [Build Log](${BUILD_LOG_ARTIFACT_URL})
202+
- [Selftest Logs](${SELFTEST_ARTIFACT_URL})
203+
204+
EOF
205+
206+
# Create the PR
207+
gh pr create \
208+
--title "TESTING TESTING TESTING [CIQ 6.12] Rebase to v${STABLE_VERSION}" \
209+
--body-file /tmp/pr_body.md \
210+
--base ${CLK_NEXT_BRANCH} \
211+
--head ${TMP_CLK_NEXT_BRANCH}
212+

0 commit comments

Comments
 (0)