Skip to content

Commit 7fc4082

Browse files
committed
dev: restore kdevops
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
1 parent f6f16f2 commit 7fc4082

3 files changed

Lines changed: 291 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# This can be used towards the end of your action. All tasks here run even if
4+
# any of the previous tasks failed.
5+
6+
name: Kdevops cleanup workflow
7+
8+
on:
9+
workflow_call: # Makes this workflow reusable
10+
11+
jobs:
12+
cleanup:
13+
name: Archive results and cleanup
14+
runs-on: [self-hosted, Linux, X64]
15+
steps:
16+
- name: Set Linux kdevops development path
17+
if: ${{ job.status != 'cancelled' }}
18+
run: echo "LINUX_KDEVOPS_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
19+
20+
- name: Get systemd journal files
21+
if: ${{ job.status != 'cancelled' }}
22+
run: |
23+
if [[ ! -d kdevops ]]; then
24+
exit 0
25+
fi
26+
cd kdevops
27+
make journal-dump
28+
29+
- name: Start SSH Agent
30+
if: ${{ job.status != 'cancelled' }}
31+
uses: webfactory/ssh-agent@v0.9.0
32+
with:
33+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
34+
35+
- name: Build our kdevops archive results
36+
if: ${{ job.status != 'cancelled' }}
37+
run: |
38+
if [[ ! -d kdevops ]]; then
39+
exit 0
40+
fi
41+
cd kdevops
42+
make ci-archive
43+
44+
- name: Upload our kdevops results archive
45+
if: ${{ job.status != 'cancelled' }}
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: kdevops-ci-results
49+
path: ${{ env.LINUX_KDEVOPS_PATH }}/kdevops/archive/*.zip
50+
51+
- name: Run kdevops make destroy
52+
if: always()
53+
run: |
54+
if [[ ! -d kdevops ]]; then
55+
exit 0
56+
fi
57+
cd kdevops
58+
make destroy
59+
cd ..
60+
rm -rf kdevops
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# Most simple Linux kernel subsystems can be tested with this target
4+
# test setup. For more elaborates tests look for a topic branch under the
5+
# kdevops-ci tree. For example to test a filesystem look at the fstests
6+
# branch.
7+
8+
name: Run generic kdevops CI tests
9+
10+
on:
11+
push:
12+
branches: ['**']
13+
pull_request:
14+
branches: ['**']
15+
workflow_dispatch: # Allow manual triggering
16+
17+
jobs:
18+
setup:
19+
uses: ./.github/workflows/kdevops-init.yml
20+
secrets: inherit
21+
22+
run-tests:
23+
needs: setup
24+
name: Run CI tests
25+
runs-on: [self-hosted, Linux, X64]
26+
steps:
27+
- name: Run CI tests
28+
run: |
29+
cd kdevops
30+
make ci-test
31+
echo "ok" > ci.result
32+
33+
cleanup:
34+
needs: [run-tests, setup] # Add setup as a dependency to ensure proper ordering
35+
if: always() # This ensures cleanup runs even if run-tests fails
36+
uses: ./.github/workflows/kdevops-cleanup.yml
37+
secrets: inherit

.github/workflows/kdevops-init.yml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# This can be used as a initialization workflow for most Linux kernel
4+
# development environments. This takes care of:
5+
#
6+
# - Checks out and re-using a local mirror for your kernel tree
7+
# - Looks for a defconfig in kdevops to use for your kernel tree
8+
# - Sets up CI metadata for kdevops-results-archive
9+
# - Ensures your kernel tree at least builds with defconfig
10+
# - Brings up target DUTs nodes
11+
# - Installs your Linux kernel tree on them
12+
# - Builds all of your test requirements for your Linux kernel tree
13+
14+
name: Base kdevops workflow
15+
16+
on:
17+
workflow_call: # Makes this workflow reusable
18+
inputs:
19+
kdevops_defconfig:
20+
required: false
21+
type: string
22+
23+
jobs:
24+
setup:
25+
name: Setup kdevops environment
26+
runs-on: [self-hosted, Linux, X64]
27+
steps:
28+
# - name: Verify we won't expect user input interactions on the host key
29+
# run: |
30+
# mkdir -p ~/.ssh
31+
# if ! grep -q "StrictHostKeyChecking no" ~/.ssh/config 2>/dev/null; then
32+
# echo "StrictHostKeyChecking no" >> ~/.ssh/config
33+
# fi
34+
35+
# - name: Start SSH Agent for initial test
36+
# uses: webfactory/ssh-agent@v0.9.0
37+
# with:
38+
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
39+
40+
# Modify the repo here if you have a custom or private URL for the archive
41+
# This can also just be a repo variable later.
42+
# - name: Verify our ssh connection will work
43+
# run: |
44+
# if ! git ls-remote git@github.com:linux-kdevops/kdevops-results-archive.git HEAD; then
45+
# echo "Cannot access kdevops-results-archive repository"
46+
# exit 1
47+
# fi
48+
49+
- name: Configure git
50+
run: |
51+
git config --global --add safe.directory '*'
52+
git config --global user.name "kdevops"
53+
git config --global user.email "kdevops@lists.linux.dev"
54+
55+
- name: Checkout kdevops
56+
run: |
57+
rm -rf kdevops
58+
git clone /mirror/kdevops/.git kdevops
59+
60+
- name: Make sure our repo kdevops defconfig exists
61+
run: |
62+
cd kdevops
63+
# if [[ -z "${{ inputs.kdevops_defconfig }}" ]]; then
64+
# KDEVOPS_DEFCONFIG=$(basename ${{ github.repository }})
65+
# else
66+
# KDEVOPS_DEFCONFIG="${{ inputs.kdevops_defconfig }}"
67+
# fi
68+
KDEVOPS_DEFCONFIG="selftests-vma"
69+
70+
if [[ ! -f defconfigs/$KDEVOPS_DEFCONFIG ]]; then
71+
echo "kdevops lacks a defconfig for this repository, expected to find: defconfigs/$KDEVOPS_DEFCONFIG"
72+
exit 1
73+
fi
74+
75+
echo "KDEVOPS_DEFCONFIG=$KDEVOPS_DEFCONFIG" >> $GITHUB_ENV
76+
77+
- name: Checkout custom branch with delta on kdevops/linux
78+
run: |
79+
LINUX_TREE="https://github.com/${{ github.repository }}"
80+
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
81+
cd kdevops
82+
git clone $LINUX_TREE --reference /mirror/linux/.git/ --depth=5 linux
83+
cd linux
84+
git fetch origin $LINUX_TREE_REF
85+
git checkout $LINUX_TREE_REF
86+
git log -1
87+
88+
- name: Initialize CI metadata for kdevops-results-archive for linux
89+
run: |
90+
cd kdevops/linux
91+
echo "$(basename ${{ github.repository }})" > ../ci.trigger
92+
93+
# This supports using kdevops github actions using two different
94+
# approaches:
95+
#
96+
# 1) Commit the .github/ directory onto a Linux tree before your
97+
# kernel changes. This approach is used for example for
98+
# testing patches posted on the mailing list with patchwork,
99+
# this is the strategy kernel-patch-deaemon uses. Since the
100+
# patches are ephemeral there is not important git history to
101+
# maintain.
102+
#
103+
# 2) Merge the .github/ directory at the end of your development
104+
# tree. This is useful for kernel developers wishing to test
105+
# existing trees.
106+
#
107+
# So this checks to see if the last commit (top of the tree) *added*
108+
# the .github directory. If the last commit added it, then we assume
109+
# the commit prior to it was the one we'd like to document as the main
110+
# test point.
111+
if git diff-tree --no-commit-id --name-only --diff-filter=A -r HEAD | grep -q "^\.github/"; then
112+
git log -2 --skip=1 --pretty=format:"%s" -1 > ../ci.subject
113+
git describe --exact-match --tags HEAD^ 2>/dev/null || git rev-parse --short HEAD^ > ../ci.ref
114+
else
115+
git log -1 --pretty=format:"%s" > ../ci.subject
116+
git describe --exact-match --tags HEAD 2>/dev/null || git rev-parse --short HEAD > ../ci.ref
117+
fi
118+
119+
RELEVANT_GIT_TAG=$(cat ../ci.ref)
120+
RELEVANT_GIT_REF=$(git rev-parse --short=12 $RELEVANT_GIT_TAG)
121+
122+
echo "LINUX_GIT_REF=$RELEVANT_GIT_REF" >> $GITHUB_ENV
123+
echo "LINUX_GIT_TAG=$RELEVANT_GIT_TAG" >> $GITHUB_ENV
124+
125+
# Start out pessimistic
126+
echo "unknown" > ../ci.result
127+
echo "Nothing to write home about." > ../ci.commit_extra
128+
129+
- name: Run a quick Linux kernel defconfig build test
130+
run: |
131+
cd kdevops/linux
132+
git reset --hard ${{ env.LINUX_GIT_TAG }}
133+
make defconfig
134+
make -j$(nproc)
135+
136+
- name: Run kdevops make defconfig-repo
137+
run: |
138+
LINUX_TREE="https://github.com/${{ github.repository }}"
139+
LINUX_TREE_REF="${{ env.LINUX_GIT_TAG }}"
140+
141+
# We make the compromise here to use a relevant git tag for the
142+
# host prefix so that folks can easily tell what exact kernel tree
143+
# is being tested by using the relevant git ref. That is, if you
144+
# pushed a tree with the .github/ directory as the top of the tree,
145+
# that commit will not be used, we'll use the last one as that is
146+
# the relevant git ref we want to annotate a test for.
147+
#
148+
# The compromise here we use special KDEVOPS to separete the
149+
# commit ID and github.run_id. Exotic things likes UTF characters
150+
# and dots have problems.
151+
KDEVOPS_HOSTS_PREFIX="${{ env.LINUX_GIT_REF }}KDEVOPS${{ github.run_id }}"
152+
153+
echo "Going to use defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
154+
155+
echo "Linux tree: $LINUX_TREE"
156+
echo "Linux trigger ref: $LINUX_TREE_REF"
157+
echo "Linux tag: ${{ env.LINUX_GIT_TAG }}"
158+
echo "Runner ID: ${{ github.run_id }}"
159+
echo "kdevops host prefix: $KDEVOPS_HOSTS_PREFIX"
160+
echo "kdevops defconfig: defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
161+
162+
KDEVOPS_ARGS="\
163+
KDEVOPS_HOSTS_PREFIX=$KDEVOPS_HOSTS_PREFIX \
164+
LINUX_TREE=$LINUX_TREE \
165+
LINUX_TREE_REF=$LINUX_TREE_REF \
166+
ANSIBLE_CFG_CALLBACK_PLUGIN="debug" \
167+
KMOD_TIMEOUT="175" \
168+
defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
169+
echo "Going to run:"
170+
echo "make $KDEVOPS_ARGS"
171+
172+
cd kdevops
173+
make $KDEVOPS_ARGS
174+
175+
- name: Run kdevops make
176+
run: |
177+
cd kdevops
178+
make -j$(nproc)
179+
180+
- name: Run kdevops make bringup
181+
run: |
182+
cd kdevops
183+
ls -ld linux
184+
make bringup
185+
186+
- name: Build linux and boot test nodes on test kernel
187+
run: |
188+
cd kdevops
189+
make linux
190+
191+
- name: Build required ci tests
192+
run: |
193+
cd kdevops
194+
make ci-build-test

0 commit comments

Comments
 (0)