From 4f02ad7c75d1fb89e816e4e0a2f92ef24c6c3680 Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Sun, 5 Jul 2026 07:23:08 +0000 Subject: [PATCH 1/7] Validate garm configurator max runner --- charms/garm-configurator/src/charm_state.py | 4 ++++ charms/garm-configurator/tests/unit/test_charm.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/charms/garm-configurator/src/charm_state.py b/charms/garm-configurator/src/charm_state.py index 8b7df13c..b380ad39 100644 --- a/charms/garm-configurator/src/charm_state.py +++ b/charms/garm-configurator/src/charm_state.py @@ -254,6 +254,10 @@ def from_charm(cls, charm: ops.CharmBase) -> "ScalesetConfig": raise CharmConfigInvalidError( f"{SCALESET_MAX_RUNNER_CONFIG_NAME} must be non-negative" ) + if max_runner == 0: + raise CharmConfigInvalidError( + f"{SCALESET_MAX_RUNNER_CONFIG_NAME} must be greater than 0" + ) if max_runner < min_idle_runner: raise CharmConfigInvalidError( f"{SCALESET_MAX_RUNNER_CONFIG_NAME} must be greater than or equal to " diff --git a/charms/garm-configurator/tests/unit/test_charm.py b/charms/garm-configurator/tests/unit/test_charm.py index 3cd1bcdc..cf14e276 100644 --- a/charms/garm-configurator/tests/unit/test_charm.py +++ b/charms/garm-configurator/tests/unit/test_charm.py @@ -132,6 +132,11 @@ def test_charm_waiting_with_valid_config_no_relation(): "max-runner must be non-negative", id="negative-max-runner", ), + pytest.param( + {"max-runner": 0}, + "max-runner must be greater than 0", + id="zero-max-runner", + ), pytest.param( {"min-idle-runner": 5, "max-runner": 3}, "max-runner must be greater than or equal to min-idle-runner", From 00b4f267fab18b945c9ada1eb8e2fee403d80f9b Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Mon, 6 Jul 2026 05:45:57 +0000 Subject: [PATCH 2/7] Document max-runner validation --- docs/changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 453de5cc..a8ae22ce 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Each revision is versioned by the date of the revision. +## 2026-07-06 + +- `garm-configurator`: reject `max-runner=0` during config validation. GARM rejects scale set creation with `max_runners cannot be 0`, so the charm now surfaces the invalid configuration before publishing unusable scale set data to GARM. + ## 2026-07-02 - Fix GARM organization and repository registration: the charm now sets a webhook secret when registering entities. GARM requires a non-empty webhook secret to register an org/repo, so registration previously failed with an opaque server error and scalesets were never created. The charm generates a throwaway secret automatically, so no operator configuration is required. From 22b64b6e776a6ff6c1f0fbbc5fdf4173309646dc Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Mon, 6 Jul 2026 05:52:01 +0000 Subject: [PATCH 3/7] Update ops-scenario for ops 3.8 --- charms/garm-configurator/tox.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charms/garm-configurator/tox.toml b/charms/garm-configurator/tox.toml index 0319323f..056551b1 100644 --- a/charms/garm-configurator/tox.toml +++ b/charms/garm-configurator/tox.toml @@ -37,7 +37,7 @@ commands = [ [env.unit] description = "Run unit tests" -deps = ["pytest", "coverage[toml]", "ops-scenario==8.7.1", "-r requirements.txt"] +deps = ["pytest", "coverage[toml]", "ops-scenario==8.8.0", "-r requirements.txt"] commands = [ [ "coverage", From bc1b58e8c8fc6dc74c59d2a83d450db66a3948e5 Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Mon, 6 Jul 2026 06:24:50 +0000 Subject: [PATCH 4/7] Condense max-runner validation --- charms/garm-configurator/src/charm_state.py | 6 +----- charms/garm-configurator/tests/unit/test_charm.py | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/charms/garm-configurator/src/charm_state.py b/charms/garm-configurator/src/charm_state.py index b380ad39..59e86306 100644 --- a/charms/garm-configurator/src/charm_state.py +++ b/charms/garm-configurator/src/charm_state.py @@ -250,11 +250,7 @@ def from_charm(cls, charm: ops.CharmBase) -> "ScalesetConfig": ) max_runner = int(charm.config.get(SCALESET_MAX_RUNNER_CONFIG_NAME, 0)) - if max_runner < 0: - raise CharmConfigInvalidError( - f"{SCALESET_MAX_RUNNER_CONFIG_NAME} must be non-negative" - ) - if max_runner == 0: + if max_runner <= 0: raise CharmConfigInvalidError( f"{SCALESET_MAX_RUNNER_CONFIG_NAME} must be greater than 0" ) diff --git a/charms/garm-configurator/tests/unit/test_charm.py b/charms/garm-configurator/tests/unit/test_charm.py index cf14e276..06cff97f 100644 --- a/charms/garm-configurator/tests/unit/test_charm.py +++ b/charms/garm-configurator/tests/unit/test_charm.py @@ -129,7 +129,7 @@ def test_charm_waiting_with_valid_config_no_relation(): ), pytest.param( {"max-runner": -5}, - "max-runner must be non-negative", + "max-runner must be greater than 0", id="negative-max-runner", ), pytest.param( From daa37b60cce264aa02eec26113680d3b03e35462 Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Mon, 6 Jul 2026 07:13:11 +0000 Subject: [PATCH 5/7] Set max-runner in garm-configurator integration test --- charms/tests/integration/test_garm_configurator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/charms/tests/integration/test_garm_configurator.py b/charms/tests/integration/test_garm_configurator.py index 5772375c..c9a12eab 100644 --- a/charms/tests/integration/test_garm_configurator.py +++ b/charms/tests/integration/test_garm_configurator.py @@ -53,6 +53,7 @@ def deploy_garm_configurator_app_fixture( "name": "test-scaleset", "flavor": "m1.large", "os-arch": "amd64", + "max-runner": "1", "repo": "myorg/myrepo", }, ) From 4f537f4dff5fbd795aafa32fec9fd98d527d1fdb Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Mon, 6 Jul 2026 07:15:30 +0000 Subject: [PATCH 6/7] Set valid default for max-runner --- charms/garm-configurator/charmcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charms/garm-configurator/charmcraft.yaml b/charms/garm-configurator/charmcraft.yaml index 40305051..470d959f 100644 --- a/charms/garm-configurator/charmcraft.yaml +++ b/charms/garm-configurator/charmcraft.yaml @@ -84,7 +84,7 @@ config: Minimum number of idle runners in the scaleset. max-runner: type: int - default: 0 + default: 1 description: | Maximum number of runners in the scaleset. labels: From 36c550383b77dd1f2cb5e3ecb6b74a9b7231c9ea Mon Sep 17 00:00:00 2001 From: Christopher Bartz Date: Mon, 6 Jul 2026 07:22:18 +0000 Subject: [PATCH 7/7] Document max-runner config constraint --- charms/garm-configurator/charmcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charms/garm-configurator/charmcraft.yaml b/charms/garm-configurator/charmcraft.yaml index 470d959f..02732d97 100644 --- a/charms/garm-configurator/charmcraft.yaml +++ b/charms/garm-configurator/charmcraft.yaml @@ -86,7 +86,7 @@ config: type: int default: 1 description: | - Maximum number of runners in the scaleset. + Maximum number of runners in the scaleset. Must be greater than 0. labels: type: string description: |