3
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2026-03-25 22:17:25 +00:00

Add migration validation system to catch breaking changes early

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Slavi Pantaleev
2026-03-22 14:40:02 +02:00
parent 4991ce3c90
commit 9a9392d24a
5 changed files with 97 additions and 2 deletions

View File

@@ -1,9 +1,27 @@
# SPDX-FileCopyrightText: 2023 - 2025 Slavi Pantaleev
# SPDX-FileCopyrightText: 2023 - 2026 Slavi Pantaleev
# SPDX-FileCopyrightText: 2024 Suguru Hirahara
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
# The version that the user has validated their setup against.
# When empty, the user will be prompted to set this variable.
# New users should set this to the current expected version (see below).
# See `examples/vars.yml` and `matrix_playbook_migration_expected_version` for the recommended value.
matrix_playbook_migration_validated_version: ''
# The version that the playbook expects the user to have validated against.
# This is bumped whenever a breaking change is introduced.
# The value configured here needs to exist in `matrix_playbook_migration_breaking_changes` as well.
matrix_playbook_migration_expected_version: "v2026.03.23.0"
# A list of breaking changes, used to inform users what changed between their validated version and the expected version.
matrix_playbook_migration_breaking_changes:
- version: "v2026.03.23.0"
summary: "Initial migration validation system"
changelog_url: "https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/CHANGELOG.md#2026-03-22"
# Controls if (`matrix_prometheus_nginxlog_exporter` -> `prometheus_nginxlog_exporter`) validation will run.
matrix_playbook_migration_matrix_prometheus_nginxlog_exporter_migration_validation_enabled: true

View File

@@ -1,9 +1,14 @@
# SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev
# SPDX-FileCopyrightText: 2022 - 2026 Slavi Pantaleev
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- tags:
- always
block:
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_migration_version.yml"
- tags:
- setup-all
- install-all

View File

@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2026 Slavi Pantaleev
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
- name: Fail if migration version is not validated (first-time onboarding)
ansible.builtin.fail:
msg: >-
This playbook now uses a migration validation system to help you stay aware of breaking changes.
It appears that you haven't configured the `matrix_playbook_migration_validated_version` variable yet.
Please review the changelog (https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/CHANGELOG.md)
and then add the following to your vars.yml file:
matrix_playbook_migration_validated_version: {{ matrix_playbook_migration_expected_version }}
when: "matrix_playbook_migration_validated_version == ''"
- name: Fail if migration version is outdated
ansible.builtin.fail:
msg: |-
Your validated migration version ({{ matrix_playbook_migration_validated_version }}) is behind the expected version ({{ matrix_playbook_migration_expected_version }}).
The following breaking changes have been introduced since your last validation:
{% for item in matrix_playbook_migration_breaking_changes | selectattr('version', '>', matrix_playbook_migration_validated_version) | sort(attribute='version') %}
- {{ item.version }}: {{ item.summary }} ({{ item.changelog_url }})
{% endfor %}
After reviewing the above changes and adapting your setup, update your vars.yml:
matrix_playbook_migration_validated_version: "{{ matrix_playbook_migration_expected_version }}"
when: "matrix_playbook_migration_validated_version != '' and matrix_playbook_migration_validated_version < matrix_playbook_migration_expected_version"