Skip to content

fix(setup-python-runner): honour use-lxd input to skip LXD installation - #166

Merged
lengau merged 5 commits into
mainfrom
bot/fix-lxd
Aug 14, 2026
Merged

fix(setup-python-runner): honour use-lxd input to skip LXD installation#166
lengau merged 5 commits into
mainfrom
bot/fix-lxd

Conversation

@lengau

@lengau lengau commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

use-lxd: false had no effect: setup-python-runner never declared a use-lxd input (its "Setup LXD" step only checked runner.os == 'Linux'), and test-python.yaml never passed its use-lxd input through to the action.

Adds the input to the action, gates the LXD setup step on it, wires it through from test-python.yaml, and defaults it to true everywhere to preserve current behaviour. Adds regression self-tests.

lengau and others added 2 commits August 14, 2026 00:50
The setup-python-runner composite action never declared a use-lxd
input, so its Setup LXD step only checked runner.os == 'Linux' and
always installed LXD on Linux runners regardless of the caller's
intent.

test-python.yaml also declared a use-lxd workflow input but never
passed it through to the setup-python-runner action calls.

Add the use-lxd input to setup-python-runner, gate the Setup LXD step
on it, and wire it through from test-python.yaml's three call sites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Default use-lxd to true in both setup-python-runner and
test-python.yaml to preserve existing behavior for callers that don't
set the input explicitly.

Add self-tests to verify the use-lxd input is actually honored:
- self-test-setup.yaml: a new 'no-lxd' job calls the action with
  use-lxd: false and asserts /snap/bin/lxc is absent.
- self-test-qa.yaml: a new test-python-no-lxd caller job passes
  use-lxd: false through the reusable test-python.yaml workflow, and a
  verify-lxd-setup job inspects the run's job/step API to confirm the
  'Setup LXD' step never succeeds for that caller while it does
  succeed for test-python-custom (use-lxd: true).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 00:51
Comment thread .github/workflows/self-test-setup.yaml Fixed
Comment thread .github/workflows/self-test-setup.yaml Fixed
Comment thread .github/workflows/test-python.yaml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the setup-python-runner composite action and related workflows so the use-lxd input actually controls whether LXD is installed on Linux runners, and adds regression coverage to prevent reintroducing the issue.

Changes:

  • Add use-lxd input to setup-python-runner and gate the “Setup LXD” step on it.
  • Wire use-lxd through .github/workflows/test-python.yaml and default it to true to preserve current behavior.
  • Add self-test/regression workflows validating both the disabled path and step-level outcomes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
setup-python-runner/action.yaml Introduces use-lxd input and conditions the LXD setup step on it.
.github/workflows/test-python.yaml Defaults use-lxd to true and passes it through to the setup action across jobs.
.github/workflows/self-test-setup.yaml Adds a self-test job validating use-lxd: false avoids installing LXD.
.github/workflows/self-test-qa.yaml Adds a regression run plus verification logic to confirm the “Setup LXD” step outcome differs when toggling use-lxd.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread setup-python-runner/action.yaml Outdated
lengau and others added 3 commits August 14, 2026 00:57
Pin actions/checkout to a hash, disable credential persistence, and
add an explicit job-level permissions block to satisfy zizmor's
unpinned-uses, excessive-permissions, and artipacked audits.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
test-python.yaml pins setup-python-runner to @main, so the
test-python-no-lxd/verify-lxd-setup jobs added in the previous commit
could never pass within this PR (main lacks the use-lxd input until
merge). The no-lxd job in self-test-setup.yaml already exercises the
fix directly against the local action.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review feedback: comparing inputs.use-lxd to the string
'true' is fragile if the value isn't normalized. Use fromJSON() to
coerce the composite action's string input into a real boolean before
evaluating the condition.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (2)

setup-python-runner/action.yaml:29

  • use-lxd is declared as a boolean input, but the step condition parses it with fromJSON(...). If the action runtime provides typed boolean inputs, fromJSON can fail due to a type mismatch; if it provides strings, fromJSON is unnecessary complexity. Prefer a condition that works for both boolean and string representations without JSON parsing.
    - name: Setup LXD
      if: ${{ runner.os == 'Linux' && fromJSON(inputs.use-lxd) }}
      uses: canonical/setup-lxd@v1

.github/workflows/self-test-setup.yaml:122

  • This self-test assumes /snap/bin/lxc is absent on the runner when use-lxd: false. If the runner image ever ships with LXD/LXC preinstalled, the test will fail even though the action correctly skipped installation. Capture the pre-state and only fail when the action introduces /snap/bin/lxc on a previously-clean runner.
      - uses: ./setup-python-runner
        with:
          use-lxd: false
      - name: Check lxd is not installed
        run: |
          if [ -e /snap/bin/lxc ]; then
            echo "::error::/snap/bin/lxc should not exist when use-lxd is false"
            exit 1
          fi

@lengau

lengau commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Focal LXD 6 failure is external, handled with: canonical/setup-lxd#41

@lengau
lengau marked this pull request as ready for review August 14, 2026 01:33
@lengau
lengau requested a review from a team August 14, 2026 01:34
@mr-cal
mr-cal requested a review from a team August 14, 2026 13:29
@lengau
lengau merged commit f40020c into main Aug 14, 2026
53 of 54 checks passed
@lengau
lengau deleted the bot/fix-lxd branch August 14, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants