Skip to contentSkip to conversation

Refactor CI

RFC PATCH Applied Daniel Gomez 2 participants 10 messages Sep 23, 2025 – Sep 24, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Refactor CI

Refactor the .github/ CI setup into modular and reusable workflows and actions. This makes it possible to share modules from kdevops repo and reuse them in other GitHub projects.

Highlights:
* Add support for parallel workflows
* Add support for kdevops selftest CI with xfs_reflink_4k and blktests_nvme (more coming)
* Run workflow tests daily with the latest linux-next tag and weekly (Mondays) with the latest Linus tag
* Update commit format in kdevops-results-archive for both CI modes (samples below)
* Enable reproducible builds and ccache. With a fixed kernel version, this should reduce kernel build time. However, without fragments it does not fully work yet. The open question is whether we should enable it only for kdevops-ci or not for workflow testing. Can we trust ccache for testing and reporting results? I think it's just fine for kdevops-ci path.
* Add time metrics to identify bottlenecks and track improvements (e.g., XFS reflink saved ~1 minute on
"base_image : Copy custom image to base image location"). Report example:

TASKS RECAP ********************************************************************
Tuesday 23 September 2025 19:23:01 +0000 (0:00:42.426) 0:00:42.426 *****
===============================================================================
base_image : Generating the index for debian-13-generic-amd64-daily ---- 28.65s
Gathering Facts --------------------------------------------------------- 4.29s
guestfs : Check for dnsmasq configuration files ------------------------- 0.79s
guestfs : Create storage pool path directory and set group (libvirt system uri) --- 0.60s
guestfs : Check if directory has group write permissions (libvirt system uri) --- 0.57s
guestfs : Get the user who invoked Ansible ------------------------------ 0.54s
guestfs : Check if directory is owned by the correct group (libvirt system uri) --- 0.51s
guestfs : Create kdevops guestfs storage directory (libvirt system uri) --- 0.50s
guestfs : Check if libvirt default network is running ------------------- 0.45s
base_image : Ensure the custom image directory exists ------------------- 0.43s
base_image : Stat /var/lib/libvirt/images/kdevops/guestfs/custom_images/debian-13-generic-amd64-daily/debian-13-generic-amd64-daily.raw --- 0.41s base_image : Check if the custom image sentinel file already exists ----- 0.40s
base_image : Check if the custom image file already exists -------------- 0.40s
base_image : Check if the custom index exists --------------------------- 0.39s
guestfs : Check if dnsmasq service is enabled --------------------------- 0.38s
guestfs : Check if dnsmasq service is active ---------------------------- 0.36s
base_image : Check if the custom source exists -------------------------- 0.27s
base_image : Create custom upstream OS image ---------------------------- 0.11s
base_image : Copy custom image to base image location (with automatic reflink optimization) --- 0.09s
base_image : Set the pathname of the custom image ----------------------- 0.06s

Commit format for kdevops-ci:

kdevops-ci: xfs_reflink_4k: d03219f7808b ansible: add lightning symbol for changed task status

BUILD INFO:
kdevops: d03219f7808b ("ansible: add lightning symbol for changed task status")
Workflow: xfs_reflink_4k
Test: generic/003
Kernel: v6.15
Duration: 1m 44s

EXECUTION RESULTS:
KERNEL: 6.15.0
CPUS: 8

xfs_reflink_4k: 1 tests, 17 seconds
generic/003 Pass 14s
Totals: 1 tests, 0 skipped, 0 failures, 0 errors, 14s

METADATA:
workflow: xfs_reflink_4k | scope: kdevops | test: generic/003 | requested: v6.15 | actual: v6.15 | result: not ok
CPUS: 8

xfs_reflink_4k: 1 tests, 17 seconds
generic/003 Pass 14s
Totals: 1 tests, 0 skipped, 0 failures, 0 errors, 14s

Commit format for workflow validation on linux:

blktests (linux master): PASS

BUILD INFO:
Kernel: master ("Merge tag 'sched_ext-for-6.17-rc7-fixes' of
git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext")
Workflow: blktests
kdevops: 2115e4296e10 ("base_image: optimize VM image copying with reflinks and fix
same-file handling")
Scope: full test suite
Duration: 35m 57s

EXECUTION RESULTS:
Kernel tests results:

Blktests summary:
Tests run: 81, Passed: 81, Failed: 0

Sample passed test:
NQN:blktests-subsystem-1 disconnected 1 controller(s) NQN:blktests-subsystem-1 disconnected 1 controller(s)

METADATA:
workflow: blktests | tree: linux
ref: master | scope: tests | result: ok

Blktests summary:
Tests run: 81, Passed: 81, Failed: 0

Sample passed test:
NQN:blktests-subsystem-1 disconnected 1 controller(s) NQN:blktests-subsystem-1 disconnected 1 controller(s) | requested: master | actual: master

---
Daniel Gomez (8):
base_image: optimize VM image copying with reflinks and fix same-file handling
kconfig: add KDEVOPS_MAKE_VERBOSE option for persistent verbose output
defconfig: add ci fragment
ansible: enhance DIY callback output format for improved readability
ansible: add profile_tasks callback timing analysis support
scripts: fix CI_WORKFLOW basename mapping
fstests: fix ansible_host undefined error
github: refactor into reusable actions and workflows

 .github/actions/archive/action.yml                 |  28 +++
 .github/actions/cleanup/action.yml                 |  24 ++
 .github/actions/setup/action.yml                   | 187 +++++++++++++++
 .github/actions/test/action.yml                    | 213 +++++++++++++++++
 .github/workflows/destroy.yml                      |  93 ++++++++
 .github/workflows/docker-tests.yml                 |   2 +-
 .github/workflows/fstests.yml                      |  98 --------
 .github/workflows/main.yml                         |  97 ++++++++
 .github/workflows/manual.yml                       | 122 ++++++++++
 .github/workflows/push.yml                         |  29 +++
 .github/workflows/schedule.yml                     |  54 +++++
 Makefile                                           |   7 +
 defconfigs/configs/ci.config                       |   7 +
 kconfigs/Kconfig.ansible_cfg                       |  14 ++
 kconfigs/Kconfig.kdevops                           |  18 ++
 .../roles/ansible_cfg/templates/ansible.cfg.j2     |  20 +-
 playbooks/roles/base_image/tasks/custom-image.yml  |  18 +-
 playbooks/roles/fstests/tasks/main.yml             |  10 +-
 scripts/ci.Makefile                                |  13 +
 scripts/generate_ci_commit_message.sh              | 263 +++++++++++++++++++++
 scripts/github_output.sh                           |   9 +
 scripts/korg-releases.py                           |  94 ++++++++
 22 files changed, 1305 insertions(+), 115 deletions(-)

---
base-commit: 4b42d3d3636b6b0c04ccc72b3cd766abe1526344
change-id: 20250923-ci-refactor-9fd37649f4f3

Best regards,

Signature · 1 line
Daniel Gomez <[email protected]>
#1 lore raw

RFC PATCH 1/8 base_image: optimize VM image copying with reflinks and fix same-file handling

From: Daniel Gomez <[email protected]>

Replace ansible.builtin.copy with cp --reflink=auto for significant performance improvement on XFS filesystems with reflink support:

- 20GB image copy time: ~54s → ~1s (when reflinks are supported)
- Automatic fallback to regular copy on non-reflink filesystems
- Use direct cp command for better control over reflink behavior

Add condition to prevent copying when source and destination are the same file. This was not needed with ansible.builtin.copy (which handles this case automatically) but is required with direct cp command which fails with "files are the same" error.

The condition custom_image != base_image_pathname ensures copy only occurs when paths differ, maintaining compatibility with configurations where both variables point to the same location.

Generated-by Claude AI
---
 playbooks/roles/base_image/tasks/custom-image.yml | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
playbooks/roles/base_image/tasks/custom-image.yml +13 -5
index bcf35933..bac834e8 100644
@@ -338,13 +338,21 @@
       - "{{ custom_image_dir }}"
   changed_when: true
 
-- name: Copy custom image to base image location
+- name: Copy custom image to base image location (with automatic reflink optimization)
   become: true
   become_method: ansible.builtin.sudo
-  ansible.builtin.copy:
-    src: "{{ custom_image }}"
-    dest: "{{ base_image_pathname }}"
-    remote_src: true
+  ansible.builtin.command:
+    cmd: "cp --reflink=auto '{{ custom_image }}' '{{ base_image_pathname }}'"
+  when:
+    - custom_image_stat.stat.exists or custom_image_download is changed
+    - custom_image != base_image_pathname
+
+- name: Set proper permissions on base image
+  become: true
+  become_method: ansible.builtin.sudo
+  ansible.builtin.file:
+    path: "{{ base_image_pathname }}"
     mode: "u=rw,g=r,o=r"
   when:
     - custom_image_stat.stat.exists or custom_image_download is changed
+    - custom_image != base_image_pathname
Signature · 1 line
2.50.1
#2 lore raw

RFC PATCH 2/8 kconfig: add KDEVOPS_MAKE_VERBOSE option for persistent verbose output

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Add a new kconfig option in the "Kdevops configuration" menu to enable verbose make output (V=1) by default. This promotes make verbosity from a command-line-only option to a first-class configuration setting.

Features:
- KDEVOPS_MAKE_VERBOSE bool option in menuconfig
- Early parsing in main Makefile before V= logic
- Command line override support with proper priority:
1. CLI V=0/V=1 (highest priority)
2. CONFIG_KDEVOPS_MAKE_VERBOSE=y (persistent default)
3. Built-in quiet mode (fallback)

Usage examples:

- make target          → Uses kconfig setting
- make V=0 target      → CLI overrides to quiet
- make V=1 target      → CLI overrides to verbose

This allows users to set a persistent verbosity preference while maintaining full command-line flexibility, following industry standard patterns used by Rust/Cargo, Kubernetes, and other tools.

Generated-by Claude AI
---
 Makefile                 |  7 +++++++
 kconfigs/Kconfig.kdevops | 18 ++++++++++++++++++
 2 files changed, 25 insertions(+)
Makefile +7 -0
index 90e8091d..9ea479c9 100644
@@ -64,6 +64,13 @@ define print_target
 	echo "==> [$1]"
 endef
 
+# Parse kconfig verbosity setting early, allow CLI to override
+ifneq (,$(wildcard .config))
+ifeq ($(CONFIG_KDEVOPS_MAKE_VERBOSE),y)
+V ?= 1
+endif
+endif
+
 ifeq ($(V),1)
 export Q=@$(call print_target,$@) && set -x &&
 export NQ=true
kconfigs/Kconfig.kdevops +18 -0
index c2362adf..d22edd01 100644
@@ -76,6 +76,24 @@ config KDEVOPS_CUSTOM_SSH_KEXALGORITHMS
 	  Some distributions, such as older distributions, may require a custom
 	  ssh configuration entry for the KexAlgorithms parameter.
 
+config KDEVOPS_MAKE_VERBOSE
+	bool "Enable verbose make output (V=1)"
+	default n
+	help
+	  Enable verbose output for all make operations. This is equivalent
+	  to running 'make V=1' and shows all executed commands for debugging.
+
+	  When enabled, you'll see:
+	  - All shell commands being executed
+	  - Full ansible-playbook command lines
+	  - Detailed build output
+
+	  This is useful for debugging build issues and understanding what
+	  kdevops is doing behind the scenes. You can still override this
+	  setting on the command line with 'make V=0' or 'make V=1'.
+
+	  If unsure, say N.
+
 config KDEVOPS_BASELINE_AND_DEV
 	bool "Enable both a baseline and development system per target test"
 	default n
Signature · 1 line
2.50.1
#3 lore raw

RFC PATCH 3/8 defconfig: add ci fragment

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Introduce a CI-specific fragment to enable the configuration options required for continuous integration.

---
 defconfigs/configs/ci.config | 7 +++++++
 1 file changed, 7 insertions(+)
defconfigs/configs/ci.config new file +7 -0
new file mode 100644
index 00000000..00af941c
@@ -0,0 +1,7 @@
+CONFIG_ANSIBLE_CFG_CALLBACK_PLUGIN_PROFILE_TASKS=y
+CONFIG_ANSIBLE_CFG_FORKS=30
+CONFIG_BOOTLINUX_CCACHE_SYSTEM_WIDE=y
+CONFIG_BOOTLINUX_CCACHE=y
+CONFIG_BOOTLINUX_CLEAN_BEFORE_BUILD=y
+CONFIG_BOOTLINUX_REPRODUCIBLE_BUILDS=y
+CONFIG_KDEVOPS_MAKE_VERBOSE=y
Signature · 1 line
2.50.1
#4 lore raw

RFC PATCH 4/8 ansible: enhance DIY callback output format for improved readability

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Improve the DIY callback output format to provide cleaner, more scannable task execution display:

- Show target hosts in task start messages using ansible_play_hosts
- Use visual status indicators: ✓ for success, ⊘ for skipped tasks
- Remove redundant task name repetition in completion messages
- Add indentation to status messages for better visual hierarchy
- Remove unnecessary "start:" messages to reduce noise
- Keep (changed) and FAILED messages with full context

Output format:
TASK: Task name [target,hosts]
✓ [actual_host]
⊘ [skipped_host]

This creates clean, scannable output similar to systemd service status with clear visual indicators while showing host targeting information upfront and execution results with proper visual hierarchy.

Generated-by Claude AI
---
 playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 +6 -6
index f3cc1797..c8981e09 100644
@@ -17,17 +17,17 @@ inventory = {{ ansible_cfg_inventory }}
 [callback_diy]
 playbook_on_play_start_msg = PLAY: {{ '{{' }} ansible_callback_diy.play.name | default('') | upper {{ '}}' }}
 playbook_on_play_start_msg_color = bright blue
-playbook_on_task_start_msg = TASK: {{ '{{' }} ansible_callback_diy.task.name | default('') {{ '}}' }}
+playbook_on_task_start_msg = TASK: {{ '{{' }} ansible_callback_diy.task.name | default('') {{ '}}' }} [{{ '{{' }} ansible_play_hosts | join(',') {{ '}}' }}]
 playbook_on_task_start_msg_color = yellow
-runner_on_start_msg = start: [{{ '{{' }} ansible_callback_diy.host.name | default('host') {{ '}}' }}]
+runner_on_start_msg =
 runner_on_start_msg_color = yellow
-runner_on_ok_msg = ok: [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}]
+runner_on_ok_msg = ⠀⠀✓ [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}]
 runner_on_ok_msg_color = green
-runner_on_changed_msg = changed: [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}]
+runner_on_changed_msg = ⠀⠀(changed) [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}]
 runner_on_changed_msg_color = bright yellow
-runner_on_failed_msg = FAILED: [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}] => {{ '{{' }} msg | default('') {{ '}}' }}{{ '{%' }} if stderr is defined and stderr | length > 0 {{ '%}' }} STDERR: {{ '{{' }} stderr {{ '}}' }}{{ '{%' }} endif {{ '%}' }}{{ '{%' }} if stdout is defined and stdout | length > 0 {{ '%}' }} STDOUT: {{ '{{' }} stdout {{ '}}' }}{{ '{%' }} endif {{ '%}' }}
+runner_on_failed_msg = ⠀⠀FAILED: [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}] => {{ '{{' }} msg | default('') {{ '}}' }}{{ '{%' }} if stderr is defined and stderr | length > 0 {{ '%}' }} STDERR: {{ '{{' }} stderr {{ '}}' }}{{ '{%' }} endif {{ '%}' }}{{ '{%' }} if stdout is defined and stdout | length > 0 {{ '%}' }} STDOUT: {{ '{{' }} stdout {{ '}}' }}{{ '{%' }} endif {{ '%}' }}
 runner_on_failed_msg_color = bright red
-runner_on_skipped_msg = skipped: [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}]
+runner_on_skipped_msg = ⠀⠀⊘ [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}]
 runner_on_skipped_msg_color = cyan
 runner_on_unreachable_msg = UNREACHABLE: [{{ '{{' }} ansible_callback_diy.result.host | default('host') {{ '}}' }}]
 runner_on_unreachable_msg_color = bright magenta
Signature · 1 line
2.50.1
#5 lore raw

RFC PATCH 5/8 ansible: add profile_tasks callback timing analysis support

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Add new Kconfig option ANSIBLE_CFG_CALLBACK_PLUGIN_PROFILE_TASKS to enable the ansible.posix.profile_tasks callback plugin.

This provides timing analysis similar to systemd-analyze blame, showing task execution times and generating a TASKS RECAP section with the slowest tasks at the end of playbook execution.

The option is disabled by default to maintain clean output for existing workflows, but can be enabled when performance analysis is needed.

Generated-by Claude AI
---
 kconfigs/Kconfig.ansible_cfg                         | 14 ++++++++++++++
 playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 |  8 ++++++++
 2 files changed, 22 insertions(+)
kconfigs/Kconfig.ansible_cfg +14 -0
index 430c0e4c..c04532e8 100644
@@ -156,6 +156,20 @@ config ANSIBLE_CFG_CALLBACK_PLUGIN_SHOW_TASK_PATH_ON_FAILURE
 	  the line number. This information is displayed automatically for every task when
 	  running with -vv or greater verbosity.
 	  https://docs.ansible.com/ansible/latest/collections/community/general/dense_callback.html#parameter-show_task_path_on_failure
+
+config ANSIBLE_CFG_CALLBACK_PLUGIN_PROFILE_TASKS
+	bool "Enable profile_tasks callback for timing analysis"
+	output yaml
+	default n
+	help
+	  Enable the profile_tasks callback plugin to provide timing analysis
+	  similar to systemd-analyze blame. This shows how long each task takes
+	  to execute and provides a summary of the slowest tasks at the end.
+
+	  When enabled, this adds timing information to playbook execution
+	  and generates a "TASKS RECAP" section showing execution times.
+
+	  https://docs.ansible.com/ansible/latest/collections/ansible/posix/profile_tasks_callback.html
 endmenu
 
 config ANSIBLE_CFG_DEPRECATION_WARNINGS
playbooks/roles/ansible_cfg/templates/ansible.cfg.j2 +8 -0
index c8981e09..f3f6c723 100644
@@ -1,4 +1,7 @@
 [defaults]
+{% if ansible_cfg_callback_plugin_profile_tasks %}
+callbacks_enabled = ansible.posix.profile_tasks, {{ ansible_cfg_callback_plugin_string }}
+{% endif %}
 deprecation_warnings = {{ ansible_cfg_deprecation_warnings }}
 stdout_callback = {{ ansible_cfg_callback_plugin_string }}
 check_mode_markers = {{ ansible_cfg_callback_plugin_check_mode_markers }}
@@ -39,6 +42,11 @@ playbook_on_stats_msg = PLAYBOOK SUMMARY
  {{ '{%' }} endfor {{ '%}' }}
 playbook_on_stats_msg_color = bright green
 {% endif %}
+{% if ansible_cfg_callback_plugin_profile_tasks %}
+
+[callback_profile_tasks]
+summary_only = true
+{% endif %}
 {% if ansible_facts['distribution'] == 'openSUSE' %}
 [connection]
 retries = {{ ansible_cfg_reconnection_retries }}
Signature · 1 line
2.50.1
#6 lore raw

RFC PATCH 6/8 scripts: fix CI_WORKFLOW basename mapping

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Fix CI_WORKFLOW basename mapping in scripts/ci.Makefile:
- Add mapping for XFS/fstests workflows
- Map xfs*/btrfs*/ext4*/tmpfs*/lbs-xfs* to 'fstests' basename
- Fixes 'make: Nothing to be done for ci-test' error

---
 scripts/ci.Makefile | 13 +++++++++++++
 1 file changed, 13 insertions(+)
scripts/ci.Makefile +13 -0
index 1c47c618..9d8151c3 100644
@@ -10,8 +10,21 @@ ifneq (y,$(CONFIG_WORKFLOW_LINUX_PACKAGED))
 ifeq ($(strip $(CI_WORKFLOW)),)
 CI_WORKFLOW_BASENAME := $(shell basename $(CONFIG_BOOTLINUX_TREE) | sed 's/\.git$$//')
 else
+# Map workflow names to their appropriate .ci basename
+ifeq ($(findstring xfs,$(CI_WORKFLOW)),xfs)
+CI_WORKFLOW_BASENAME := fstests
+else ifeq ($(findstring btrfs,$(CI_WORKFLOW)),btrfs)
+CI_WORKFLOW_BASENAME := fstests
+else ifeq ($(findstring ext4,$(CI_WORKFLOW)),ext4)
+CI_WORKFLOW_BASENAME := fstests
+else ifeq ($(findstring tmpfs,$(CI_WORKFLOW)),tmpfs)
+CI_WORKFLOW_BASENAME := fstests
+else ifeq ($(findstring lbs-xfs,$(CI_WORKFLOW)),lbs-xfs)
+CI_WORKFLOW_BASENAME := fstests
+else
 CI_WORKFLOW_BASENAME := $(shell basename $(CI_WORKFLOW))
 endif
+endif
 
 ifneq ($(wildcard .ci/build-test/$(CI_WORKFLOW_BASENAME)),)
 ifneq ($(wildcard .ci/test/$(CI_WORKFLOW_BASENAME)),)
Signature · 1 line
2.50.1
#7 lore raw

RFC PATCH 7/8 fstests: fix ansible_host undefined error

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Fix Ansible template error: 'ansible_host' is undefined
- Replace ansible_host with (ansible_host | default(inventory_hostname))
- Issue occurs when hosts file uses simple hostname entries without explicit ansible_host definitions
- Template now falls back to inventory_hostname when ansible_host unavailable

Root cause: fstests role assumed ansible_host always available, but libvirt/simple inventory setups only define inventory_hostname. The undefined template variable caused task failure and subsequent hang.

Generated-by Claude AI
---
 playbooks/roles/fstests/tasks/main.yml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
playbooks/roles/fstests/tasks/main.yml +5 -5
index 3a57a73b..f12bfdae 100644
@@ -730,7 +730,7 @@
 - name: Set the export volname prefix
   tags: vars
   ansible.builtin.set_fact:
-    volname_prefix: "{{ ansible_host | regex_replace(kdevops_host_prefix + '-') }}-fs"
+    volname_prefix: "{{ (ansible_host | default(inventory_hostname)) | regex_replace(kdevops_host_prefix + '-') }}-fs"
   when:
     - fstests_fstyp == "nfs" or fstests_fstyp == "cifs"
 
@@ -919,7 +919,7 @@
 
 - name: Verify section name {{ fstests_section }} exists on fstests config file
   vars:
-    fstests_section: "{{ ansible_host | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') | regex_replace('-', '_') }}"
+    fstests_section: "{{ (ansible_host | default(inventory_hostname)) | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') | regex_replace('-', '_') }}"
   tags: ["oscheck", "fstests", "run_tests", "section"]
   become: true
   become_flags: "su - -c"
@@ -970,7 +970,7 @@
 
 - name: Check and verify fstests dependencies are met prior to running fstests
   vars:
-    fstests_section: "{{ ansible_host | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') | regex_replace('-', '_') }}"
+    fstests_section: "{{ (ansible_host | default(inventory_hostname)) | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') | regex_replace('-', '_') }}"
   tags: ["oscheck", "fstests", "run_tests"]
   become: true
   become_flags: "su - -c"
@@ -1194,7 +1194,7 @@
 
 - name: Run oscheck-get-failures.sh to get list of known failed tests
   vars:
-    fstests_section: "{{ ansible_host | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') | regex_replace('-', '_') }}"
+    fstests_section: "{{ (ansible_host | default(inventory_hostname)) | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') | regex_replace('-', '_') }}"
   tags: ["oscheck", "fstests", "run_tests"]
   ansible.builtin.command: "{{ kdevops_data }}/workflows/fstests/scripts/oscheck-get-failures.sh --test-section {{ fstests_section }}"
   args:
@@ -1254,7 +1254,7 @@
 - name: Run fstests using ./oscheck.sh --print-start --journal {{ fstests_journal }} --print-done --test-section {{ fstests_section }} {{ oscheck_extra_args }} {{
     all_limit_tests }}
   vars:
-    fstests_section: "{{ ansible_host | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') | regex_replace('-', '_') }}"
+    fstests_section: "{{ (ansible_host | default(inventory_hostname)) | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') | regex_replace('-', '_') }}"
     initial_baseline_expunges: "{{ fstests_initial_baseline_args | trim }}"
     skip_tests_args: "{{ fstests_skip_tests_args | trim }}"
   tags: ["oscheck", "fstests", "run_tests"]
Signature · 1 line
2.50.1
#8 lore raw

RFC PATCH 8/8 github: refactor into reusable actions and workflows

In reply to Daniel Gomez

From: Daniel Gomez <[email protected]>

Refactor the .github/ CI support into reusable actions and workflows. This allows to use the new actions not only internally in kdevops but also in other projects such linux-modules-kpd and similar. Keeping the ci logic in one place and allowing other projects to get the latest changes.

CI supports the following:
- Split workflow in setup, test, archive and cleanup actions
- Fixed kernel: v6.15 on linux tree. This is to speed up builds relying on the same kernel. We can update when needed or timely basis
- Fixed workflows: blktests_nvme and xfs_reflink_4k. We want to validate kdevops workflows and blktests with nvme section/profile has been added on top of the current fstests/xfs reflink 4k
- 2 CI modes:
A. kdevops selftest/ci validation. A single test execution for the given workflow (e.g. generic/003 for xfs). This has it's own commit format. B. kdevops full workflow. This is to validate a specific kernel on a given test suite. It's supported on manual trigger as well as on schedule.
Add automatic runner assignment based on ci_workflow names to enable parallel execution on dedicated runners:
- Parallelize GitHub workflow execution on dedicated runners based on CI_WORKFLOW names (using tags).
E.g.:
* blktests workflows → [self-hosted, Linux, X64, blktests]
* xfs workflows → [self-hosted, Linux, X64, xfs]
- Set timeout 120 minutes for CI B mode.
- Disable fail-fast to matrix strategy in both push.yml and schedule.yml workflows to prevent cancellation of successful jobs when other matrix jobs fail. Example: this allows blktests_nvme to continue running even if xfs_reflink_4k fails

---
 .github/actions/archive/action.yml    |  28 ++++
 .github/actions/cleanup/action.yml    |  24 ++++
 .github/actions/setup/action.yml      | 187 ++++++++++++++++++++++++
 .github/actions/test/action.yml       | 213 +++++++++++++++++++++++++++
 .github/workflows/destroy.yml         |  93 ++++++++++++
 .github/workflows/docker-tests.yml    |   2 +-
 .github/workflows/fstests.yml         |  98 -------------
 .github/workflows/main.yml            |  97 +++++++++++++
 .github/workflows/manual.yml          | 122 ++++++++++++++++
 .github/workflows/push.yml            |  29 ++++
 .github/workflows/schedule.yml        |  54 +++++++
 scripts/generate_ci_commit_message.sh | 263 ++++++++++++++++++++++++++++++++++
 scripts/github_output.sh              |   9 ++
 scripts/korg-releases.py              |  94 ++++++++++++
 14 files changed, 1214 insertions(+), 99 deletions(-)
.github/actions/archive/action.yml new file +28 -0
new file mode 100644
index 00000000..6efe20fc
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0
+---
+name: Archive results
+description: Archive kdevops results in https://github.com/linux-kdevops/kdevops-results-archive.git
+inputs:
+  ci_workflow:
+    required: false
+    type: string
+    default: 'demo'
+  dir:
+    description: 'Directory'
+    required: true
+    default: 'workdir'
+
+runs:
+  using: "composite"
+  steps:
+    - name: Get systemd journal files
+      working-directory: ${{ inputs.dir }}/kdevops
+      shell: bash
+      run: |
+        make journal-dump
+
+    - name: Build our kdevops archive results
+      working-directory: ${{ inputs.dir }}/kdevops
+      shell: bash
+      run: |
+        make ci-archive CI_WORKFLOW="${{ inputs.ci_workflow }}"
.github/actions/cleanup/action.yml new file +24 -0
new file mode 100644
index 00000000..18a8656a
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0
+---
+name: Cleanup kdevops VMs
+description: Destroy VMs and cleanup workspace
+
+inputs:
+  dir:
+    description: 'Directory'
+    required: true
+    default: 'workdir'
+
+runs:
+  using: "composite"
+  steps:
+    - name: Run kdevops make destroy
+      working-directory: ${{ inputs.dir }}/kdevops
+      shell: bash
+      run: |
+        make destroy
+
+    - name: Remove working-directory
+      shell: bash
+      run: |
+        rm --recursive --force --verbose ${{ inputs.dir }}
.github/actions/setup/action.yml new file +187 -0

187 lines not on this page · raw message

.github/actions/test/action.yml new file +213 -0

213 lines not on this page · raw message

.github/workflows/destroy.yml new file +93 -0

93 lines not on this page · raw message

.github/workflows/docker-tests.yml +1 -1
index c0e0d03d..33d67f09 100644
@@ -1,4 +1,4 @@
-name: Setup kdevops
+name: kdevops Docker Tests
 
 on:
   push:
.github/workflows/fstests.yml deleted +0 -98

98 lines not on this page · raw message

.github/workflows/main.yml new file +97 -0

97 lines not on this page · raw message

.github/workflows/manual.yml new file +122 -0

122 lines not on this page · raw message

.github/workflows/push.yml new file +29 -0
new file mode 100644
index 00000000..561e873e
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: GPL-2.0
+---
+name: Run kdevops CI Workflow - Push/PR
+
+on:
+  push:
+    branches:
+      - '**'
+  pull_request:
+    branches:
+      - '**'
+
+jobs:
+  push-pr:
+    name: Push/PR kdevops CI
+    uses: ./.github/workflows/main.yml
+    secrets: inherit
+    strategy:
+      fail-fast: false  # Don't cancel other jobs if one fails
+      matrix:
+        ci_workflow:
+          - blktests_nvme
+          - xfs_reflink_4k
+    with:
+      ci_workflow: ${{ matrix.ci_workflow }}
+      kernel_ref: 'v6.15'
+      kernel_tree: 'linux'
+      test_mode: 'kdevops-validation'
+      tests: ''
.github/workflows/schedule.yml new file +54 -0

54 lines not on this page · raw message

scripts/generate_ci_commit_message.sh new file +263 -0

264 lines not on this page · raw message

scripts/github_output.sh new file +9 -0
new file mode 100755
index 00000000..711306c3
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+#
+# Usage: ./github_output.sh key value
+set -euxo pipefail
+
+key="$1"
+value="$2"
+
+echo "$key=$value" >> "$GITHUB_OUTPUT"
scripts/korg-releases.py new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.50.1
#9 lore raw
In reply to Daniel Gomez
Quoted 3 lines · Daniel Gomez

Refactor the .github/ CI setup into modular and reusable workflows and actions. This makes it possible to share modules from kdevops repo and reuse them in other GitHub projects.

Thanks! Applied and pushed.

Luis