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 0932818A6AD for ; Mon, 28 Jul 2025 01:14:36 +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=je4un33EfXX+X1CRGsXtV8mJrb6Cp6zNvcs3uymqOv3AwlU2HrFXeV11DAvvncVG7C2pVRn/PX3WtX4VxAe0hmdnv9fKgnCCWUqVoUjjqDZZ6G6dbFYTiTZecJN5L9xmZqnBD1ZasMH6UT6XzPa16F2IIgM11s0IkG6t5D4W+mI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753665280; c=relaxed/simple; bh=djZjffi14HvfJf185n5/RNVEEBKfqYYBEdE4kouot+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XPsezJiVrMyObgsyC5N+kiKsVKEqCJK5zQCCjscii2tMbNvWIu1cAtFcl3TNS3rGcPldRME525Plqg74rCeXU3ygKrhDb0Mfz2UAu1SYyo7KDUoqOxHx+8fHfptAu6dvRWHisbNmOINGjfAXxN+E8b/b0ZzIl/8yNThzsTCApkw= 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=DAnkSUHw; 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="DAnkSUHw" 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=NzvlIb0KAKzkbPxAuZWASoDC/D3WJXx1WC7FR7Jd3R8=; b=DAnkSUHw5eyxcJVbGpajrWQd8H MwdA0KYtAZIWqk3V7UnfxNR4vmWhvw0UhwuUkEGs2/ggL/Vg+K/ivkGFZgnEWGhTmAB8HlAiRwAb1 +9q466Yn8KT+kaVug+jplZWd1EGx7fpX23aT7RJaJYAPcfKfqrylMzxGfoJhG1dtG7dP+Sfaq4Jc6 xj5edPFFFGHzJ+w/ga9wbforzG/37V3BhII79NZBWbOmENuLdQA2gMuSSyWPZFJ6yYgxuMoBjFcBb YA/r9AcYbHrxI6Ev80aX4IBdgCY8kJOEcBGhk/DWtUZDl6ND3Fgfukw3ujmAc7njiaYi9JZlVuGvg AGJKLimg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ugCRo-0000000DPk0-0KBA; 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 16/33] bootlinux: Relocate tasks that select a kernel .config Date: Sun, 27 Jul 2025 18:14:16 -0700 Message-ID: <20250728011434.3197091-17-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 Move the tasks that select the kernel .config to build into a subrole. A dynamic "include_tasks" is used so that eventually these tasks can be completely skipped when the bootlinux playbook is asked only to install kernel packages. Signed-off-by: Chuck Lever --- playbooks/roles/bootlinux/tasks/config.yml | 89 +++++++++++++++++++++ playbooks/roles/bootlinux/tasks/main.yml | 91 +--------------------- 2 files changed, 92 insertions(+), 88 deletions(-) create mode 100644 playbooks/roles/bootlinux/tasks/config.yml diff --git a/playbooks/roles/bootlinux/tasks/config.yml b/playbooks/roles/bootlinux/tasks/config.yml new file mode 100644 index 00000000..5cf03e7f --- /dev/null +++ b/playbooks/roles/bootlinux/tasks/config.yml @@ -0,0 +1,89 @@ +--- +- name: Check whether config-kdevops exists + stat: + path: "{{ role_path }}/templates/config-kdevops" + register: config_kdevops + delegate_to: localhost + +- name: Found config-kdevops, using it for template + set_fact: + linux_config: "config-kdevops" + when: config_kdevops.stat.exists + +- name: No config-kdevops, looking for {{ target_linux_config }} + set_fact: + linux_config: "{{ target_linux_config }}" + when: not config_kdevops.stat.exists + +- name: Check if specific kernel config exists for {{ target_linux_ref }} + stat: + path: "{{ role_path }}/templates/{{ target_linux_config }}" + register: kernel_config + delegate_to: localhost + +- name: Find all linux-next configs if a your custom config-kdevops and ref config was not found + find: + paths: "{{ role_path }}/templates" + patterns: "config-next*" + file_type: file + recurse: no + register: found_configs + delegate_to: localhost + when: + - not config_kdevops.stat.exists + - not kernel_config.stat.exists + +- name: Extract the date from the filenames + set_fact: + configs_with_dates: "{{ configs_with_dates | default([]) + [{'file': item.path, 'date': (item.path | regex_search('config-next-(\\d{8})')).split('-')[-1]}] }}" + loop: "{{ found_configs.files }}" + when: + - not config_kdevops.stat.exists + - not kernel_config.stat.exists + - item.path is search('config-next-(\\d{8})') + no_log: true + delegate_to: localhost + +- name: Sort configs based on date extracted from filename + set_fact: + sorted_configs: "{{ configs_with_dates | selectattr('date', 'defined') | sort(attribute='date', reverse=True) | map(attribute='file') | list }}" + when: + - not config_kdevops.stat.exists + - not kernel_config.stat.exists + - configs_with_dates | length > 0 + delegate_to: localhost + +- name: Set latest linux-next config if configs are found + set_fact: + latest_linux_next_config: "{{ sorted_configs[0] }}" + when: + - not config_kdevops.stat.exists and not kernel_config.stat.exists + - sorted_configs | length > 0 + delegate_to: localhost + +- name: Use the specific kernel config or fallback to the latest linux-next + set_fact: + linux_config: "{{ target_linux_config | default('') if kernel_config.stat.exists else (latest_linux_next_config | default('') | basename) }}" + when: + - not config_kdevops.stat.exists + - not kernel_config.stat.exists + - latest_linux_next_config is defined + delegate_to: localhost + +- name: Verify config used + debug: + msg: "Linux config used: {{ role_path }}/templates/{{ linux_config }}" + delegate_to: localhost + +- name: Verify that the Linux configuration file exists + stat: + path: "{{ role_path }}/templates/{{ linux_config }}" + register: config_stat + delegate_to: localhost + when: linux_config is defined + +- name: Fail if the configuration file does not exist + fail: + msg: "The configuration file {{ role_path }}/templates/{{ linux_config }} does not exist." + when: not config_stat.stat.exists + delegate_to: localhost diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/roles/bootlinux/tasks/main.yml index 7671389c..9c43c1e5 100644 --- a/playbooks/roles/bootlinux/tasks/main.yml +++ b/playbooks/roles/bootlinux/tasks/main.yml @@ -223,94 +223,9 @@ run_once: true delegate_to: localhost -- name: Check whether config-kdevops exists - stat: - path: "{{ role_path }}/templates/config-kdevops" - register: config_kdevops - delegate_to: localhost - -- name: Found config-kdevops, using it for template - set_fact: - linux_config: "config-kdevops" - when: config_kdevops.stat.exists - -- name: No config-kdevops, looking for {{ target_linux_config }} - set_fact: - linux_config: "{{ target_linux_config }}" - when: not config_kdevops.stat.exists - -- name: Check if specific kernel config exists for {{ target_linux_ref }} - stat: - path: "{{ role_path }}/templates/{{ target_linux_config }}" - register: kernel_config - delegate_to: localhost - -- name: Find all linux-next configs if a your custom config-kdevops and ref config was not found - find: - paths: "{{ role_path }}/templates" - patterns: "config-next*" - file_type: file - recurse: no - register: found_configs - delegate_to: localhost - when: - - not config_kdevops.stat.exists - - not kernel_config.stat.exists - -- name: Extract the date from the filenames - set_fact: - configs_with_dates: "{{ configs_with_dates | default([]) + [{'file': item.path, 'date': (item.path | regex_search('config-next-(\\d{8})')).split('-')[-1]}] }}" - loop: "{{ found_configs.files }}" - when: - - not config_kdevops.stat.exists - - not kernel_config.stat.exists - - item.path is search('config-next-(\\d{8})') - no_log: true - delegate_to: localhost - -- name: Sort configs based on date extracted from filename - set_fact: - sorted_configs: "{{ configs_with_dates | selectattr('date', 'defined') | sort(attribute='date', reverse=True) | map(attribute='file') | list }}" - when: - - not config_kdevops.stat.exists - - not kernel_config.stat.exists - - configs_with_dates | length > 0 - delegate_to: localhost - -- name: Set latest linux-next config if configs are found - set_fact: - latest_linux_next_config: "{{ sorted_configs[0] }}" - when: - - not config_kdevops.stat.exists and not kernel_config.stat.exists - - sorted_configs | length > 0 - delegate_to: localhost - -- name: Use the specific kernel config or fallback to the latest linux-next - set_fact: - linux_config: "{{ target_linux_config | default('') if kernel_config.stat.exists else (latest_linux_next_config | default('') | basename) }}" - when: - - not config_kdevops.stat.exists - - not kernel_config.stat.exists - - latest_linux_next_config is defined - delegate_to: localhost - -- name: Verify config used - debug: - msg: "Linux config used: {{ role_path }}/templates/{{ linux_config }}" - delegate_to: localhost - -- name: Verify that the Linux configuration file exists - stat: - path: "{{ role_path }}/templates/{{ linux_config }}" - register: config_stat - delegate_to: localhost - when: linux_config is defined - -- name: Fail if the configuration file does not exist - fail: - msg: "The configuration file {{ role_path }}/templates/{{ linux_config }} does not exist." - when: not config_stat.stat.exists - delegate_to: localhost +- name: Select the .config file for building the test kernel + ansible.builtin.include_tasks: + file: "{{ role_path }}/tasks/config.yml" - name: Copy configuration for Linux {{ target_linux_tree }} to the target nodes template: -- 2.47.2