From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52ADB2E11DE for ; Mon, 11 Aug 2025 22:43:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754952192; cv=none; b=YEPJCQakraRw3kgLXuzciGk8eXpZx3Akspo55DV+su28zSyDMcNn3TAFCU31RvNc4ioynSgXBm92GTGbtnRvkhqC0DsjNR6zaB2aV1W9ONw+nqNY2gAuKbb3phuukuXCp9SxzdAURXrbgADfiMwbsBvj1Q5Yd1QRufqMpKMjzbQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754952192; c=relaxed/simple; bh=IfJ2l2qhQ87aHaLenffRIwpvxVyOtxiEWuor5MI9Y5c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qvCn0+SX4aUmGjQegzWolF/IHsseuB+kw0f44MYuPKqf/Krs2m6KpQ6iGnCcBl/EuGnUX7BiMzleJZRGI/9DoANKgTn44HrR3prxTOI0YDAZCmJPg9VmDccp+Z8oMAvLB6tE4iJl9xHeTTVc4cYAQ+GqKFF28FPccFvQppRwrw8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=wJSMqqpY; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="wJSMqqpY" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=G3syd8xGfJ9z0wZaW1vZRz26H9nCSmvUEOVX5pg5WR0=; b=wJSMqqpYAK2Y3F87zwkm0AS/CU SvgG/A61BRNkC9Z7LXFRMHICiFo08h6CJVvjlFN8SjLc2WWNwYQUI6y/VnB8uJbrl0RTS+RahEXmW QUi8REX4r3s0MfeH6+IF/qv1x0XEuukZVFnUXcgaYzLbRGMl/+/awXTZxJWWDUuVanzh4cPWoUeae GbIt94xctaksWZlgJj6+b3Nsw3B3Hvi4u1PTYpyEihw3SxpRZVh8IMZw+k6+26DzZ73zi84+rUHvZ sTUFCNWzS31TY4lUZg4WNouuQqgBDnh+C/YmYR1xSX9VZvvS51jgslFYjEfl5wmTIggOI3bMJPGfS si1JRD6g==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ulbET-00000009J8Y-3v2p; Mon, 11 Aug 2025 22:43:09 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [PATCH 6/8] bootlinux: enhance A/B testing and repository management Date: Mon, 11 Aug 2025 15:43:05 -0700 Message-ID: <20250811224307.2218478-7-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250811224307.2218478-1-mcgrof@kernel.org> References: <20250811224307.2218478-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain 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 --- 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