canonical / discourse-k8s-operator

discourse-k8s-operator - charm repository.
Apache License 2.0
7 stars 5 forks source link

Outdated `redis-image` pinned in release workflow #261

Closed codethulu closed 5 months ago

codethulu commented 5 months ago

Bug Description

In the release workflow the redis-image is pinned to revision 3. This means that the updated image is not uploaded, and therefore the redis-relation-created hook fails due to the redis_exporter not being found.

erroneous release workflow:

      - name: Upload charm to charmhub
        uses: canonical/charming-actions/upload-charm@2.1.1
        with:
          resource-overrides: "redis-image:3"
          credentials: "${{ secrets.CHARMHUB_TOKEN }}"
          github-token: "${{ secrets.GITHUB_TOKEN }}"
          channel: "${{ steps.channel.outputs.name }}"

To Reproduce

  1. deploy a charm that requires some redis relation
  2. deploy redis-k8s, series="jammy" channel="latest/edge"
  3. wait for active status, redis-relation-created hook will fail in the unit.

Environment

The unit is failing in Github CI. Deploying charm from lates/edge and failing from changes made in Revision 29.

juju 3.1.8 microk8s 1.28.10

Relevant log output

ERROR---------------------------- live log sessionfinish ----------------------------
INFO     pytest_operator.plugin:plugin.py:862 Model status:

Model    Controller                Cloud/Region        Version  SLA          Timestamp
testing  github-pr-9af29-microk8s  microk8s/localhost  3.1.8    unsupported  15:20:42Z

App                       Version  Status   Scale  Charm                     Channel        Rev  Address         Exposed  Message
discourse-k8s                      waiting      1  discourse-k8s                              0  10.152.183.166  no       installing agent
nginx-ingress-integrator  24.2.0   waiting      1  nginx-ingress-integrator  latest/stable  101  10.152.183.74   no       installing agent
postgresql-k8s            14.11    active       1  postgresql-k8s            14/edge        276  10.152.183.161  no       Primary
redis-k8s                 7.0.4    active       1  redis-k8s                 latest/edge     29  10.152.183.146  no       

Unit                         Workload  Agent      Address     Ports  Message
discourse-k8s/0*             waiting   executing  10.1.61.78         Waiting for database relation
nginx-ingress-integrator/0*  waiting   executing  10.1.61.77         Waiting for ingress IP availability
postgresql-k8s/0*            active    idle       10.1.61.74         Primary
redis-k8s/0*                 error     idle       10.1.61.76         hook failed: "redis-relation-created"

INFO     pytest_operator.plugin:plugin.py:868 Juju error logs:

unit-redis-k8s-0: 15:18:33 ERROR unit.redis-k8s/0.juju-log Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/./src/charm.py", line 723, in <module>
    main(RedisK8sCharm)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/main.py", line 441, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/main.py", line 149, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/framework.py", line 354, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/framework.py", line 830, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/framework.py", line 919, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/./src/charm.py", line 106, in _redis_pebble_ready
    self._update_layer()
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/./src/charm.py", line 352, in _update_layer
    container.restart("redis", "redis_exporter")
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/model.py", line 1893, in restart
    self._pebble.restart_services(service_names)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/pebble.py", line 1638, in restart_services
    return self._services_action('restart', services, timeout, delay)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/pebble.py", line 1659, in _services_action
    raise ChangeError(change.err, change)
ops.pebble.ChangeError: cannot perform the following tasks:
- Start service "redis_exporter" (cannot start service: fork/exec bin/redis_exporter: no such file or directory)
----- Logs from task 0 -----
2024-06-12T15:18:32Z INFO Service "redis" has never been started.
----- Logs from task 1 -----
2024-06-12T15:18:32Z INFO Service "redis_exporter" has never been started.
----- Logs from task 3 -----
2024-06-12T15:18:33Z ERROR cannot start service: fork/exec bin/redis_exporter: no such file or directory
-----
unit-redis-k8s-0: 15:18:33 ERROR juju.worker.uniter.operation hook "redis-pebble-ready" (via hook dispatching script: dispatch) failed: exit status 1
unit-redis-k8s-0: 15:18:33 ERROR juju.worker.uniter pebble poll failed for container "redis": failed to send pebble-ready event: hook failed
unit-redis-k8s-0: 15:20:40 ERROR unit.redis-k8s/0.juju-log redis:6: Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/./src/charm.py", line 723, in <module>
    main(RedisK8sCharm)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/main.py", line 441, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/main.py", line 149, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/framework.py", line 354, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/framework.py", line 830, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/framework.py", line 919, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/./src/charm.py", line 310, in _on_redis_relation_created
    self._update_layer()
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/./src/charm.py", line 352, in _update_layer
    container.restart("redis", "redis_exporter")
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/model.py", line 1893, in restart
    self._pebble.restart_services(service_names)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/pebble.py", line 1638, in restart_services
    return self._services_action('restart', services, timeout, delay)
  File "/var/lib/juju/agents/unit-redis-k8s-0/charm/venv/ops/pebble.py", line 1659, in _services_action
    raise ChangeError(change.err, change)
ops.pebble.ChangeError: cannot perform the following tasks:
- Start service "redis_exporter" (cannot start service: fork/exec bin/redis_exporter: no such file or directory)
----- Logs from task 1 -----
2024-06-12T15:20:39Z INFO Service "redis_exporter" has never been started.
----- Logs from task 3 -----
2024-06-12T15:20:40Z ERROR cannot start service: fork/exec bin/redis_exporter: no such file or directory
-----
unit-redis-k8s-0: 15:20:40 ERROR juju.worker.uniter.operation hook "redis-relation-created" (via hook dispatching script: dispatch) failed: exit status 1

INFO     pytest_operator.plugin:plugin.py:947 Forgetting model main...

Additional context

No response

mthaddon commented 5 months ago

Sorry, I'd linked to the wrong repo for this issue, please file against redis-k8s-operator.