From a228597dae6b1fb1b7bedc7fc728da4bbeeb8843 Mon Sep 17 00:00:00 2001 From: S Smith Date: Mon, 1 Jun 2026 17:52:02 +0000 Subject: [PATCH 1/2] should fail the pipeline --- group_vars/all.example.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/group_vars/all.example.yml b/group_vars/all.example.yml index 5429059..2e312a6 100644 --- a/group_vars/all.example.yml +++ b/group_vars/all.example.yml @@ -65,3 +65,4 @@ devcontainers: install: | sudo apt update sudo apt install -y --no-install-recommends ansible + echo "foobar" From bcf0097f4533090d0f380f853225eb61b4475229 Mon Sep 17 00:00:00 2001 From: S Smith Date: Mon, 1 Jun 2026 18:04:00 +0000 Subject: [PATCH 2/2] don't generate .devcontainer-bak-* directories on test harness --- Makefile | 2 +- roles/devcontainer_sync/defaults/main.yml | 1 + roles/devcontainer_sync/tasks/main.yml | 1 + tests/golden_output | 1 + tests/python-example/.devcontainer/install.sh | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8d7fc23..ce0a369 100644 --- a/Makefile +++ b/Makefile @@ -33,5 +33,5 @@ syntax: test: - $(ANSIBLE_PLAYBOOK) --diff $(PLAYBOOK) -e @$(EXAMPLE_VARS) -e workspace_root=$(TEST_WORKSPACE_ROOT) -e devcontainer_sync_create_missing=true -e devcontainer_sync_backup=false + $(ANSIBLE_PLAYBOOK) --diff $(PLAYBOOK) -e @$(EXAMPLE_VARS) -e workspace_root=$(TEST_WORKSPACE_ROOT) -e devcontainer_sync_create_missing=true -e devcontainer_sync_backup=false -e devcontainer_sync_backup_existing_dir=false find $(TEST_WORKSPACE_ROOT) -type f ! -path $(TEST_WORKSPACE_ROOT)/golden_output -print0 | sort -z | xargs -0r cat > $(TEST_WORKSPACE_ROOT)/golden_output diff --git a/roles/devcontainer_sync/defaults/main.yml b/roles/devcontainer_sync/defaults/main.yml index a055b00..2f7e954 100644 --- a/roles/devcontainer_sync/defaults/main.yml +++ b/roles/devcontainer_sync/defaults/main.yml @@ -1,4 +1,5 @@ --- devcontainer_sync_create_missing: false devcontainer_sync_backup: true +devcontainer_sync_backup_existing_dir: true devcontainer_sync_extra_files_root: "{{ playbook_dir }}/files" \ No newline at end of file diff --git a/roles/devcontainer_sync/tasks/main.yml b/roles/devcontainer_sync/tasks/main.yml index c5b587a..9443a98 100644 --- a/roles/devcontainer_sync/tasks/main.yml +++ b/roles/devcontainer_sync/tasks/main.yml @@ -53,6 +53,7 @@ label: "{{ item.item.path | dirname }}" index_var: devcontainer_sync_target_index when: + - devcontainer_sync_backup_existing_dir | bool - item.stat.exists - >- (devcontainer_sync_devcontainer_render_preview.results[devcontainer_sync_target_index].changed | default(false)) diff --git a/tests/golden_output b/tests/golden_output index 4acf737..db779fb 100644 --- a/tests/golden_output +++ b/tests/golden_output @@ -78,6 +78,7 @@ curl -sL -o cfr.jar 'https://www.benf.org/other/cfr/cfr-0.152.jar' #!/bin/bash sudo apt update sudo apt install -y --no-install-recommends ansible +echo "foobar" { // Managed by devcontainer-sync. Edit group_vars/all.yml instead. "name": "rust-example", diff --git a/tests/python-example/.devcontainer/install.sh b/tests/python-example/.devcontainer/install.sh index f114e0d..d7a71ab 100755 --- a/tests/python-example/.devcontainer/install.sh +++ b/tests/python-example/.devcontainer/install.sh @@ -1,3 +1,4 @@ #!/bin/bash sudo apt update sudo apt install -y --no-install-recommends ansible +echo "foobar"