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 184965FB95 for ; Mon, 28 Jul 2025 00:18:07 +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=1753661891; cv=none; b=sBKNNSoJDvKHUuUiW1q02s+EQI5NqSTVA6BTO23z57LJSjF6CoNaFwzG02i1MdgGzuxmvq9JM3kjMOj30QNdLQM5C6/tlCIZaRmk2Cff6Uxk21T14gagGbDO5fJhsgZXORc+wE+iPdK1ML8sY0QK4e782FsP/0BPiEfFvqga1pU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753661891; c=relaxed/simple; bh=djZjffi14HvfJf185n5/RNVEEBKfqYYBEdE4kouot+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uwbCoes+yYmFmX7JAAUrf5rYt/QNF/7TOJ0Ckug4/T92p0bEduWpVJPF+lZr3EcefL9TLCmiyKieBVxn2GHK8IFYZjst2LdvyxYAbQSAqthWCvLif2EbTPFoINaO0mFjrE32XleMGrbRtjlX48pKF4QJaxB7WMyHuZ02RPa3NkE= 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=JI5cltlQ; 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="JI5cltlQ" 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=JI5cltlQ+IpdFkcZM1VLBGiYWa +6HfGZKyaCsEBzoGsL91PkARnYxvs8pCmYxpQje2cUdIoQP9LVurepJ1hm66mu5xYelasWH1Yfz4e EftBlFneNkJLvvKLw4el6M7S7SXcJjsZ6DU6cgM310RTZZl91tABRcBGIijzlkMbLe4pql+N34eWs 2Y58QUiMWpqYsZfP+JU+nDaZMheumOiFnEyY6c61g3ZjbM0fED75G351mkNecqJlq0ixOsVCTsYfy kRqH7+qas0pgxgMg5dJvBYPl7YaxLRUp1M3B0Ix4H9Hit/KJkaapoO1ba9ywIGZ7Mly6Gp1VoXYzP 0WZl/m0Q==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ugBZ4-0000000DNWV-2Ht3; 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 19/40] bootlinux: Relocate tasks that select a kernel .config Date: Sun, 27 Jul 2025 17:17:38 -0700 Message-ID: <20250728001800.3188617-20-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 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