From: Luis Chamberlain <mcgrof@kernel.org>
To: Chuck Lever <cel@kernel.org>, Daniel Gomez <da.gomez@kruces.com>,
kdevops@lists.linux.dev
Cc: Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 6/8] bootlinux: enhance A/B testing and repository management
Date: Mon, 11 Aug 2025 15:43:05 -0700 [thread overview]
Message-ID: <20250811224307.2218478-7-mcgrof@kernel.org> (raw)
In-Reply-To: <20250811224307.2218478-1-mcgrof@kernel.org>
Improve git repository handling and A/B testing capabilities:
- Add intelligent fallback logic for git ref resolution
- Handle both direct refs and tag resolution gracefully
- Improve error handling for missing or invalid refs
- Add better debugging output for git operations
- Update defconfig to enable 4K reflink testing
- Exclude linux directory from newline checking script
These changes make the bootlinux workflow more robust when dealing
with different git ref types and improve the A/B testing experience
with better error reporting and fallback mechanisms.
Generated-by: Claude AI
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
defconfigs/xfs_reflink_lbs | 1 +
playbooks/roles/bootlinux/tasks/build/9p.yml | 44 +++++++++++++++++--
.../roles/bootlinux/tasks/build/builder.yml | 39 ++++++++++++++--
.../roles/bootlinux/tasks/build/targets.yml | 39 ++++++++++++++--
scripts/ensure_newlines.py | 3 +-
5 files changed, 113 insertions(+), 13 deletions(-)
diff --git a/defconfigs/xfs_reflink_lbs b/defconfigs/xfs_reflink_lbs
index 77a94200..f20fa15a 100644
--- a/defconfigs/xfs_reflink_lbs
+++ b/defconfigs/xfs_reflink_lbs
@@ -20,6 +20,7 @@ CONFIG_FSTESTS_XFS_ENABLE_LBS=y
CONFIG_FSTESTS_XFS_ENABLE_LBS_4KS=y
CONFIG_FSTESTS_XFS_SECTION_REFLINK_ENABLED=y
+CONFIG_FSTESTS_XFS_SECTION_REFLINK_4K=y
CONFIG_FSTESTS_XFS_SECTION_REFLINK_8K_4KS=y
CONFIG_FSTESTS_XFS_SECTION_REFLINK_16K_4KS=y
CONFIG_FSTESTS_XFS_SECTION_REFLINK_32K_4KS=y
diff --git a/playbooks/roles/bootlinux/tasks/build/9p.yml b/playbooks/roles/bootlinux/tasks/build/9p.yml
index d0ae61ad..4c6e37a3 100644
--- a/playbooks/roles/bootlinux/tasks/build/9p.yml
+++ b/playbooks/roles/bootlinux/tasks/build/9p.yml
@@ -68,6 +68,7 @@
run_once: true
delegate_to: localhost
+
- name: Verify target git ref exists before cloning
command: "git ls-remote {{ target_linux_git }} {{ active_linux_ref | default(target_linux_ref) }}"
register: ref_check
@@ -181,10 +182,24 @@
- git_directory_stat.stat.exists
- target_ref_sha.rc != 0
-- name: Get target ref SHA after fetch
+- name: Try to resolve ref as direct ref after fetch
command: "git -C {{ bootlinux_9p_host_path }} rev-parse {{ active_linux_ref | default(target_linux_ref) }}"
- register: target_ref_sha_after_fetch
+ register: target_ref_sha_direct
+ changed_when: false
+ failed_when: false
+ run_once: true
+ delegate_to: localhost
+ when:
+ - not needs_git_clone|bool
+ - target_directory_stat.stat.exists
+ - git_directory_stat.stat.exists
+ - target_ref_sha.rc != 0
+
+- name: Try to resolve ref as remote branch if direct ref failed
+ command: "git -C {{ bootlinux_9p_host_path }} rev-parse origin/{{ active_linux_ref | default(target_linux_ref) }}"
+ register: target_ref_sha_remote
changed_when: false
+ failed_when: false
run_once: true
delegate_to: localhost
when:
@@ -192,9 +207,29 @@
- target_directory_stat.stat.exists
- git_directory_stat.stat.exists
- target_ref_sha.rc != 0
+ - target_ref_sha_direct.rc != 0
+
+- name: Set resolved ref for checkout
+ set_fact:
+ resolved_ref: |
+ {%- if target_ref_sha.rc == 0 -%}
+ {{ active_linux_ref | default(target_linux_ref) }}
+ {%- elif target_ref_sha_direct is defined and target_ref_sha_direct.rc == 0 -%}
+ {{ active_linux_ref | default(target_linux_ref) }}
+ {%- elif target_ref_sha_remote is defined and target_ref_sha_remote.rc == 0 -%}
+ origin/{{ active_linux_ref | default(target_linux_ref) }}
+ {%- else -%}
+ {{ active_linux_ref | default(target_linux_ref) }}
+ {%- endif -%}
+ run_once: true
+ delegate_to: localhost
+ when:
+ - not needs_git_clone|bool
+ - target_directory_stat.stat.exists
+ - git_directory_stat.stat.exists
- name: Checkout target ref if not on correct ref
- command: "git -C {{ bootlinux_9p_host_path }} checkout {{ active_linux_ref | default(target_linux_ref) }}"
+ command: "git -C {{ bootlinux_9p_host_path }} checkout {{ resolved_ref | default(active_linux_ref | default(target_linux_ref)) }}"
run_once: true
delegate_to: localhost
when:
@@ -202,7 +237,8 @@
- target_directory_stat.stat.exists
- git_directory_stat.stat.exists
- (target_ref_sha.rc == 0 and current_ref.stdout != target_ref_sha.stdout) or
- (target_ref_sha.rc != 0 and target_ref_sha_after_fetch is defined and target_ref_sha_after_fetch.rc == 0)
+ (target_ref_sha.rc != 0 and (target_ref_sha_direct is defined and target_ref_sha_direct.rc == 0)) or
+ (target_ref_sha.rc != 0 and (target_ref_sha_remote is defined and target_ref_sha_remote.rc == 0))
- name: Copy kernel delta if requested on the control node
template:
diff --git a/playbooks/roles/bootlinux/tasks/build/builder.yml b/playbooks/roles/bootlinux/tasks/build/builder.yml
index 1213c56f..014a341d 100644
--- a/playbooks/roles/bootlinux/tasks/build/builder.yml
+++ b/playbooks/roles/bootlinux/tasks/build/builder.yml
@@ -137,24 +137,55 @@
- git_directory_stat.stat.exists
- target_ref_sha.rc != 0
-- name: Get target ref SHA after fetch
+- name: Try to resolve ref as direct ref after fetch
command: "git -C {{ target_linux_dir_path }} rev-parse {{ target_linux_ref }}"
- register: target_ref_sha_after_fetch
+ register: target_ref_sha_direct
changed_when: false
+ failed_when: false
when:
- not needs_git_clone|bool
- target_directory_stat.stat.exists
- git_directory_stat.stat.exists
- target_ref_sha.rc != 0
+- name: Try to resolve ref as remote branch if direct ref failed
+ command: "git -C {{ target_linux_dir_path }} rev-parse origin/{{ target_linux_ref }}"
+ register: target_ref_sha_remote
+ changed_when: false
+ failed_when: false
+ when:
+ - not needs_git_clone|bool
+ - target_directory_stat.stat.exists
+ - git_directory_stat.stat.exists
+ - target_ref_sha.rc != 0
+ - target_ref_sha_direct.rc != 0
+
+- name: Set resolved ref for checkout
+ set_fact:
+ resolved_ref: |
+ {%- if target_ref_sha.rc == 0 -%}
+ {{ target_linux_ref }}
+ {%- elif target_ref_sha_direct is defined and target_ref_sha_direct.rc == 0 -%}
+ {{ target_linux_ref }}
+ {%- elif target_ref_sha_remote is defined and target_ref_sha_remote.rc == 0 -%}
+ origin/{{ target_linux_ref }}
+ {%- else -%}
+ {{ target_linux_ref }}
+ {%- endif -%}
+ when:
+ - not needs_git_clone|bool
+ - target_directory_stat.stat.exists
+ - git_directory_stat.stat.exists
+
- name: Checkout target ref if not on correct ref
- command: "git -C {{ target_linux_dir_path }} checkout {{ target_linux_ref }}"
+ command: "git -C {{ target_linux_dir_path }} checkout {{ resolved_ref | default(target_linux_ref) }}"
when:
- not needs_git_clone|bool
- target_directory_stat.stat.exists
- git_directory_stat.stat.exists
- (target_ref_sha.rc == 0 and current_ref.stdout != target_ref_sha.stdout) or
- (target_ref_sha.rc != 0 and target_ref_sha_after_fetch is defined and target_ref_sha_after_fetch.rc == 0)
+ (target_ref_sha.rc != 0 and (target_ref_sha_direct is defined and target_ref_sha_direct.rc == 0)) or
+ (target_ref_sha.rc != 0 and (target_ref_sha_remote is defined and target_ref_sha_remote.rc == 0))
- name: Copy the kernel delta to the builder
ansible.builtin.template:
diff --git a/playbooks/roles/bootlinux/tasks/build/targets.yml b/playbooks/roles/bootlinux/tasks/build/targets.yml
index 87393c74..5942d2be 100644
--- a/playbooks/roles/bootlinux/tasks/build/targets.yml
+++ b/playbooks/roles/bootlinux/tasks/build/targets.yml
@@ -139,24 +139,55 @@
- git_directory_stat.stat.exists
- target_ref_sha.rc != 0
-- name: Get target ref SHA after fetch
+- name: Try to resolve ref as direct ref after fetch
command: "git -C {{ target_linux_dir_path }} rev-parse {{ target_linux_ref }}"
- register: target_ref_sha_after_fetch
+ register: target_ref_sha_direct
changed_when: false
+ failed_when: false
when:
- not needs_git_clone|bool
- target_directory_stat.stat.exists
- git_directory_stat.stat.exists
- target_ref_sha.rc != 0
+- name: Try to resolve ref as remote branch if direct ref failed
+ command: "git -C {{ target_linux_dir_path }} rev-parse origin/{{ target_linux_ref }}"
+ register: target_ref_sha_remote
+ changed_when: false
+ failed_when: false
+ when:
+ - not needs_git_clone|bool
+ - target_directory_stat.stat.exists
+ - git_directory_stat.stat.exists
+ - target_ref_sha.rc != 0
+ - target_ref_sha_direct.rc != 0
+
+- name: Set resolved ref for checkout
+ set_fact:
+ resolved_ref: |
+ {%- if target_ref_sha.rc == 0 -%}
+ {{ target_linux_ref }}
+ {%- elif target_ref_sha_direct is defined and target_ref_sha_direct.rc == 0 -%}
+ {{ target_linux_ref }}
+ {%- elif target_ref_sha_remote is defined and target_ref_sha_remote.rc == 0 -%}
+ origin/{{ target_linux_ref }}
+ {%- else -%}
+ {{ target_linux_ref }}
+ {%- endif -%}
+ when:
+ - not needs_git_clone|bool
+ - target_directory_stat.stat.exists
+ - git_directory_stat.stat.exists
+
- name: Checkout target ref if not on correct ref
- command: "git -C {{ target_linux_dir_path }} checkout {{ target_linux_ref }}"
+ command: "git -C {{ target_linux_dir_path }} checkout {{ resolved_ref | default(target_linux_ref) }}"
when:
- not needs_git_clone|bool
- target_directory_stat.stat.exists
- git_directory_stat.stat.exists
- (target_ref_sha.rc == 0 and current_ref.stdout != target_ref_sha.stdout) or
- (target_ref_sha.rc != 0 and target_ref_sha_after_fetch is defined and target_ref_sha_after_fetch.rc == 0)
+ (target_ref_sha.rc != 0 and (target_ref_sha_direct is defined and target_ref_sha_direct.rc == 0)) or
+ (target_ref_sha.rc != 0 and (target_ref_sha_remote is defined and target_ref_sha_remote.rc == 0))
- name: Copy kernel delta if requested on the target nodes
template:
diff --git a/scripts/ensure_newlines.py b/scripts/ensure_newlines.py
index 969cf32a..f82ba136 100755
--- a/scripts/ensure_newlines.py
+++ b/scripts/ensure_newlines.py
@@ -45,7 +45,8 @@ def main():
dirs[:] = [
d
for d in dirs
- if not d.startswith(".") and d not in ["__pycache__", "node_modules"]
+ if not d.startswith(".")
+ and d not in ["__pycache__", "node_modules", "linux"]
]
for file in files:
--
2.47.2
next prev parent reply other threads:[~2025-08-11 22:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 22:42 [PATCH 0/8] linux-ab enhancements + monitor support Luis Chamberlain
2025-08-11 22:43 ` [PATCH 1/8] bootlinux: use different kernel for A/B testing by default Luis Chamberlain
2025-08-11 22:43 ` [PATCH 2/8] bootlinux: add support for custom refs on dev kernels on the CLI Luis Chamberlain
2025-08-11 22:43 ` [PATCH 3/8] bootlinux: add git ref verification before cloning Luis Chamberlain
2025-08-11 22:43 ` [PATCH 4/8] bootlinux: add git dirty check " Luis Chamberlain
2025-08-11 22:43 ` [PATCH 5/8] bootlinux: add intelligent git repository detection and management Luis Chamberlain
2025-08-11 22:43 ` Luis Chamberlain [this message]
2025-08-11 22:43 ` [PATCH 7/8] fstests: add make target for running tests on all hosts Luis Chamberlain
2025-08-11 22:43 ` [PATCH 8/8] monitoring: integrate monitoring collection into fstests workflow Luis Chamberlain
2025-08-11 22:46 ` Luis Chamberlain
2025-08-12 0:49 ` Luis Chamberlain
2025-08-14 0:59 ` Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250811224307.2218478-7-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=cel@kernel.org \
--cc=da.gomez@kruces.com \
--cc=kdevops@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox