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 5634319006B for ; Mon, 28 Jul 2025 01:14:37 +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=1753665280; cv=none; b=d4FHr+IYUmTxO7jxwhwHcpobZcSxtxuGVSb8folgaQne/XO2bkYcmYD4eLXlhW+Kep/ucqaMjioaEF05MdAaXKB/pZQMgq+omnaV1K6GdEpWLHc9r/Bx/zC08FRojXB9Xl29WhHL3xrdT6He7gf5YbvVF0F+Nb95AiaA1ZodGq8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753665280; c=relaxed/simple; bh=fuQMxwCtVbwFb4gFEw7NvQSsQA51aR4Fsqv3VFzXN24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iHPwa1s4gGOyuoQ1Is75H8yrpYQrlehWlxvluVoNW0wfhUZ/eBwvdRrycUXsxyPCdkiDwdl0En9XQh3/tDeq70SCv8VYGjav0Avk+7PlMNwY0kJLyzfZLaqVIweM7tqkFl4iTLpFPJTYrGe3tZ0NVsIUKVpwBxw1zr2pyU5j2TY= 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=eJnUF+7L; 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="eJnUF+7L" 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=eJnUF+7LSBEYCAtPjclfPXy7Vk uz8ouRUAVCRBlmPSgmCeR2X6t2v30HEmvOIXy2lYfbX6HUyWph6y4mJJukYV2PpJ+IzWzSr/84Qmv bdhnuFHL+USET7szo0A1T2onpSq1gzXkt+81DUjJWw3tYj05lMKLBw73RDRv9hs3M9DIPahdaOgv6 Y+VMtw70U5yfL+NDBCRkXw28uzEBaTO9ElaNEWala4IBUCUjOLVT0dMCriFfmgkA+6o6w6PaeYK+R t+fgT6nw+L5w4bGgHSVURJqz2T6Y0cNDL9GtdiWduQNSErtKOG5GkTZ+TqeK9pnPgAZ+G4mmE7L0Z HfX5zXyw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ugCRo-0000000DPkO-0ymp; Mon, 28 Jul 2025 01:14:36 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Chuck Lever Subject: [PATCH v2 20/33] bootlinux: Move tasks for building on target nodes to a subrole Date: Sun, 27 Jul 2025 18:14:20 -0700 Message-ID: <20250728011434.3197091-21-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250728011434.3197091-1-mcgrof@kernel.org> References: <20250728011434.3197091-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