From 50467effab8949fdde5447460c3e295052a6222b Mon Sep 17 00:00:00 2001 From: Mostafa Farzan Date: Tue, 17 Nov 2026 15:25:50 +0900 Subject: [PATCH 1/3] ci: fix workflow permissions, pylint R1716 and unpinned pylxd - 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. --- .github/workflows/auto_update_libs.yaml | 3 +++ .github/workflows/comment.yaml | 2 ++ .github/workflows/copilot-collections-update.yaml | 3 +++ .github/workflows/integration_test.yaml | 2 ++ base_requirements.txt | 2 +- github-runner-manager/pyproject.toml | 2 +- .../src/github_runner_manager/manager/pressure_reconciler.py | 2 +- 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto_update_libs.yaml b/.github/workflows/auto_update_libs.yaml index 02b7b204e..fc18b9fdf 100644 --- a/.github/workflows/auto_update_libs.yaml +++ b/.github/workflows/auto_update_libs.yaml @@ -7,4 +7,7 @@ on: jobs: auto-update-libs: uses: canonical/operator-workflows/.github/workflows/auto_update_charm_libs.yaml@main + permissions: + contents: write + pull-requests: write secrets: inherit diff --git a/.github/workflows/comment.yaml b/.github/workflows/comment.yaml index 26ac226df..e98fbf446 100644 --- a/.github/workflows/comment.yaml +++ b/.github/workflows/comment.yaml @@ -9,4 +9,6 @@ on: jobs: comment-on-pr: uses: canonical/operator-workflows/.github/workflows/comment.yaml@main + permissions: + pull-requests: write secrets: inherit diff --git a/.github/workflows/copilot-collections-update.yaml b/.github/workflows/copilot-collections-update.yaml index 3023c5e42..0581e7730 100644 --- a/.github/workflows/copilot-collections-update.yaml +++ b/.github/workflows/copilot-collections-update.yaml @@ -8,6 +8,9 @@ jobs: check-update: # Always pin to @main to get the latest logic, but the content version is controlled by your .yaml file uses: canonical/copilot-collections/.github/workflows/auto_update_collections.yaml@main + permissions: + contents: write + pull-requests: write with: config_file: ".copilot-collections.yaml" secrets: inherit diff --git a/.github/workflows/integration_test.yaml b/.github/workflows/integration_test.yaml index 3a19d9274..13203504a 100644 --- a/.github/workflows/integration_test.yaml +++ b/.github/workflows/integration_test.yaml @@ -105,3 +105,5 @@ jobs: - openstack-integration-tests-cross-controller-private-endpoint - openstack-integration-tests-runner-bases uses: canonical/operator-workflows/.github/workflows/allure_report.yaml@main + permissions: + contents: write diff --git a/base_requirements.txt b/base_requirements.txt index 982a6ebdb..dcfd40786 100644 --- a/base_requirements.txt +++ b/base_requirements.txt @@ -2,7 +2,7 @@ PyGithub==2.8.1 jinja2==3.1.6 fabric==3.2.2 ops==3.5.2 -pylxd @ git+https://github.com/canonical/pylxd +pylxd @ git+https://github.com/canonical/pylxd@2.4.2 requests==2.33.0 typing-extensions==4.15.0 cryptography==49.0.0 diff --git a/github-runner-manager/pyproject.toml b/github-runner-manager/pyproject.toml index a9cdd765e..2726d9bfa 100644 --- a/github-runner-manager/pyproject.toml +++ b/github-runner-manager/pyproject.toml @@ -3,7 +3,7 @@ [project] name = "github-runner-manager" -version = "0.18.3" +version = "0.18.4" authors = [ { name = "Canonical IS DevOps", email = "is-devops-team@canonical.com" }, ] diff --git a/github-runner-manager/src/github_runner_manager/manager/pressure_reconciler.py b/github-runner-manager/src/github_runner_manager/manager/pressure_reconciler.py index 21ccaa37d..dd28c82c8 100644 --- a/github-runner-manager/src/github_runner_manager/manager/pressure_reconciler.py +++ b/github-runner-manager/src/github_runner_manager/manager/pressure_reconciler.py @@ -393,7 +393,7 @@ def _desired_total_from_pressure(self, pressure: int) -> int: The desired total number of runners. """ total = max(pressure, self._config.min_pressure, 0) - if self._config.max_pressure > 0 and total > self._config.max_pressure: + if 0 < self._config.max_pressure < total: logger.info( "Pressure %s exceeds max_pressure %s, clamping to %s", pressure, From 4b1df864fc09b5d47f6b1b4c619dcc5760ad512d Mon Sep 17 00:00:00 2001 From: Mostafa Farzan Date: Tue, 17 Nov 2026 15:42:39 +0900 Subject: [PATCH 2/3] ci: install pylxd 2.4.2 from PyPI instead of git 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. --- base_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_requirements.txt b/base_requirements.txt index dcfd40786..4f7203c18 100644 --- a/base_requirements.txt +++ b/base_requirements.txt @@ -2,7 +2,7 @@ PyGithub==2.8.1 jinja2==3.1.6 fabric==3.2.2 ops==3.5.2 -pylxd @ git+https://github.com/canonical/pylxd@2.4.2 +pylxd==2.4.2 requests==2.33.0 typing-extensions==4.15.0 cryptography==49.0.0 From 8dfb0958bcc9a3edb29dffcf8b9a08c6522eeff7 Mon Sep 17 00:00:00 2001 From: Mostafa Farzan Date: Wed, 18 Nov 2026 14:35:20 +0900 Subject: [PATCH 3/3] test: wait up to 30 minutes for runners to come online 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. --- tests/integration/helpers/common.py | 5 ++++- tests/integration/test_prometheus_metrics.py | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/integration/helpers/common.py b/tests/integration/helpers/common.py index e02eb2556..6794faf72 100644 --- a/tests/integration/helpers/common.py +++ b/tests/integration/helpers/common.py @@ -34,6 +34,9 @@ ) from manager_service import _get_log_file_path +# Runner VMs on the CI cloud are sometimes slow to come online. Each poll waits 30 seconds, so this +# allows up to 30 minutes. +WAIT_FOR_RUNNER_ONLINE_ATTEMPTS = 60 DISPATCH_TEST_WORKFLOW_FILENAME = "workflow_dispatch_test.yaml" DISPATCH_CRASH_TEST_WORKFLOW_FILENAME = "workflow_dispatch_crash_test.yaml" DISPATCH_FAILURE_TEST_WORKFLOW_FILENAME = "workflow_dispatch_failure_test.yaml" @@ -96,7 +99,7 @@ def wait_for_runner_ready(juju: jubilant.Juju, app_name: str, num_runners: int = num_runners: The minimum number of runners expected online. """ unit_name = f"{app_name}/0" - for attempt in range(20): + for attempt in range(WAIT_FOR_RUNNER_ONLINE_ATTEMPTS): try: result = juju.run(unit_name, "check-runners") except (jubilant.CLIError, TimeoutError): diff --git a/tests/integration/test_prometheus_metrics.py b/tests/integration/test_prometheus_metrics.py index 300f2e5e9..8f7e5be46 100644 --- a/tests/integration/test_prometheus_metrics.py +++ b/tests/integration/test_prometheus_metrics.py @@ -21,6 +21,7 @@ from charm_state import BASE_VIRTUAL_MACHINES_CONFIG_NAME from tests.integration.helpers.common import ( DISPATCH_TEST_WORKFLOW_FILENAME, + WAIT_FOR_RUNNER_ONLINE_ATTEMPTS, dispatch_workflow, ) @@ -183,7 +184,7 @@ def test_prometheus_metrics( def _wait_for_runner_ready(juju: jubilant.Juju, app_name: str) -> None: """Poll check-runners action until at least one runner is online.""" unit = f"{app_name}/0" - for attempt in range(20): + for attempt in range(WAIT_FOR_RUNNER_ONLINE_ATTEMPTS): try: result = juju.run(unit, "check-runners") except (jubilant.CLIError, TimeoutError): @@ -194,7 +195,9 @@ def _wait_for_runner_ready(juju: jubilant.Juju, app_name: str) -> None: return logger.info("Waiting for runner (attempt %d): online=%s", attempt, result.results) time.sleep(30) - raise TimeoutError(f"Runner on {unit} never came online after 20 attempts") + raise TimeoutError( + f"Runner on {unit} never came online after {WAIT_FOR_RUNNER_ONLINE_ATTEMPTS} attempts" + ) def _wait_for_no_runners(juju: jubilant.Juju, app_name: str) -> None: