From 882755eff1416aa69eecd1a2719038a33420ffec Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 14 Dec 2024 18:39:38 +0100 Subject: [PATCH] Switch default to true. --- .../fragments/1011-docker_compose_v2-build-changed.yml | 8 +++++--- plugins/modules/docker_compose_v2.py | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/changelogs/fragments/1011-docker_compose_v2-build-changed.yml b/changelogs/fragments/1011-docker_compose_v2-build-changed.yml index 2f5d03d51..873fd90d1 100644 --- a/changelogs/fragments/1011-docker_compose_v2-build-changed.yml +++ b/changelogs/fragments/1011-docker_compose_v2-build-changed.yml @@ -1,5 +1,7 @@ minor_changes: - - "docker_compose_v2 - add ``ignore_build_events`` option (default value ``false``) which allows to ignore build events for change detection. - This can be useful if ``build=always`` is set, to avoid having a changed status if the image was rebuilt, but the containers using it were not - restarted since the image did not change + - "docker_compose_v2 - add ``ignore_build_events`` option (default value ``true``) which allows to (not) ignore build events for change detection + (https://github.com/ansible-collections/community.docker/issues/1005, https://github.com/ansible-collections/community.docker/issues/pull/1011)." +bugfixes: + - "docker_compose_v2 - when using Compose 2.31.0 or newer, revert to the old behavior that image rebuilds, for example if ``rebuild=always``, only + result in ``changed`` if a container has been restarted (https://github.com/ansible-collections/community.docker/issues/1005, https://github.com/ansible-collections/community.docker/issues/pull/1011)." diff --git a/plugins/modules/docker_compose_v2.py b/plugins/modules/docker_compose_v2.py index c790fbcba..0c610c262 100644 --- a/plugins/modules/docker_compose_v2.py +++ b/plugins/modules/docker_compose_v2.py @@ -88,9 +88,9 @@ - If O(state=present) and O(ignore_build_events=true) and O(build=always), a rebuild that does not trigger a container restart no longer results in RV(ignore:changed=true). - Note that Docker Compose 2.31.0 is the first Compose 2.x version to emit build events. - For older versions, the behavior is always as if O(ignore_build_events=false). + For older versions, the behavior is always as if O(ignore_build_events=true). type: bool - default: false + default: true version_added: 4.2.0 recreate: description: @@ -650,7 +650,7 @@ def main(): scale=dict(type='dict'), wait=dict(type='bool', default=False), wait_timeout=dict(type='int'), - ignore_build_events=dict(type='bool', default=False), + ignore_build_events=dict(type='bool', default=True), ) argspec_ex = common_compose_argspec_ex() argument_spec.update(argspec_ex.pop('argspec'))