Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions playbooks/roles/bootlinux/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,3 @@ bootlinux_fragment_x86: false
bootlinux_fragment_xarray: false
bootlinux_fragment_xarray_no_multi: false


# Distro controls
distro_debian_based: false
distro_fedora: false
distro_redhat_based: false
distro_suse_based: false
2 changes: 1 addition & 1 deletion playbooks/roles/bootlinux/tasks/build/9p.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
when:
- target_linux_install_b4 is defined
- target_linux_install_b4
- not distro_debian_based|bool
- ansible_facts['os_family']|lower != 'debian'
run_once: true
delegate_to: localhost

Expand Down
5 changes: 5 additions & 0 deletions playbooks/roles/bootlinux/tasks/build/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@
when:
- ansible_os_family == "Debian"
block:
- name: Build the list of artifacts directories on the builder
ansible.builtin.set_fact:
artifact_paths:
- "{{ target_linux_dir_path }}/.."

- name: Make the bindeb-pkg target
community.general.make:
chdir: "{{ target_linux_dir_path }}"
Expand Down
3 changes: 3 additions & 0 deletions playbooks/roles/bootlinux/tasks/install-deps/debian/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@
- libncurses-dev
- b4
- ccache
- rsync
- dwarves
- lz4
state: present
6 changes: 3 additions & 3 deletions playbooks/roles/bootlinux/tasks/install-deps/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
- name: Debian-specific setup
ansible.builtin.import_tasks: debian/main.yml
when:
- distro_debian_based|bool
- ansible_os_family == "Debian"

- name: SuSE-specific setup
ansible.builtin.import_tasks: suse/main.yml
when:
- distro_suse_based|bool
- ansible_os_family == "Suse"

- name: Red Hat-specific setup
ansible.builtin.import_tasks: redhat/main.yml
when:
- distro_redhat_based|bool
- ansible_os_family == "RedHat"
4 changes: 2 additions & 2 deletions playbooks/roles/bootlinux/tasks/install-deps/redhat/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ansible.builtin.include_role:
name: epel-release
when:
- not distro_fedora|bool
- ansible_distribution != "Fedora"

- name: Install packages we care about
become: true
Expand Down Expand Up @@ -67,7 +67,7 @@
vars:
packages:
- btrfs-progs
when: distro_fedora|bool
when: ansible_distribution == 'Fedora'

- name: Install clang
become: true
Expand Down
42 changes: 42 additions & 0 deletions playbooks/roles/bootlinux/tasks/install/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,45 @@
loop: "{{ kernel_packages }}"
loop_control:
label: "Installing {{ item }}"
changed_when: true

- name: Install the built kernel debs on the target nodes
when:
- ansible_os_family == "Debian"
block:
- name: Find the kernel build artifacts on the control host
delegate_to: localhost
ansible.builtin.find:
paths: "{{ bootlinux_artifacts_dir }}"
patterns: "*.deb"
file_type: file
recurse: true
register: found_debs

- name: Upload the kernel build artifacts to the target nodes
ansible.builtin.copy:
src: "{{ item.path }}"
dest: "/tmp"
mode: "u=rw,g=r,o=r"
loop: "{{ found_debs.files }}"
loop_control:
label: "Uploading {{ item.path | basename }} ..."

- name: Add the core kernel package
ansible.builtin.set_fact:
kernel_packages: "{{ kernel_packages + ['/tmp/' + item.path | basename] }}"
when:
- "'headers' not in item.path"
loop: "{{ found_debs.files }}"
loop_control:
label: "Adding {{ item.path | basename }} ..."

- name: Install the selected kernel build artifacts on the target nodes
become: true
become_method: ansible.builtin.sudo
ansible.builtin.command:
cmd: "dpkg -i {{ item }}"
loop: "{{ kernel_packages }}"
loop_control:
label: "Installing {{ item }}"
changed_when: true
63 changes: 63 additions & 0 deletions playbooks/roles/bootlinux/tasks/update-grub/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,66 @@
when:
- kernel_release_file.stat.exists

# GRUB detection logic for packaged kernels on Debian
- name: Construct the command line to determine the default boot entry (package)
tags:
- saved
ansible.builtin.set_fact:
determine_default_kernel_id: >-
awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg |
awk '{print NR-1" ... "$0}' |
grep {{ kernelrelease }} |
head -1 |
awk '{print $1}'
when:
- kernel_release_file.stat.exists
- kernelrelease is defined
- kernelrelease != "unknown"
- ansible_facts['os_family']|lower == 'debian'

- name: Determine the target kernel's GRUB boot entry number (package) # noqa: command-instead-of-shell
tags:
- saved
become: true
become_flags: "su - -c"
become_method: ansible.builtin.sudo
ansible.builtin.shell:
cmd: "{{ determine_default_kernel_id }}"
register: grub_boot_number_cmd
changed_when: false
when:
- kernel_release_file.stat.exists
- kernelrelease is defined
- kernelrelease != "unknown"
- determine_default_kernel_id is defined

- name: Set the target kernel to be booted by default (package)
become: true
become_flags: "su - -c"
become_method: ansible.builtin.sudo
ansible.builtin.command:
cmd: "/usr/sbin/grub-set-default \"{{ grub_boot_number_cmd.stdout_lines.0 }}\""
changed_when: true
tags: ["saved"]
when:
- grub_boot_number_cmd is defined
- grub_boot_number_cmd.rc is defined
- grub_boot_number_cmd.rc == 0
- grub_boot_number_cmd.stdout is defined
- grub_boot_number_cmd.stdout != ""

- name: Itemize kernel and GRUB entry selected (package)
ansible.builtin.debug:
msg: >-
{{ target_kernel }} determined to be {{ grub_boot_number_cmd.stdout_lines.0 }}
on the GRUB2 flat menu.
Ran: grub-set-default {{ grub_boot_number_cmd.stdout_lines.0 }}
vars:
target_kernel: "{{ kernelrelease }}"
tags: ["saved"]
when:
- grub_boot_number_cmd is defined
- grub_boot_number_cmd.rc is defined
- grub_boot_number_cmd.rc == 0
- grub_boot_number_cmd.stdout is defined
- grub_boot_number_cmd.stdout != ""
15 changes: 13 additions & 2 deletions playbooks/roles/pynfs/tasks/install-deps/debian/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Install pynfs build dependencies
become: true
become_method: sudo
become_method: ansible.builtin.sudo
ansible.builtin.apt:
name:
- gcc
Expand All @@ -13,7 +13,18 @@
- swig
- python3-gssapi
- python3-ply
- python3-standard-xdrlib
state: present
update_cache: true
tags: ["pynfs", "deps"]

# xdrlib was removed from Python 3.13; Debian packages it as python3-mda-xdrlib
- name: Install xdrlib from Debian package on Debian 13+
become: true
become_method: ansible.builtin.sudo
ansible.builtin.apt:
name:
- python3-mda-xdrlib
state: present
tags: ["pynfs", "deps"]
when:
- ansible_distribution_major_version | int >= 13
34 changes: 22 additions & 12 deletions workflows/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ endif
BOOTLINUX_ARGS += bootlinux_cxl_test=$(CONFIG_ENABLE_CXL_TEST)
WORKFLOW_ARGS += $(BOOTLINUX_ARGS)

# Default host limit for bootlinux operations
BOOTLINUX_LIMIT := baseline:dev

# When NFS server is enabled, include it in kernel updates so that workflows
# like fstests, gitr, nfstest, and pynfs can test the kernel's NFS server
# implementation (knfsd).
ifeq (y,$(CONFIG_KDEVOPS_SETUP_NFSD))
BOOTLINUX_LIMIT := baseline:dev:nfsd
endif

PHONY += linux-help-menu
linux-help-menu:
@echo "Linux git kernel development options"
Expand Down Expand Up @@ -102,14 +112,14 @@ linux: linux-baseline linux-dev
else
linux: $(KDEVOPS_NODES)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
endif
else
linux: $(KDEVOPS_NODES)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
endif
Expand Down Expand Up @@ -143,47 +153,47 @@ endif
PHONY += linux-mount
linux-mount:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--tags vars,9p_mount \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)

PHONY += linux-deploy
linux-deploy:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--tags vars,build-linux,install-linux,manual-update-grub,saved,vars,reboot \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)

PHONY += linux-build
linux-build:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--tags vars,build-linux,saved,vars \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)

PHONY += linux-install
linux-install:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--tags vars,build-linux,install-linux \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)

PHONY += linux-uninstall
linux-uninstall:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--tags uninstall-linux,vars \
--extra-vars '{ "uninstall_kernel_enable": "True", $(LINUX_DYNAMIC_RUNTIME_VARS) }' \
$(LIMIT_HOSTS)

linux-clone-clients: $(KDEVOPS_NODES)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) \
--tags vars,clone
Expand All @@ -202,28 +212,28 @@ linux-clone: $(KDEVOPS_NODES) $(LINUX_CLONE_DEFAULT_TYPE)
PHONY += linux-grub-setup
linux-grub-setup:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) --tags manual-update-grub,saved,vars

PHONY += linux-reboot
linux-reboot:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) --tags vars,reboot

PHONY += uname
uname:
$(Q)ansible 'baseline:dev' -b -m command -a "uname -r" -o \
$(Q)ansible '$(BOOTLINUX_LIMIT)' -b -m command -a "uname -r" -o \
| awk -F '|' '{gsub(/^ +| +$$/, "", $$2); printf "%-30s %s\n", $$1, $$4}' \
| sed -e 's|(stdout)||'

ifeq (y,$(CONFIG_KDEVOPS_WORKFLOW_ENABLE_CXL))
PHONY += linux-cxl
linux-cxl: $(KDEVOPS_NODES)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--limit 'baseline:dev' \
--limit '$(BOOTLINUX_LIMIT)' \
$(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--tags 'vars,cxl-build,cxl-install' \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)
Expand Down
Loading