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..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 +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, 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: