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 527015FB95 for ; Mon, 28 Jul 2025 00:18:03 +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=1753661887; cv=none; b=deEtWiIkeWcSA3DKiPrtdOGo0m4FjFmlqwM6EEyTSwDEHbiESmyaHEQ8Qb2PHO7AD46LOgdsMHzh6b5If0irgpW+0v8H+62DxmjwYQIqLIEVTdck2eIrrNKuEn6Uzw+5LPITUpjechJtjc3CcZinIfqoZ5dhbcWARD8phIxXRH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753661887; c=relaxed/simple; bh=fuQMxwCtVbwFb4gFEw7NvQSsQA51aR4Fsqv3VFzXN24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QFL7mQJ0yuccKfMOSq2RXcYKtwtyBVSCC22fhAGxfIonbvtTW4SI606zaqu4N0nncyBu5pGCvmVNhYXy/KeoB6HXvwdj2kRgfO3JTQAFCldCfosmkhc7hoGp1Dxf+1nOWlnBYzR+cH7VcPPs9aZiUzktp6RZz7q37yacfQ6WqlM= 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=Ua7n6Yk8; 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="Ua7n6Yk8" 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=/acSaM7rg5FrP1yFveC/QSPbXa3RKNawAs4itVyx4lQ=; b=Ua7n6Yk8dQ05l+PJGghDzyl866 FEaC6CycCFIi+/pl5nZbOEqDGHo2iNmmue0WtdD9Y7oemHj5Z2KhtJZ6ESRK8Vv6EPrfEApSvxMUY Z5hKUmZYnaP15GdmwDx4BraIopfK42jllz/ZIvB6fq9q0miR7jmEP8633SOsiYsmrT0h4+jKZHBKD H9kSBFC0+5ENUnWEQFkJOmC7oj0adg8IROl2kK8BlJ6BPDFOjRHRxaA2M0x8WA4lp9sV9U9XWyOAk wizsKe6kxb2FfCu/B0iKGHQWvvtM+0tNn3/uc9w/meHVgz6H3WyjAlIqS9469v+j8yK71x/givkfy KPsbHXdg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ugBZ4-0000000DNXV-3PJr; Mon, 28 Jul 2025 00:18:02 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Chuck Lever Subject: [PATCH 25/40] bootlinux: Move tasks for building on target nodes to a subrole Date: Sun, 27 Jul 2025 17:17:44 -0700 Message-ID: <20250728001800.3188617-26-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250728001800.3188617-1-mcgrof@kernel.org> References: <20250728001800.3188617-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 From: Chuck Lever Most everything that is marked with "when: not bootlinux_9p|bool" is moved to a separate .yml file and then dynamically included when bootlinux_targets is true. This makes it easy to identify tasks that are specific to building on the target nodes and ensures those tasks are completely disabled and skipped when other build modes are in use. Signed-off-by: Chuck Lever --- .../roles/bootlinux/tasks/build/targets.yml | 125 +++++++++++++++++ playbooks/roles/bootlinux/tasks/main.yml | 132 +----------------- 2 files changed, 129 insertions(+), 128 deletions(-) create mode 100644 playbooks/roles/bootlinux/tasks/build/targets.yml diff --git a/playbooks/roles/bootlinux/tasks/build/targets.yml b/playbooks/roles/bootlinux/tasks/build/targets.yml new file mode 100644 index 00000000..36339876 --- /dev/null +++ b/playbooks/roles/bootlinux/tasks/build/targets.yml @@ -0,0 +1,125 @@ +--- +- name: Install b4 + become: yes + become_method: sudo + pip: + name: + - b4 + when: + - target_linux_install_b4 is defined + - target_linux_install_b4 + - ansible_facts['os_family']|lower != 'debian' + +- name: git clone {{ target_linux_tree }} on the target nodes + git: + repo: "{{ target_linux_git }}" + dest: "{{ target_linux_dir_path }}" + update: yes + depth: "{{ target_linux_shallow_depth }}" + version: "{{ target_linux_ref }}" + retries: 3 + delay: 5 + register: result + until: not result.failed + tags: [ 'clone'] + +- name: Copy kernel delta if requested on the target nodes + template: + src: "{{ target_linux_extra_patch }}" + dest: "{{ target_linux_dir_path }}/{{ target_linux_extra_patch }}" + owner: "{{ data_user }}" + group: "{{ data_group }}" + mode: 0644 + when: + - target_linux_extra_patch is defined + +- name: Apply kernel delta if requested on the target nodes + command: "git am {{ target_linux_extra_patch }}" + args: + chdir: "{{ target_linux_dir_path }}" + when: + - target_linux_extra_patch is defined + +- name: Set git user name and email if needed + shell: | + if ! $(git config --get user.email) ; then + git config --global user.email user@example.com + fi + if ! $(git config --get user.name) ; then + git config --global user.name user + fi + when: + - target_linux_apply_patch_message_id is defined + - target_linux_apply_patch_message_id | length > 0 + - bootlinux_b4_am_this_host|bool + +- name: Variable values + debug: + msg: "{{ target_linux_apply_patch_message_id }}" + when: + - target_linux_apply_patch_message_id is defined + +- name: Apply message patch set if requested on the target nodes + shell: b4 am -o - {{target_linux_apply_patch_message_id}} | git am + args: + chdir: "{{ target_linux_dir_path }}" + when: + - target_linux_apply_patch_message_id is defined + - target_linux_apply_patch_message_id | length > 0 + - bootlinux_b4_am_this_host|bool + +- name: Copy configuration for Linux {{ target_linux_tree }} to the target nodes + template: + src: "{{ linux_config }}" + dest: "{{ target_linux_dir_path }}/.config" + owner: "{{ data_user }}" + group: "{{ data_group }}" + mode: 0644 + +- name: Set kernel localversion if requested on the target nodes + shell: "echo {{ target_linux_localversion }} > {{ target_linux_dir_path }}/localversion" + when: + - target_linux_localversion is defined and target_linux_localversion != "" + +- name: Configure Linux {{ target_linux_tree }} on the target nodes + shell: | + set -o pipefail + yes "" | make oldconfig + register: configure_done + changed_when: configure_done.rc == 0 or configure_done.rc == 141 + failed_when: configure_done.rc != 0 and configure_done.rc != 141 + args: + chdir: "{{ target_linux_dir_path }}" + executable: /bin/bash + +- name: Build {{ target_linux_tree }} on the target nodes + command: "{{ target_linux_make_cmd }}" + register: build + changed_when: "build.rc == 0" + args: + chdir: "{{ target_linux_dir_path }}" + tags: [ 'build-linux' ] + +- name: Build {{ target_linux_tree }} cxl_test on the target nodes + command: "{{ target_linux_make_cmd }} M=tools/testing/cxl" + register: build_cxl_test + changed_when: "build_cxl_test.rc == 0" + args: + chdir: "{{ target_linux_dir_path }}" + tags: [ 'build-linux', 'cxl-build' ] + when: + - bootlinux_cxl_test|bool + +- name: See if snake-oil cert file is present on client + stat: + path: "{{ target_linux_dir_path }}/certs/signing_key.pem" + register: snaik_oil_file + tags: [ 'build-linux' ] + +- name: Ensure we allow world to read the snake oil in case of NFS or 9p read only usage + file: + path: "{{ target_linux_dir_path }}/certs/signing_key.pem" + mode: "0755" + tags: [ 'build-linux' ] + when: + - snaik_oil_file.stat.exists diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/roles/bootlinux/tasks/main.yml index e908f313..62a081a9 100644 --- a/playbooks/roles/bootlinux/tasks/main.yml +++ b/playbooks/roles/bootlinux/tasks/main.yml @@ -74,135 +74,11 @@ when: - bootlinux_9p|bool -- name: git clone {{ target_linux_tree }} on the target nodes - git: - repo: "{{ target_linux_git }}" - dest: "{{ target_linux_dir_path }}" - update: yes - depth: "{{ target_linux_shallow_depth }}" - version: "{{ target_linux_ref }}" - retries: 3 - delay: 5 - register: result - until: not result.failed - tags: [ 'clone'] - when: - - not bootlinux_9p|bool - -- name: Copy kernel delta if requested on the target nodes - template: - src: "{{ target_linux_extra_patch }}" - dest: "{{ target_linux_dir_path }}/{{ target_linux_extra_patch }}" - owner: "{{ data_user }}" - group: "{{ data_group }}" - mode: 0644 - when: - - not bootlinux_9p|bool - - target_linux_extra_patch is defined - -- name: Apply kernel delta if requested on the target nodes - command: "git am {{ target_linux_extra_patch }}" - args: - chdir: "{{ target_linux_dir_path }}" - when: - - not bootlinux_9p|bool - - target_linux_extra_patch is defined - -- name: Set git user name and email if needed - shell: | - if ! $(git config --get user.email) ; then - git config --global user.email user@example.com - fi - if ! $(git config --get user.name) ; then - git config --global user.name user - fi - when: - - target_linux_apply_patch_message_id is defined - - target_linux_apply_patch_message_id | length > 0 - - bootlinux_b4_am_this_host|bool - -- name: Variable values - debug: - msg: "{{ target_linux_apply_patch_message_id }}" - when: - - target_linux_apply_patch_message_id is defined - -- name: Apply message patch set if requested on the target nodes - shell: b4 am -o - {{target_linux_apply_patch_message_id}} | git am - args: - chdir: "{{ target_linux_dir_path }}" - when: - - not bootlinux_9p|bool - - target_linux_apply_patch_message_id is defined - - target_linux_apply_patch_message_id | length > 0 - - bootlinux_b4_am_this_host|bool - -- name: Copy configuration for Linux {{ target_linux_tree }} to the target nodes - template: - src: "{{ linux_config }}" - dest: "{{ target_linux_dir_path }}/.config" - owner: "{{ data_user }}" - group: "{{ data_group }}" - mode: 0644 - when: - - not bootlinux_9p|bool - -- name: Set kernel localversion if requested on the target nodes - shell: "echo {{ target_linux_localversion }} > {{ target_linux_dir_path }}/localversion" - when: - - not bootlinux_9p|bool - - target_linux_localversion is defined and target_linux_localversion != "" - -- name: Configure Linux {{ target_linux_tree }} on the target nodes - shell: | - set -o pipefail - yes "" | make oldconfig - register: configure_done - changed_when: configure_done.rc == 0 or configure_done.rc == 141 - failed_when: configure_done.rc != 0 and configure_done.rc != 141 - args: - chdir: "{{ target_linux_dir_path }}" - executable: /bin/bash - when: - - not bootlinux_9p|bool - -- name: Build {{ target_linux_tree }} on the target nodes - command: "{{ target_linux_make_cmd }}" - register: build - changed_when: "build.rc == 0" - args: - chdir: "{{ target_linux_dir_path }}" - tags: [ 'build-linux' ] - when: - - not bootlinux_9p|bool - -- name: Build {{ target_linux_tree }} cxl_test on the target nodes - command: "{{ target_linux_make_cmd }} M=tools/testing/cxl" - register: build_cxl_test - changed_when: "build_cxl_test.rc == 0" - args: - chdir: "{{ target_linux_dir_path }}" - tags: [ 'build-linux', 'cxl-build' ] - when: - - not bootlinux_9p|bool - - bootlinux_cxl_test|bool - -- name: See if snake-oil cert file is present on client - stat: - path: "{{ target_linux_dir_path }}/certs/signing_key.pem" - register: snaik_oil_file - tags: [ 'build-linux' ] - when: - - not bootlinux_9p|bool - -- name: Ensure we allow world to read the snake oil in case of NFS or 9p read only usage - file: - path: "{{ target_linux_dir_path }}/certs/signing_key.pem" - mode: "0755" - tags: [ 'build-linux' ] +- name: Build the Linux kernel on the target nodes + ansible.builtin.include_tasks: + file: "{{ role_path }}/tasks/build/targets.yml" when: - - not bootlinux_9p|bool - - snaik_oil_file.stat.exists + - bootlinux_targets|bool - name: Run uname before command: "uname -r" -- 2.47.2