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 2FF382DBF5E 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=1754952193; cv=none; b=WvstSarnb+s8JtTusDFkicuvgmGZUh4Fl/UNVBvWvGxik+6ifQXNkN+ZEeEpFjUjGbTU5BfwfPbMx9+3gnjn0C/CLf5C2LVJRUVx9UmwYs8oRZS4qzol225mU4e0QlTUlj/KMyS2PNEt5jsfB6dR3F1/+43ZIS4VQudgWTSKLAc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754952193; c=relaxed/simple; bh=zVHFLo3HWsPKco0usgExDY2FJxTrxM7OU0j1LexlqD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WGa6ABNEYtovblaxO7v3rnFiGckjnyMxZJFB+7pwq/wbJoO/dwzJMalo3aKi9ZkIb2+OHEZLcbs9kW+GeJaInwpNjCUeXKqCaRt07PhdKtiAoFyNjQnpPE8Bza/cIFjuTQ2pSsGEpM9zGXyMwCNDD1mbjQh7w0IWulOGz4J4gQw= 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=WKsCbQdw; 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="WKsCbQdw" 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=LkgGlh+egtW8qHVbyjNCjXWCCQD0f0llioHcmal+2AM=; b=WKsCbQdwNxj63zX4WoeR/Qc2HP Rk+NkyAaA9mVf5X0BGAtkDsK2IFpHsSZmrzqFJDGSOLhVdspZAt8XAKeAG6gZmzYcr1lo1FDOXadn FXbq+brdQpKpZ78DS334jYJj0ZP2sdenz7TXdERhu4itUfqzfeCnwL7ghKXHZM8WNIB8uzi4vnEaB iro3Y4nZMz5LK8MYnWQSuh+C8Yi3hnijRcuo4GO/DwX6x52/WWrfyclPJT8a9fsAdpvOPKbSTHVtB zYV8+kB16yAmMCi/wpdvPLoCXcSgk/VtZoOB3EEZyVLNhNcN4SlejRvik2Dds8s9S+R5kGvpbm+sO oBLjR93Q==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ulbET-00000009J8H-3UkF; 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 3/8] bootlinux: add git ref verification before cloning Date: Mon, 11 Aug 2025 15:43:02 -0700 Message-ID: <20250811224307.2218478-4-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 Add preliminary verification tasks to check if the target git ref exists before attempting to clone the Linux kernel repository. This prevents confusing git clone failures and provides clear, actionable error messages to users. The verification is particularly important for A/B testing scenarios where: - Different kernel refs may be used for baseline vs development builds - Shallow clones might not contain all required refs - Users may specify refs that don't exist in the repository Each build method now verifies the ref availability: - 9p.yml: Verifies active_linux_ref (or target_linux_ref fallback) - targets.yml: Verifies target_linux_ref on target nodes - builder.yml: Verifies target_linux_ref on builder nodes The error messages guide users to: 1. Check if the ref actually exists in the repository 2. Disable shallow cloning when using A/B testing with different refs 3. Verify the repository URL is correct and accessible This change improves the user experience by failing fast with helpful diagnostics rather than letting git clone fail with cryptic errors. Generated-by: Claude AI Signed-off-by: Luis Chamberlain --- playbooks/roles/bootlinux/tasks/build/9p.yml | 29 +++++++++++++++++++ .../roles/bootlinux/tasks/build/builder.yml | 21 ++++++++++++++ .../roles/bootlinux/tasks/build/targets.yml | 22 ++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/playbooks/roles/bootlinux/tasks/build/9p.yml b/playbooks/roles/bootlinux/tasks/build/9p.yml index 1951e50e..98cbcb3c 100644 --- a/playbooks/roles/bootlinux/tasks/build/9p.yml +++ b/playbooks/roles/bootlinux/tasks/build/9p.yml @@ -44,6 +44,35 @@ - bootlinux_tree_set_by_cli|bool - not target_directory_stat.stat.exists +- 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 + run_once: true + delegate_to: localhost + when: + - not bootlinux_tree_set_by_cli|bool + tags: [ 'clone'] + +- name: Fail if git ref does not exist + fail: + msg: | + Failed to verify git ref '{{ active_linux_ref | default(target_linux_ref) }}' exists in repository '{{ target_linux_git }}'. + + This typically happens when: + 1. The ref (branch/tag/commit) doesn't exist in the repository + 2. You're using A/B testing with a shallow clone that doesn't contain the required ref + 3. The repository URL is incorrect or inaccessible + + Please verify: + - The ref '{{ active_linux_ref | default(target_linux_ref) }}' exists in the repository + - If using A/B testing with different refs, ensure shallow cloning is disabled + - The repository URL '{{ target_linux_git }}' is correct and accessible + when: + - not bootlinux_tree_set_by_cli|bool + - ref_check.rc != 0 + run_once: true + delegate_to: localhost + - name: git clone {{ target_linux_tree }} on the control node git: repo: "{{ target_linux_git }}" diff --git a/playbooks/roles/bootlinux/tasks/build/builder.yml b/playbooks/roles/bootlinux/tasks/build/builder.yml index c4c4b950..73cc6694 100644 --- a/playbooks/roles/bootlinux/tasks/build/builder.yml +++ b/playbooks/roles/bootlinux/tasks/build/builder.yml @@ -10,6 +10,27 @@ - target_linux_install_b4 - ansible_os_family == "Debian" +- name: Verify target git ref exists before cloning + command: "git ls-remote {{ target_linux_git }} {{ target_linux_ref }}" + register: ref_check + +- name: Fail if git ref does not exist + fail: + msg: | + Failed to verify git ref '{{ target_linux_ref }}' exists in repository '{{ target_linux_git }}'. + + This typically happens when: + 1. The ref (branch/tag/commit) doesn't exist in the repository + 2. You're using A/B testing with a shallow clone that doesn't contain the required ref + 3. The repository URL is incorrect or inaccessible + + Please verify: + - The ref '{{ target_linux_ref }}' exists in the repository + - If using A/B testing with different refs, ensure shallow cloning is disabled + - The repository URL '{{ target_linux_git }}' is correct and accessible + when: + - ref_check.rc != 0 + - name: Clone {{ target_linux_tree }} ansible.builtin.git: repo: "{{ target_linux_git }}" diff --git a/playbooks/roles/bootlinux/tasks/build/targets.yml b/playbooks/roles/bootlinux/tasks/build/targets.yml index 36339876..81465cc6 100644 --- a/playbooks/roles/bootlinux/tasks/build/targets.yml +++ b/playbooks/roles/bootlinux/tasks/build/targets.yml @@ -10,6 +10,28 @@ - target_linux_install_b4 - ansible_facts['os_family']|lower != 'debian' +- name: Verify target git ref exists before cloning + command: "git ls-remote {{ target_linux_git }} {{ target_linux_ref }}" + register: ref_check + tags: [ 'clone'] + +- name: Fail if git ref does not exist + fail: + msg: | + Failed to verify git ref '{{ target_linux_ref }}' exists in repository '{{ target_linux_git }}'. + + This typically happens when: + 1. The ref (branch/tag/commit) doesn't exist in the repository + 2. You're using A/B testing with a shallow clone that doesn't contain the required ref + 3. The repository URL is incorrect or inaccessible + + Please verify: + - The ref '{{ target_linux_ref }}' exists in the repository + - If using A/B testing with different refs, ensure shallow cloning is disabled + - The repository URL '{{ target_linux_git }}' is correct and accessible + when: + - ref_check.rc != 0 + - name: git clone {{ target_linux_tree }} on the target nodes git: repo: "{{ target_linux_git }}" -- 2.47.2