Skip to content

Commit baa0ec6

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

File tree

1 file changed

+213
-0
lines changed

1 file changed

+213
-0
lines changed

.github/workflows/clk-rebase.yml

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

0 commit comments

Comments
 (0)