Repository: firecracker-microvm/firecracker
File: .buildkite/pipeline_pr.py (Python)

Code before:
    {
        "command": "./tools/devtool -y checkstyle",
        "label": "🪶 Style",
    },
    depends_on_build=False,
)

# run sanity build of devtool if Dockerfile is changed
if any(x.parent.name == "devctr" for x in changed_files):
    pipeline.build_group_per_arch(
        "🐋 Dev Container Sanity Build",
        "./tools/devtool -y build_devctr && DEVCTR_IMAGE_TAG=latest ./tools/devtool test -- integration_tests/functional/test_api.py",
    )

if any(
    x.parent.name == "tools" and ("release" in x.name or x.name == "devtool")
    for x in changed_files
):
    pipeline.build_group_per_arch(
        "📦 Release Sanity Build",
        "./tools/devtool -y make_release",
    )

if (
    not pipeline.args.no_kani
    and not changed_files
    or any(x.suffix in [".rs", ".toml", ".lock"] for x in changed_files)
):
    kani_grp = pipeline.build_group(
        "🔍 Kani",
        "./tools/devtool -y test --no-build -- ../tests/integration_tests/test_kani.py -n auto",
        # Kani step default
        # Kani runs fastest on m6a.metal
        instances=["m6a.metal", "m7g.metal"],
        platforms=[("al2", "linux_5.10")],
        timeout_in_minutes=300,
        **DEFAULTS_PERF,
        depends_on_build=False,
    )
    # modify Kani steps' label
    for step in kani_grp["steps"]:
        step["label"] = "🔍 Kani"

if run_all_tests(changed_files):
    pipeline.build_group(
        "📦 Build",
        pipeline.devtool_test(pytest_opts="integration_tests/build/"),
        depends_on_build=False,
    )

    pipeline.build_group(

Review comment (suggestion):
This needs to be
```suggestion
if (
    not pipeline.args.no_kani
    and (not changed_files
    or any(x.suffix in [".rs", ".toml", ".lock"] for x in changed_files))
```

as `and` takes precedence over `or`. As you've written it, the --no-kani flag will be ignored if a .rs/.toml/.lock file is touched.

Code after:
    {
        "command": "./tools/devtool -y checkstyle",
        "label": "🪶 Style",
    },
    depends_on_build=False,
)

# run sanity build of devtool if Dockerfile is changed
if any(x.parent.name == "devctr" for x in changed_files):
    pipeline.build_group_per_arch(
        "🐋 Dev Container Sanity Build",
        "./tools/devtool -y build_devctr && DEVCTR_IMAGE_TAG=latest ./tools/devtool test -- integration_tests/functional/test_api.py",
    )

if any(
    x.parent.name == "tools" and ("release" in x.name or x.name == "devtool")
    for x in changed_files
):
    pipeline.build_group_per_arch(
        "📦 Release Sanity Build",
        "./tools/devtool -y make_release",
    )

if not pipeline.args.no_kani and (
    not changed_files
    or any(x.suffix in [".rs", ".toml", ".lock"] for x in changed_files)
):
    kani_grp = pipeline.build_group(
        "🔍 Kani",
        "./tools/devtool -y test --no-build -- ../tests/integration_tests/test_kani.py -n auto",
        # Kani step default
        # Kani runs fastest on m6a.metal
        instances=["m6a.metal", "m7g.metal"],
        platforms=[("al2", "linux_5.10")],
        timeout_in_minutes=300,
        **DEFAULTS_PERF,
        depends_on_build=False,
    )
    # modify Kani steps' label
    for step in kani_grp["steps"]:
        step["label"] = "🔍 Kani"

if run_all_tests(changed_files):
    pipeline.build_group(
        "📦 Build",
        pipeline.devtool_test(pytest_opts="integration_tests/build/"),
        depends_on_build=False,
    )

    pipeline.build_group(
        "⚙ Functional and security 🔒",