Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCKER-COMPOSE] - Fix manual update ([#546](https://github.com/getwud/wud/issues/546)) #574

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/api/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ async function runTrigger(req, res) {
res.status(200).json({});
} catch (e) {
log.warn(
`Trigger cannot be executed without container (type=${triggerType}, name=${triggerName})`,
`Error when running trigger (type=${triggerType}, name=${triggerName}) (${e.message})`,
);
res.status(500).json({
error: `Error when running trigger ${triggerType}.${triggerName} (${e.message})`,
error: `Error when running trigger (type=${triggerType}, name=${triggerName}) (${e.message})`,
});
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/api/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function runTrigger(req, res) {
res.status(200).json({});
} catch (e) {
log.warn(
`Trigger cannot be executed without container (type=${triggerType}, name=${triggerName})`,
`Error when running trigger ${triggerType}.${triggerName} (${e.message})`,
);
res.status(500).json({
error: `Error when running trigger ${triggerType}.${triggerName} (${e.message})`,
Expand Down
15 changes: 12 additions & 3 deletions app/triggers/providers/dockercompose/Dockercompose.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs/promises');
const yaml = require('yaml');
const Trigger = require('../docker/Docker');
const Docker = require('../docker/Docker');
const { getState } = require('../../../registry');

/**
Expand All @@ -27,7 +27,7 @@ function doesContainerBelongToCompose(compose, container) {
/**
* Update a Docker compose stack with an updated one.
*/
class Dockercompose extends Trigger {
class Dockercompose extends Docker {
/**
* Get the Trigger configuration schema.
* @returns {*}
Expand Down Expand Up @@ -55,6 +55,15 @@ class Dockercompose extends Trigger {
}
}

/**
* Update the container.
* @param container the container
* @returns {Promise<void>}
*/
async trigger(container) {
return this.triggerBatch([container]);
}

/**
* Update the docker-compose stack.
* @param containers the containers
Expand Down Expand Up @@ -119,7 +128,7 @@ class Dockercompose extends Trigger {
// Update all containers
// (super.notify will take care of the dry-run mode for each container as well)
await Promise.all(
containersFiltered.map((container) => this.trigger(container)),
containersFiltered.map((container) => super.trigger(container)),
);
}

Expand Down
1 change: 1 addition & 0 deletions docs/changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 8.0.1 (wip)
- :fire: Fix default healthcheck when http server is disabled ([#562](https://github.com/getwud/wud/issues/556))
- :fire: Fix missing Prometheus label ([#562](https://github.com/getwud/wud/issues/562))
- :fire: [DOCKER-COMPOSE] - Fix manual update ([#546](https://github.com/getwud/wud/issues/546))

## 8.0.0
- :star: [COMMAND] - Add support for [Command](/configuration/triggers/command/) trigger
Expand Down
10 changes: 5 additions & 5 deletions e2e/features/api-container.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ Feature: WUD Container API Exposure
| 0 | ecr.private | ecr_sub_sub_test | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | sub/sub/test | 1.0.0 | 2.0.0 | true |
| 1 | ecr.private | ecr_sub_test | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | sub/test | 1.0.0 | 2.0.0 | true |
| 2 | ecr.private | ecr_test | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | test | 1.0.0 | 2.0.0 | true |
| 3 | ghcr.private | ghcr_radarr | https://ghcr.io/v2 | linuxserver/radarr | 5.14.0.9383-ls245 | 5.17.2.9580-ls254 | true |
| 3 | ghcr.private | ghcr_radarr | https://ghcr.io/v2 | linuxserver/radarr | 5.14.0.9383-ls245 | 5.17.2.9580-ls255 | true |
| 4 | gitlab.private | gitlab_test | https://registry.gitlab.com/v2 | manfred-martin/docker-registry-test | 1.0.0 | 2.0.0 | true |
| 5 | hub.public | hub_homeassistant_202161 | https://registry-1.docker.io/v2 | homeassistant/home-assistant | 2021.6.1 |2025.1.2 | true |
| 5 | hub.public | hub_homeassistant_202161 | https://registry-1.docker.io/v2 | homeassistant/home-assistant | 2021.6.1 |2025.1.3 | true |
| 6 | hub.public | hub_homeassistant_latest | https://registry-1.docker.io/v2 | homeassistant/home-assistant | latest | latest | false |
| 7 | hub.public | hub_nginx_120 | https://registry-1.docker.io/v2 | library/nginx | 1.20-alpine | 1.27-alpine | true |
| 8 | hub.public | hub_nginx_latest | https://registry-1.docker.io/v2 | library/nginx | latest | latest | true |
| 9 | hub.public | hub_omnidb_latest | https://registry-1.docker.io/v2 | omnidbteam/omnidb | latest | latest | true |
| 10 | hub.public | hub_pihole_57 | https://registry-1.docker.io/v2 | pihole/pihole | v5.7 | v5.8.1 | true |
| 11 | hub.public | hub_pihole_latest | https://registry-1.docker.io/v2 | pihole/pihole | latest | latest | false |
| 12 | hub.public | hub_pyload_latest | https://registry-1.docker.io/v2 | writl/pyload | latest | latest | false |
| 13 | hub.public | hub_traefik_245 | https://registry-1.docker.io/v2 | library/traefik | 2.4.5 | 3.3.1 | true |
| 13 | hub.public | hub_traefik_245 | https://registry-1.docker.io/v2 | library/traefik | 2.4.5 | 3.3.2 | true |
| 14 | hub.public | hub_traefik_latest | https://registry-1.docker.io/v2 | library/traefik | latest | latest | false |
| 15 | hub.public | hub_vaultwarden_1222 | https://registry-1.docker.io/v2 | vaultwarden/server | 1.32.7-alpine | 1.32.7-alpine | false |
| 16 | hub.public | hub_vaultwarden_latest | https://registry-1.docker.io/v2 | vaultwarden/server | latest | latest | false |
| 17 | hub.public | hub_youtubedb_latest | https://registry-1.docker.io/v2 | jeeaaasustest/youtube-dl | latest | latest | false |
| 18 | lscr.private | lscr_radarr | https://lscr.io/v2 | linuxserver/radarr | 5.14.0.9383-ls245 | 5.17.2.9580-ls254 | true |
| 18 | lscr.private | lscr_radarr | https://lscr.io/v2 | linuxserver/radarr | 5.14.0.9383-ls245 | 5.17.2.9580-ls255 | true |
| 19 | quay.public | quay_prometheus | https://quay.io/v2 | prometheus/prometheus | v2.52.0 | v3.1.0 | true |

Scenario: WUD must allow to get a container with semver
Expand Down Expand Up @@ -85,7 +85,7 @@ Feature: WUD Container API Exposure
Then response code should be 200
And response body should be valid json
And response body path $.link should be https://github.com/home-assistant/core/releases/tag/2021.6.1
And response body path $.result.link should be https://github.com/home-assistant/core/releases/tag/2025.1.2
And response body path $.result.link should be https://github.com/home-assistant/core/releases/tag/2025.1.3

Scenario: WUD must allow to trigger a watch on a container
Given I GET /api/containers
Expand Down
8 changes: 4 additions & 4 deletions e2e/features/prometheus.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ Feature: Prometheus exposure
| ecr_sub_sub_test | ecr.private | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | sub/sub/test | 1.0.0 | 2.0.0 | true |
| ecr_sub_test | ecr.private | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | sub/test | 1.0.0 | 2.0.0 | true |
| ecr_test | ecr.private | https://229211676173.dkr.ecr.eu-west-1.amazonaws.com/v2 | test | 1.0.0 | 2.0.0 | true |
| ghcr_radarr | ghcr.private | https://ghcr.io/v2 | linuxserver/radarr | 5.14.0.9383-ls245 |5.17.2.9580-ls254 | true |
| ghcr_radarr | ghcr.private | https://ghcr.io/v2 | linuxserver/radarr | 5.14.0.9383-ls245 |5.17.2.9580-ls255 | true |
| gitlab_test | gitlab.private | https://registry.gitlab.com/v2 | manfred-martin/docker-registry-test | 1.0.0 | 2.0.0 | true |
| hub_homeassistant_202161 | hub.public | https://registry-1.docker.io/v2 | homeassistant/home-assistant | 2021.6.1 |2025.1.2 | true |
| hub_homeassistant_202161 | hub.public | https://registry-1.docker.io/v2 | homeassistant/home-assistant | 2021.6.1 |2025.1.3 | true |
| hub_homeassistant_latest | hub.public | https://registry-1.docker.io/v2 | homeassistant/home-assistant | latest | latest | false |
| hub_nginx_120 | hub.public | https://registry-1.docker.io/v2 | library/nginx | 1.20-alpine | 1.27-alpine | true |
| hub_nginx_latest | hub.public | https://registry-1.docker.io/v2 | library/nginx | latest | latest | true |
| hub_omnidb_latest | hub.public | https://registry-1.docker.io/v2 | omnidbteam/omnidb | latest | latest | false |
| hub_pihole_57 | hub.public | https://registry-1.docker.io/v2 | pihole/pihole | v5.7 | v5.8.1 | true |
| hub_pihole_latest | hub.public | https://registry-1.docker.io/v2 | pihole/pihole | latest | latest | false |
| hub_pyload_latest | hub.public | https://registry-1.docker.io/v2 | writl/pyload | latest | latest | false |
| hub_traefik_245 | hub.public | https://registry-1.docker.io/v2 | library/traefik | 2.4.5 | 3.3.1 | true |
| hub_traefik_245 | hub.public | https://registry-1.docker.io/v2 | library/traefik | 2.4.5 | 3.3.2 | true |
| hub_traefik_latest | hub.public | https://registry-1.docker.io/v2 | library/traefik | latest | latest | false |
| hub_vaultwarden_1222 | hub.public | https://registry-1.docker.io/v2 | vaultwarden/server | 1.32.7-alpine | 1.32.7-alpine | false |
| hub_vaultwarden_latest | hub.public | https://registry-1.docker.io/v2 | vaultwarden/server | latest | latest | false |
| hub_youtubedb_latest | hub.public | https://registry-1.docker.io/v2 | jeeaaasustest/youtube-dl | latest | latest | false |
| lscr_radarr | lscr.private | https://lscr.io/v2 | linuxserver/radarr | 5.14.0.9383-ls245 |5.17.2.9580-ls254 | true |
| lscr_radarr | lscr.private | https://lscr.io/v2 | linuxserver/radarr | 5.14.0.9383-ls245 |5.17.2.9580-ls255 | true |
| quay_prometheus | quay.public | https://quay.io/v2 | prometheus/prometheus | v2.52.0 |v3.1.0 | true |