Skip to content

Commit f1749de

Browse files
committed
kdevops_archive: enhance commit and archive placement
The commit log on kdevops-results-archive does not provide much details, we can't even tell what tree this was triggered from. So enhance all this and add extra CI files the test runner could populate in case it wanted to help users of kdevops-results-archive or bots that scrape it for analysis of results. New optional CI metadata files for kdevops archive: ci.trigger - should be set by the repo basename name that triggered the test like linux-radix-tree-kpd or linux-modules-kpd or kdevops ... and so on ci.subject - should be set to the last commit in your repo tree that triggered this CI event, so this was designed for something like 'git log -1 --pretty=format:"%s"' ci.result - Test outcome status: - ok - not ok - WTF ci.commit_extra - Additional details to include in commit message into kdevops-results-archive. Whatever you want buddy. All files are optional with these defaults: ci.trigger -> target_linux_tree ci.subject -> "${target_linux_tree} ${target_linux_ref} result #${test_number}" ci.result -> "unknown" ci.commit_extra -> "No extra test report details available." Also use the subject prefix of the ci.subject as you would get if you use git format-patch on it, for the directory name where we place your zip file. This lets you easily find the zip file for posted patches on the mailing list fast. Signed-off-by: Luis Chamberlain <[email protected]>
1 parent a7c1ab7 commit f1749de

File tree

2 files changed

+106
-19
lines changed

2 files changed

+106
-19
lines changed

playbooks/roles/kdevops_archive/defaults/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ kdevops_archive_demo: False
1515
bootlinux_tree_set_by_cli: False
1616
kdevops_archive_base: "selftests/gh/linux-modules-kpd/20241021"
1717
kdevops_archive_test_number: "0001"
18-
kdevops_archive_prefix: "{{ kdevops_archive_base }}/{{ kdevops_archive_next_number }}/v6.12-rc4/"
18+
kdevops_archive_prefix: "{{ kdevops_archive_base }}/{{ kdevops_archive_test_number }}/v6.12-rc4/"
19+
kdevops_archive_test_trigger: "linux-radix-tree-kbd"
20+
kdevops_archive_test_subject: "maple_tree: dump error message based on format"
21+
kdevops_archive_ci_subject_patchform_name: "maple_tree-dump-error-message-based-on-format"
22+
kdevops_archive_ci_test_result: "unknown"
23+
kdevops_archive_test_commit: "Elaborate here on test details."

playbooks/roles/kdevops_archive/tasks/main.yml

Lines changed: 100 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,36 +218,41 @@
218218
when:
219219
- 'kdevops_archive_demo|bool'
220220

221-
- name: Get current date in YYYYMMDD format
221+
- name: Check if ci.trigger file exists
222+
stat:
223+
path: "{{ topdir_path }}/ci.trigger"
224+
register: ci_trigger_file
225+
226+
- name: Read ci.trigger file if it exists
227+
slurp:
228+
path: "{{ topdir_path }}/ci.trigger"
229+
register: ci_trigger_content
230+
when: ci_trigger_file.stat.exists
231+
232+
- name: Set kdevops_archive_test_subject from ci.trigger
222233
set_fact:
223-
current_date: "{{ '%Y%m%d' | strftime }}"
234+
kdevops_archive_test_trigger: "{{ ci_trigger_content.content | b64decode | trim }}"
235+
when: ci_trigger_file.stat.exists
224236

225-
- name: Construct base directory path
237+
- name: Set kdevops_archive_test_subject in case ci.trigger is not set
226238
set_fact:
227-
kdevops_archive_base: "{{ kdevops_workflow_name }}/{{ current_user.stdout }}/{{ target_linux_tree }}/{{ current_date }}"
239+
kdevops_archive_test_trigger: "{{ target_linux_tree }}"
240+
when: not ci_trigger_file.stat.exists
228241

229242
- name: Get current date in YYYYMMDD format
230243
set_fact:
231244
current_date: "{{ '%Y%m%d' | strftime }}"
232245

233246
- name: Construct base directory path
234247
set_fact:
235-
kdevops_archive_base: "{{ kdevops_workflow_name }}/{{ current_user.stdout }}/{{ target_linux_tree }}/{{ current_date }}"
248+
kdevops_archive_base: "{{ kdevops_workflow_name }}/{{ current_user.stdout }}/{{ kdevops_archive_test_trigger }}/{{ current_date }}"
236249

237250
- name: Ensure base directory exists
238251
file:
239252
path: "{{ kdevops_results_archive_dir }}/{{ kdevops_archive_base }}"
240253
state: directory
241254
mode: '0755'
242255

243-
- name: Get current date in YYYYMMDD format
244-
set_fact:
245-
current_date: "{{ '%Y%m%d' | strftime }}"
246-
247-
- name: Construct base directory path
248-
set_fact:
249-
kdevops_archive_base: "{{ kdevops_workflow_name }}/{{ current_user.stdout }}/{{ target_linux_tree }}/{{ current_date }}"
250-
251256
- name: List all directories in base path
252257
find:
253258
paths: "{{ kdevops_results_archive_dir }}/{{ kdevops_archive_base }}"
@@ -278,13 +283,43 @@
278283
set_fact:
279284
kdevops_archive_test_number: "{{ next_number }}"
280285

281-
- name: Set complete archive prefix
286+
- name: Check if ci.subject file exists
287+
stat:
288+
path: "{{ topdir_path }}/ci.subject"
289+
register: ci_subject_file
290+
291+
- name: Read ci.subject file if it exists
292+
slurp:
293+
path: "{{ topdir_path }}/ci.subject"
294+
register: ci_subject_content
295+
when: ci_subject_file.stat.exists
296+
297+
- name: Set kdevops_archive_test_subject from ci.subject
282298
set_fact:
283-
kdevops_archive_prefix: "{{ kdevops_archive_base }}/{{ next_number }}/{{ target_linux_ref }}/"
299+
kdevops_archive_test_subject: "{{ ci_subject_content.content | b64decode | trim }}"
300+
when: ci_subject_file.stat.exists
284301

285-
- name: Set complete archive prefix
302+
- name: Set best-effort heuristic subject in case ci.subject is not set
286303
set_fact:
287-
kdevops_archive_prefix: "{{ kdevops_archive_base }}/{{ kdevops_archive_test_number }}/{{ target_linux_ref }}/"
304+
kdevops_archive_test_subject: "{{ target_linux_tree }} {{ target_linux_ref }} result #{{ kdevops_archive_test_number }}"
305+
when: not ci_subject_file.stat.exists
306+
307+
- name: Generate git-format-patch style filename from subject
308+
set_fact:
309+
kdevops_archive_ci_subject_patchform_name: >-
310+
{{
311+
(kdevops_archive_test_subject | lower
312+
| regex_replace('[^a-z0-9]+', '-')
313+
| regex_replace('^-+|-+$', '')
314+
| regex_replace('-+', '-')
315+
)[:52] ~ (
316+
(kdevops_archive_test_subject | length > 52) | ternary('...', '')
317+
)
318+
}}
319+
320+
- name: Set complete archive prefix with subject-based name
321+
set_fact:
322+
kdevops_archive_prefix: "{{ kdevops_archive_base }}/{{ kdevops_archive_test_number }}/{{ kdevops_archive_ci_subject_patchform_name }}/"
288323

289324
- name: Create target directory if it doesn't exist
290325
file:
@@ -312,16 +347,63 @@
312347
environment:
313348
GIT_LFS_SKIP_SMUDGE: "0"
314349

350+
- name: Check if ci.commit_extra file exists
351+
stat:
352+
path: "{{ topdir_path }}/ci.commit_extra"
353+
register: ci_commit_file
354+
355+
- name: Read ci.commit_extra file if it exists
356+
slurp:
357+
path: "{{ topdir_path }}/ci.commit_extra"
358+
register: ci_commit_content
359+
when: ci_commit_file.stat.exists
360+
361+
- name: Set kdevops_archive_test_subject from ci.commit_extra
362+
set_fact:
363+
kdevops_archive_test_commit: "{{ ci_commit_content.content | b64decode | trim }}"
364+
when: ci_commit_file.stat.exists
365+
366+
- name: Set kdevops_archive_test_subject in case ci.commit_extra is not set
367+
set_fact:
368+
kdevops_archive_test_commit: "No extra test report details available."
369+
when: not ci_commit_file.stat.exists
370+
371+
- name: Check if ci.result file exists
372+
stat:
373+
path: "{{ topdir_path }}/ci.result"
374+
register: ci_result_file
375+
376+
- name: Read ci.result file if it exists
377+
slurp:
378+
path: "{{ topdir_path }}/ci.result"
379+
register: ci_result_content
380+
when: ci_result_file.stat.exists
381+
382+
- name: Set kdevops_archive_ci_test_result from ci.result
383+
set_fact:
384+
kdevops_archive_ci_test_result: "{{ ci_result_content.content | b64decode | trim }}"
385+
when: ci_result_file.stat.exists
386+
387+
- name: Set kdevops_archive_ci_test_result in case ci.result is not set
388+
set_fact:
389+
kdevops_archive_ci_test_result: "unknown"
390+
when: not ci_result_file.stat.exists
391+
315392
- name: Set commit message
316393
set_fact:
317394
commit_message: |
318-
{{ kdevops_workflow_name }}: {{ target_linux_tree }} {{ target_linux_ref }} result #{{ kdevops_archive_test_number }}
395+
{{ kdevops_archive_test_trigger }}: {{ kdevops_archive_test_subject }}
319396
320397
This adds test results for:
321398
workflow: {{ kdevops_workflow_name }}
322399
tree: {{ target_linux_tree }}
323400
ref: {{ target_linux_ref }}
324401
test number: {{ kdevops_archive_test_number }}
402+
test result: {{ kdevops_archive_ci_test_result }}
403+
404+
Detailed test report:
405+
406+
{{ kdevops_archive_test_commit }}
325407
326408
- name: Commit the archive
327409
shell: |

0 commit comments

Comments
 (0)