Просмотр исходного кода

Add migration validation system to catch breaking changes early

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
create-pull-request/i18n
Slavi Pantaleev 1 день назад
Родитель
Сommit
9a9392d24a
5 измененных файлов: 97 добавлений и 2 удалений
  1. +33
    -0
      CHANGELOG.md
  2. +5
    -0
      examples/vars.yml
  3. +19
    -1
      roles/custom/matrix_playbook_migration/defaults/main.yml
  4. +6
    -1
      roles/custom/matrix_playbook_migration/tasks/main.yml
  5. +34
    -0
      roles/custom/matrix_playbook_migration/tasks/validate_migration_version.yml

+ 33
- 0
CHANGELOG.md Просмотреть файл

@@ -1,3 +1,36 @@
# 2026-03-23

## Migration validation system introduced

Previously, when updating your setup, you had to remember to read the [CHANGELOG](CHANGELOG.md) file or risk breakage.

Now, the playbook includes a migration validation system that ensures you're aware of breaking changes before they affect your deployment.
You're now forced to acknowledge each breaking change, unless you wish to live dangerously (see below).

A new `matrix_playbook_migration_validated_version` variable has been introduced.

**New users** who started from the [example `vars.yml`](examples/vars.yml) file already have this variable set and do not need to do anything.

**Existing users** will need to add the following to their `vars.yml` file after reviewing all changelog entries up to now:

```yml
matrix_playbook_migration_validated_version: v2026.03.23.0
```

Going forward, whenever a breaking change is introduced the playbook will:

- bump its expected version value (`matrix_playbook_migration_expected_version`), causing a discrepancy with what you validated (`matrix_playbook_migration_validated_version`)

- fail when you run it with a helpful message listing what changed and linking to the relevant changelog entries

After reviewing and adapting your setup, you simply update the variable to the new version.

If you'd like to live dangerously and skip these checks (not recommended), you can set this once and be done with it:

```yml
matrix_playbook_migration_validated_version: "{{ matrix_playbook_migration_expected_version }}"
```

# 2026-03-19 # 2026-03-19


## Matrix Authentication Service now prefers UNIX sockets for playbook-managed Postgres ## Matrix Authentication Service now prefers UNIX sockets for playbook-managed Postgres


+ 5
- 0
examples/vars.yml Просмотреть файл

@@ -1,4 +1,9 @@
--- ---
# This variable acknowledges that you've reviewed breaking changes up to this version.
# The playbook will fail if this is outdated, guiding you through what changed.
# See the changelog: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/CHANGELOG.md
matrix_playbook_migration_validated_version: v2026.03.23.0

# The bare domain name which represents your Matrix identity. # The bare domain name which represents your Matrix identity.
# Matrix user IDs for your server will be of the form (`@alice:example.com`). # Matrix user IDs for your server will be of the form (`@alice:example.com`).
# #


+ 19
- 1
roles/custom/matrix_playbook_migration/defaults/main.yml Просмотреть файл

@@ -1,9 +1,27 @@
# SPDX-FileCopyrightText: 2023 - 2025 Slavi Pantaleev
# SPDX-FileCopyrightText: 2023 - 2026 Slavi Pantaleev
# SPDX-FileCopyrightText: 2024 Suguru Hirahara # SPDX-FileCopyrightText: 2024 Suguru Hirahara
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # 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. # Controls if (`matrix_prometheus_nginxlog_exporter` -> `prometheus_nginxlog_exporter`) validation will run.
matrix_playbook_migration_matrix_prometheus_nginxlog_exporter_migration_validation_enabled: true matrix_playbook_migration_matrix_prometheus_nginxlog_exporter_migration_validation_enabled: true




+ 6
- 1
roles/custom/matrix_playbook_migration/tasks/main.yml Просмотреть файл

@@ -1,9 +1,14 @@
# SPDX-FileCopyrightText: 2022 - 2024 Slavi Pantaleev
# SPDX-FileCopyrightText: 2022 - 2026 Slavi Pantaleev
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later


--- ---


- tags:
- always
block:
- ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_migration_version.yml"

- tags: - tags:
- setup-all - setup-all
- install-all - install-all


+ 34
- 0
roles/custom/matrix_playbook_migration/tasks/validate_migration_version.yml Просмотреть файл

@@ -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"

Загрузка…
Отмена
Сохранить