Skip to content

ci: fix workflow permissions, pylint R1716 and unpinned pylxd - #816

Draft
m2-farzan wants to merge 3 commits into
mainfrom
mostafa/fix-main-ci
Draft

m2-farzan wants to merge 3 commits into
mainfrom
mostafa/fix-main-ci

Conversation

@m2-farzan

Copy link
Copy Markdown

What this PR does

Fixes the CI failures on main that a code change can fix:

  • Adds permissions to the callers of four reusable workflows (matches the jenkins operator now):
    • auto_update_libs.yaml: contents: write, pull-requests: write
    • comment.yaml: pull-requests: write
    • copilot-collections-update.yaml: contents: write, pull-requests: write
    • the allure-report job in integration_test.yaml: contents: write
  • Rewrites the max_pressure check in pressure_reconciler.py as 0 < self._config.max_pressure < total. The behaviour is unchanged.
  • Pins pylxd in base_requirements.txt to the 2.4.2 tag instead of the moving default branch.
  • Bumps github-runner-manager from 0.18.3 to 0.18.4.

Why we need it

  • startup_failure on three workflows. Auto-update charm libraries, Comment on the pull request and Auto-Update Copilot Instructions end in startup_failure on every run. The called reusable workflows request contents: write and/or pull-requests: write, and the callers declare no permissions. canonical/jenkins-k8s-operator calls the same auto_update_charm_libs.yaml with these permissions and it runs.
  • allure-report 403. On scheduled runs, Publish Allure report fails with Permission to canonical/github-runner-operator.git denied to github-actions[bot] when it pushes to gh-pages.
  • Unit lint. pylint 4.1.3 reports R1716 chained-comparison at github-runner-manager/src/github_runner_manager/manager/pressure_reconciler.py:396, which fails Unit tests for github-runner-manager / Lint and unit tests. This is what blocks PRs such as chore: configure gh-jira-sync-bot #815.
  • TICS. TICS fails with No matching distribution found for pylxd (unavailable) and has failed 56 of the last 60 runs, since 2026-07-06. The requirement points at the default branch of canonical/pylxd, which is 106 commits ahead of the latest release. Pinning to the tag removes a moving target.

Not covered: the scheduled integration-tests fail on main because the runners cannot reach api.snapcraft.io (snap install lxd, core26, core20 and juju-db time out) and the VMs never come online. That is a runner network problem and cannot be fixed in this repository.

Not verified locally: pylint, the unit tests and tox could not be run (no package installs). The new condition was checked to be equivalent to the old one on small value pairs, and the modified workflow files parse as YAML. The permissions fix and the pylxd pin can only be confirmed by the workflows themselves. If the TICS error persists after the pin, its cause is something else.

Checklist

  • I followed the contributing guide
  • I added or updated the documentation (if applicable)
  • I updated docs/changelog.md with user-relevant changes
  • I used AI to assist with preparing this PR
  • I added or updated tests as needed (unit and integration)
  • If this is a Grafana dashboard: I added a screenshot of the dashboard
  • If this is Terraform: terraform fmt passes and tflint reports no errors
  • If the github-runner-manager application has been changed: The application version number is updated in github-runner-manager/pyproject.toml.

Not applicable: documentation, changelog (no user-relevant change), tests (the pressure_reconciler.py change is a refactor covered by the existing unit tests; the other changes are CI configuration), Grafana and Terraform.

- Grant the permissions the called reusable workflows request. The callers
  of auto_update_charm_libs, comment, copilot auto_update_collections and
  allure_report declared none, so the runs ended in startup_failure
  (allure-report: 403 pushing to gh-pages).
- Simplify the max_pressure check as pylint 4.1.3 R1716 requires
  (chained-comparison). Behaviour is unchanged.
- Pin pylxd to the 2.4.2 tag instead of the moving default branch.
- Bump github-runner-manager to 0.18.4.
The TICS runner (jammy, python3.10, old pip) cannot read the pyproject.toml
metadata of the pylxd git checkout: pip reports "produced metadata for
project name unknown" and discards the candidate, then fails with "No
matching distribution found for pylxd (unavailable)". Pinning the git tag
did not change that.

pylxd 2.4.2 is published on PyPI as a py3-none-any wheel, which needs no
metadata generation and therefore installs with any pip.
test_charm_runner and test_prometheus_metrics gave the runner VM only
20 x 30 seconds (10 minutes) to register and show online. On the CI cloud
the VMs are sometimes slow: test_e2e, which waits up to 30 minutes, passed
on a re-run after failing once with identical code, while the 10 minute
waits failed both times. Poll up to 60 times instead.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants