Skip to content

bug: Pebble replan does not work on environment variable change #887

Description

@yanksyoon

Hello team! I've been hitting a weird behaviour in pebble with container add layer.

I've got a layer defined as follows:

container.add_layer(
            "garm-command",
            {
                "services": {
                    PEBBLE_SERVICE_NAME: {
                        "override": "replace",
                        "startup": "enabled",
                        "command": f"{GARM_BINARY} -config {GARM_CONFIG_PATH}",
                        "environment": {
                            "config_hash": new_hash,
                        },
                    }
                }
            },
            combine=True,
        )

I expect that whenever the config_hash value changes, the plan would be replaced/updated to the new one and the service to be restarted. There is a replan call after every service layer modification.

My charm logs verify that the hashes are changing

unit-github-runner-garm-0: 07:58:47 INFO unit.github-runner-garm/0.juju-log postgresql:6: configuration hash prev: None, new: 27330db4bdb5328c729c1d3b433a6dacbdd1ff04bb901deaea38d327cfcc4f0f, changed: True
...
unit-github-runner-garm-0: 07:59:16 INFO unit.github-runner-garm/0.juju-log garm-configurator:7: configuration hash prev: 27330db4bdb5328c729c1d3b433a6dacbdd1ff04bb901deaea38d327cfcc4f0f, new: 27330db4bdb5328c729c1d3b433a6dacbdd1ff04bb901deaea38d327cfcc4f0f, changed: False
...
unit-github-runner-garm-0: 07:59:17 INFO unit.github-runner-garm/0.juju-log garm-configurator:7: configuration hash prev: None, new: 41aea63c98224bce54d2e2917697ae0d56afa9c2cd5a56816cb735a201a08b79, changed: True

However, my pebble plan inside the container that I've been watching does not change in value.

Every 3.0s: /charm/bin/pebble plan                                    github-runner-garm-0: Wed Jun 17 08:11:22 2026

services:
    app:
        startup: enabled
        override: replace
        command: /usr/local/bin/garm -config /etc/garm/config.toml
        environment:
            config_hash: 27330db4bdb5328c729c1d3b433a6dacbdd1ff04bb901deaea38d327cfcc4f0f

It has been stuck on the first changed hash value for the entire lifetime of the charm.

Thank you!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions