-
Notifications
You must be signed in to change notification settings - Fork 14
271 lines (251 loc) · 8.39 KB
/
kdevops.yml
File metadata and controls
271 lines (251 loc) · 8.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# SPDX-License-Identifier: GPL-2.0
---
name: Run kdevops CI Workflow - Push/PR/Manual/Schedule
on:
schedule:
- cron: '0 14 * * *' # Daily at 2 PM UTC
push:
branches:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch:
inputs:
ci_workflow:
description: "CI Workflow"
required: true
default: 'blktests_nvme'
type: choice
options:
- blktests
- blktests_block
- blktests_loop
- blktests_meta
- blktests_nbd
- blktests_nvme
- blktests_nvmemp
- blktests_scsi
- blktests_srp
- blktests_zbd
- lbs-xfs
- lbs-xfs-bdev-large-nvme
- lbs-xfs-bdev-nvme
- lbs-xfs-small
- xfs
- xfs-soak
- xfs_crc
- xfs_crc_logdev
- xfs_crc_rtdev
- xfs_crc_rtdev_extsize_28k
- xfs_crc_rtdev_extsize_64k
- xfs_nocrc
- xfs_nocrc_16k_4ks
- xfs_nocrc_1k
- xfs_nocrc_2k
- xfs_nocrc_32_4ks
- xfs_nocrc_4k
- xfs_nocrc_512
- xfs_nocrc_64_4ks
- xfs_nocrc_8k_4ks
- xfs_nocrc_lbs
- xfs_reflink
- xfs_reflink_1024
- xfs_reflink_16k_4ks
- xfs_reflink_2k
- xfs_reflink_32k_4ks
- xfs_reflink_4k
- xfs_reflink_4k_8ks
- xfs_reflink_64k_4ks
- xfs_reflink_dir_bsize_8k
- xfs_reflink_lbs
- xfs_reflink_logdev
- xfs_reflink_normapbt
- xfs_reflink_nrext64
- xfs_reflink_stripe_len
kernel_tree:
description: "Linux kernel tree to use"
required: true
default: 'linux'
type: choice
options:
- linux
- linux-next
- linux-stable
kernel_ref:
description: "Linux tree git reference (branch/tag/commit-id)"
required: true
default: 'master'
type: string
test_mode:
description: 'Testing mode'
required: false
default: 'kdevops-ci'
type: choice
options:
- 'kdevops-ci'
- 'linux-ci'
tests:
description: 'Custom test to run (for kdevops-ci mode only)'
required: false
type: string
default: ''
jobs:
generate_kernel_ref:
name: Generate Kernel Reference for Scheduled Runs
runs-on: [self-hosted]
if: github.event_name == 'schedule'
outputs:
kernel_ref: ${{ steps.kernel_ref.outputs.kernel_ref }}
kernel_tree: ${{ steps.kernel_ref.outputs.kernel_tree }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Generate kernel reference based on day of week
id: kernel_ref
run: |
set -euxo pipefail
day_of_week=$(date +%u)
if [ "$day_of_week" -eq 1 ]; then
# Monday: Use mainline
kernel_ref=$(./scripts/korg-releases.py --moniker mainline)
kernel_tree=linux
else
# Other days: Use linux-next
kernel_ref=$(./scripts/korg-releases.py --moniker linux-next)
kernel_tree=linux-next
fi
./scripts/github_output.sh kernel_ref "$kernel_ref"
./scripts/github_output.sh kernel_tree "$kernel_tree"
check_ref:
name: Check Linux kernel Git Reference
runs-on: [self-hosted]
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Check kernel_ref exists
id: check_kernel_ref
run: |
set -euxo pipefail
ref="${{ github.event.inputs.kernel_ref }}"
tree="${{ github.event.inputs.kernel_tree }}"
mirror="/mirror/${tree}.git"
ls_remote="$(git ls-remote "$mirror" "refs/*/${ref}" || true)"
contains_branch="$(git -C "$mirror" branch --contains "${ref}" || true)"
contains_tag="$(git -C "$mirror" branch --contains "${ref}" || true)"
if [ -z "$ls_remote" ] && [ -z "$contains_branch" ] && [ -z "$contains_tag" ]; then
echo "Linux kernel ${ref} does not exist."
exit 1
fi
kdevops-ci-matrix:
name: "${{ github.event.inputs.test_mode || 'kdevops-ci' }}: ${{ matrix.ci_workflow }}"
runs-on: self-hosted
needs: [check_ref, generate_kernel_ref]
if: >-
always() &&
(
needs.check_ref.result == 'success' ||
needs.check_ref.result == 'skipped'
) &&
(
needs.generate_kernel_ref.result == 'success' ||
needs.generate_kernel_ref.result == 'skipped'
)
strategy:
fail-fast: false
matrix:
ci_workflow: >-
${{
github.event_name == 'schedule'
&& fromJSON('["blktests"]')
|| github.event_name == 'workflow_dispatch'
&& fromJSON(format('["{0}"]', github.event.inputs.ci_workflow))
|| fromJSON('["blktests_nvme", "xfs_reflink_4k"]')
}}
steps:
- name: Checkout repository for ${{ matrix.ci_workflow }}
shell: bash
run: |
set -euxo pipefail
# More efficient approach similar to actions/checkout
if [[ -d ".git" ]]; then
# Repo exists - clean and update (like actions/checkout)
git clean -ffdx
git reset --hard HEAD
# Ensure correct remote URL for public repo
git remote set-url origin ${{ github.server_url }}/${{ github.repository }}.git
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# For PRs, fetch the specific PR ref that GitHub creates
git fetch --depth=1 origin refs/pull/${{ github.event.number }}/head:pr-branch
git checkout pr-branch
else
# For push/schedule/workflow_dispatch, use the commit SHA directly
git fetch --depth=1 origin ${{ github.sha }}
git checkout ${{ github.sha }}
fi
else
# No repo - fresh clone with local mirror optimization
if [[ -f "/mirror/kdevops.git/HEAD" ]]; then
git clone --verbose --progress \
--reference /mirror/kdevops.git \
--depth=1 \
${{ github.server_url }}/${{ github.repository }}.git .
else
git clone --verbose --progress \
--depth=1 \
${{ github.server_url }}/${{ github.repository }}.git .
fi
# Checkout the specific commit
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
git fetch --depth=1 origin refs/pull/${{ github.event.number }}/head:pr-branch
git checkout pr-branch
else
git checkout ${{ github.sha }}
fi
fi
- name: Configure kdevops
uses: ./.github/actions/configure
with:
ci_workflow: ${{ matrix.ci_workflow }}
kernel_ref: >-
${{
github.event_name == 'schedule' && needs.generate_kernel_ref.outputs.kernel_ref
|| github.event.inputs.kernel_ref
|| 'v6.15'
}}
kernel_tree: >-
${{
github.event_name == 'schedule' && needs.generate_kernel_ref.outputs.kernel_tree
|| github.event.inputs.kernel_tree
|| 'linux'
}}
test_mode: >-
${{
github.event_name == 'schedule' && 'linux-ci'
|| github.event.inputs.test_mode
|| 'kdevops-ci'
}}
- name: Bringup guests
uses: ./.github/actions/bringup
- name: Install linux
uses: ./.github/actions/linux
- name: Install tests
uses: ./.github/actions/build-test
with:
ci_workflow: ${{ matrix.ci_workflow }}
- name: Run tests
uses: ./.github/actions/test
with:
ci_workflow: ${{ matrix.ci_workflow }}
test_mode: ${{ github.event.inputs.test_mode || 'kdevops-ci' }}
tests: ${{ github.event.inputs.tests || '' }}
timeout-minutes: 120
- name: Archive results
uses: ./.github/actions/archive
with:
ci_workflow: ${{ matrix.ci_workflow }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Cleanup
if: always()
uses: ./.github/actions/cleanup