Skip to content

Commit

Permalink
CI: allow to override the kdevops-results-archive ref used
Browse files Browse the repository at this point in the history
The kdevops-results-archive will have a commit log which describes
the trigger tree used to create the test and then also the ref used.
kdevops can be used for CI with two setups:

a) Using something like kernel-patch-daemon which creates a series of
   patches from patchwork and then pushes onto a tree under the
   linux-kdevops organization. The way kpd does this is it first
   merges the respective CI files so the .github directory and then
   applies the patches. The last patch is what we use right now for
   the commit log subject we use for committing the archive into
   the kdevops-results-archive. The last commit in this case would
   make sense, and the ref is ephemeral as its just a patch on the
   mailing list.

2) A kernel maintainer will use an existing tree but want to trigger
   at test. In this case it makes sense for a kernel maintainer to want
   to keep the git history and so the .github directory would be added
   at the very end. In this case, it makes no sense to have a commit
   log on kdevops-results-archive which mentions the last commit which
   just adds the .github directory. We can special case and test for
   this on the github actions and have it just add an optional file which
   can override the default ref used on the kdevops-results-archive repo.
   This allows us to also use this ref for the zip archive, and so
   for example, if we are testing the Linux kernel official refs we
   will upkeep the ref and be able to keep the archive file with the
   name as well.

So this adds support for 2) as an option.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
  • Loading branch information
mcgrof committed Oct 28, 2024
1 parent ec21a5e commit 751269a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions playbooks/roles/kdevops_archive/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ kdevops_archive_test_subject: "maple_tree: dump error message based on format"
kdevops_archive_ci_subject_patchform_name: "maple_tree-dump-error-message-based-on-format"
kdevops_archive_ci_test_result: "unknown"
kdevops_archive_test_commit: "Elaborate here on test details."
kdevops_archive_test_ref: "{{ target_linux_ref }}"
35 changes: 28 additions & 7 deletions playbooks/roles/kdevops_archive/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,38 @@
chdir: "{{ topdir_path }}"
when: ci_results.stdout_lines | length > 0

- name: Check if ci.ref file exists
stat:
path: "{{ topdir_path }}/ci.ref"
register: ci_ref_file

- name: Read ci.ref file if it exists
slurp:
path: "{{ topdir_path }}/ci.ref"
register: ci_ref_content
when: ci_ref_file.stat.exists

- name: Set kdevops_archive_test_ref from ci.ref
set_fact:
kdevops_archive_test_ref: "{{ ci_ref_content.content | b64decode | trim }}"
when: ci_ref_file.stat.exists

- name: Set kdevops_archive_test_ref in case ci.ref is not set
set_fact:
kdevops_archive_test_ref: "{{ target_linux_tree }}"
when: not ci_ref_file.stat.exists

- name: Create our archive/ xz file for kdevops-results-archive
archive:
path: "{{ kdevops_results_local }}"
dest: "{{ kdevops_results }}/{{ target_linux_ref }}.xz"
dest: "{{ kdevops_results }}/{{ kdevops_archive_test_ref }}.xz"
format: xz
remove: no

- name: Create the same archive/ zip file for web CI artifacts
archive:
path: "{{ kdevops_results_local }}"
dest: "{{ kdevops_results }}/{{ target_linux_ref }}.zip"
dest: "{{ kdevops_results }}/{{ kdevops_archive_test_ref }}.zip"
format: zip
remove: no

Expand Down Expand Up @@ -234,7 +255,7 @@
kdevops_archive_test_trigger: "{{ ci_trigger_content.content | b64decode | trim }}"
when: ci_trigger_file.stat.exists

- name: Set kdevops_archive_test_subject in case ci.trigger is not set
- name: Set kdevops_archive_test_trigger in case ci.trigger is not set
set_fact:
kdevops_archive_test_trigger: "{{ target_linux_tree }}"
when: not ci_trigger_file.stat.exists
Expand Down Expand Up @@ -301,7 +322,7 @@

- name: Set best-effort heuristic subject in case ci.subject is not set
set_fact:
kdevops_archive_test_subject: "{{ target_linux_tree }} {{ target_linux_ref }} result #{{ kdevops_archive_test_number }}"
kdevops_archive_test_subject: "{{ target_linux_tree }} {{ kdevops_archive_test_ref }} result #{{ kdevops_archive_test_number }}"
when: not ci_subject_file.stat.exists

- name: Generate git-format-patch style filename from subject
Expand Down Expand Up @@ -329,7 +350,7 @@

- name: Copy archive to target directory
copy:
src: "{{ kdevops_results }}/{{ target_linux_ref }}.xz"
src: "{{ kdevops_results }}/{{ kdevops_archive_test_ref }}.xz"
dest: "{{ kdevops_results_archive_dir }}/{{ kdevops_archive_prefix }}"
mode: '0644'

Expand All @@ -341,7 +362,7 @@

- name: Stage the new archive file
command:
cmd: git add "{{ kdevops_archive_prefix }}{{ target_linux_ref }}.xz"
cmd: git add "{{ kdevops_archive_prefix }}{{ kdevops_archive_test_ref }}.xz"
args:
chdir: "{{ kdevops_results_archive_dir }}"
environment:
Expand Down Expand Up @@ -397,7 +418,7 @@
This adds test results for:
workflow: {{ kdevops_workflow_name }}
tree: {{ target_linux_tree }}
ref: {{ target_linux_ref }}
ref: {{ kdevops_archive_test_ref }}
test number: {{ kdevops_archive_test_number }}
test result: {{ kdevops_archive_ci_test_result }}
Expand Down

0 comments on commit 751269a

Please sign in to comment.