Skip to content
Open
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
9 changes: 9 additions & 0 deletions defconfigs/bisection
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CONFIG_GUESTFS=y
CONFIG_LIBVIRT=y

CONFIG_WORKFLOW_LINUX_CUSTOM=y
CONFIG_BOOTLINUX=y
CONFIG_BOOTLINUX_9P=y
CONFIG_BOOTLINUX_BISECT_ENABLE=y

CONFIG_DEVCONFIG_ENABLE_SYSTEMD_JOURNAL_REMOTE=y
6 changes: 6 additions & 0 deletions playbooks/roles/bootlinux/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ kdevops_workflow_enable_cxl: False

bootlinux_cxl_test: False
bootlinux_tree_set_by_cli: False
bootlinux_bisect_enable: False
bootlinux_bisect_enable_cli: False
bootlinux_bisect_ref_good_cli: False
bootlinux_bisect_ref_bad_cli: False
bootlinux_bisect_script_boot: False
bootlinux_bisect_script_custom: False
45 changes: 45 additions & 0 deletions playbooks/roles/bootlinux/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -650,3 +650,48 @@
vars:
running_kernel: "{{ uname_cmd.stdout_lines.0 }}"
tags: [ 'linux', 'git', 'config', 'uname' ]

- name: Copy git bisection script over
template:
src: "{{ bootlinux_bisect_script }}.j2"
dest: "{{ bootlinux_9p_host_path }}/{{ bootlinux_bisect_script }}"
mode: 0644
tags: [ 'bisect' ]
when:
- bootlinux_bisect_enable|bool
run_once: true
delegate_to: localhost

- name: Set up bisection for git
command: "git bisect start {{ bootlinux_bisect_ref_bad }} {{ bootlinux_bisect_ref_good }}"
register: build
changed_when: "build.rc == 0"
args:
chdir: "{{ bootlinux_9p_host_path }}"
tags: [ 'bisect' ]
when:
- bootlinux_bisect_enable|bool
run_once: true
delegate_to: localhost

- name: Ensure bisection script is executable
file:
path: "{{ bootlinux_9p_host_path }}/{{ bootlinux_bisect_script }}"
mode: '0755'
state: file
when: bootlinux_bisect_enable | bool
delegate_to: localhost
run_once: true
tags: [ 'bisect' ]

- name: Run the the bisection script
command: "git bisect run {{ bootlinux_9p_host_path }}/{{ bootlinux_bisect_script }}"
register: build
changed_when: "build.rc == 0"
args:
chdir: "{{ bootlinux_9p_host_path }}"
tags: [ 'bisect' ]
when:
- bootlinux_bisect_enable|bool
run_once: true
delegate_to: localhost
7 changes: 7 additions & 0 deletions playbooks/roles/bootlinux/templates/bisect-boot.sh.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# SPDX-License-Identifier: copyleft-next-0.3.1
#
# If make linux-deploy fails for reasons unrelated to the bug we're tracking
# (e.g., a build error) we bail with exit code 125 to allow git to skip that
# commit.
make linux-deploy || exit 125
80 changes: 79 additions & 1 deletion workflows/linux/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ config BOOTLINUX_TREE_REF_SET_BY_CLI
output yaml
default $(shell, scripts/check-cli-set-var.sh LINUX_TREE_REF)

config BOOTLINUX_BISECT_ENABLE_CLI
bool
output yaml
default $(shell, scripts/check-cli-set-var.sh LINUX_BISECT)

config BOOTLINUX_BISECT_REF_GOOD_CLI
bool
output yaml
default $(shell, scripts/check-cli-set-var.sh GOOD)

config BOOTLINUX_BISECT_REF_BAD_CLI
bool
output yaml
default $(shell, scripts/check-cli-set-var.sh BAD)

config BOOTLINUX_HAS_PURE_IOMAP_CONFIG
bool

Expand Down Expand Up @@ -173,7 +188,8 @@ config BOOTLINUX_TREE_CUSTOM_URL

config BOOTLINUX_TREE_CUSTOM_REF
string "Custom Linux kernel tag or branch to use"
default $(shell, ./scripts/append-makefile-vars.sh $(LINUX_TREE_REF)) if BOOTLINUX_TREE_REF_SET_BY_CLI
default $(shell, ./scripts/append-makefile-vars.sh $(GOOD)) if BOOTLINUX_BISECT_REF_GOOD_CLI && !BOOTLINUX_TREE_REF_SET_BY_CLI
default $(shell, ./scripts/append-makefile-vars.sh $(LINUX_TREE_REF)) if BOOTLINUX_TREE_REF_SET_BY_CLI && !BOOTLINUX_BISECT_REF_GOOD_CLI
default "master" if !BOOTLINUX_TREE_REF_SET_BY_CLI
help
The git ID or branch name to check out to compile linux.
Expand Down Expand Up @@ -278,9 +294,71 @@ config BOOTLINUX_TREE_LOCALVERSION
help
The Linux local version to use (for uname).

config BOOTLINUX_BISECT_ENABLE
bool "Do you want to bisect a broken kernel?"
default y
depends on BOOTLINUX_9P
output yaml
help
Do you need to automate bisecting some broken kernel?

if BOOTLINUX_BISECT_ENABLE

choice
prompt "Bisection script to use"
default BOOTLINUX_BISECT_SCRIPT_BOOT

config BOOTLINUX_BISECT_SCRIPT_BOOT
bool "Ensures we can at least boot"
help
This helps ensure we can at laest boot into the host. That's it.

config BOOTLINUX_BISECT_SCRIPT_CUSTOM
bool "You will provide your own bisection script"
help
If you to test a new bisection script you can use this.

endchoice

config BOOTLINUX_BISECT_SCRIPT_CUSTOM_PATH
string "Custom path to git bisection script to use"
depends on BOOTLINUX_BISECT_SCRIPT_CUSTOM
default ""
output yaml
help
The custom path to the bisect script we will use. Instead of building
the kernel and booting it, 'make linux' will do the bisection
automatically for you based on the script.

config BOOTLINUX_BISECT_SCRIPT
string
output yaml
default "bisect-boot.sh" if BOOTLINUX_BISECT_SCRIPT_BOOT
default BOOTLINUX_BISECT_SCRIPT_CUSTOM_PATH if BOOTLINUX_BISECT_SCRIPT_BOOT


config BOOTLINUX_BISECT_REF_GOOD
string "The last known good commit"
default BOOTLINUX_TREE_REF if !BOOTLINUX_BISECT_REF_GOOD_CLI
default $(shell, ./scripts/append-makefile-vars.sh $(GOOD)) if BOOTLINUX_BISECT_REF_GOOD_CLI
output yaml
help
The known kernel commit to be good.

config BOOTLINUX_BISECT_REF_BAD
string "The known broken commit"
default BOOTLINUX_TREE_STABLE_REF if !BOOTLINUX_BISECT_REF_BAD_CLI
default $(shell, ./scripts/append-makefile-vars.sh $(BAD)) if BOOTLINUX_BISECT_REF_BAD_CLI
output yaml
help
The first broken tag.

endif # BOOTLINUX_BISECT_ENABLE

config BOOTLINUX_SHALLOW_CLONE
bool "Shallow git clone"
default y
depends on !BOOTLINUX_BISECT_ENABLE
help
If enabled the git tree cloned with be cloned using a shallow tree
with history truncated. You want to enable this if you really don't
Expand Down
15 changes: 15 additions & 0 deletions workflows/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ linux-mount:
--tags vars,9p_mount \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)

PHONY += linux-bisect
linux-bisect:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \
$(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \
--tags vars,bisect \
--extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS)

PHONY += linux-deploy
linux-deploy:
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \
Expand Down Expand Up @@ -176,6 +183,14 @@ linux-help-cxl:
LINUX_HELP_EXTRA += linux-help-cxl
endif

ifeq (y,$(CONFIG_BOOTLINUX_BISECTION))
PHONY += linux-help-bisection
linux-help-bisection:
@echo "linux-bisection - Bisects the kernel automatically for you"

LINUX_HELP_EXTRA += linux-help-bisection
endif

HELP_TARGETS+=linux-help-menu
HELP_TARGETS+=$(LINUX_HELP_EXTRA)
HELP_TARGETS+=linux-help-end
Loading