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

Update conditional restart logic with dynamic rolling tag detection.

pull/5187/head
Catalan Lover 1 месяц назад
Родитель
Сommit
5aa5d9d0ce
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 99A263BABA26C9D9
4 измененных файлов: 10 добавлений и 14 удалений
  1. +4
    -6
      roles/custom/matrix-appservice-draupnir-for-all/defaults/main.yml
  2. +1
    -1
      roles/custom/matrix-appservice-draupnir-for-all/tasks/validate_config.yml
  3. +4
    -6
      roles/custom/matrix-bot-draupnir/defaults/main.yml
  4. +1
    -1
      roles/custom/matrix-bot-draupnir/tasks/validate_config.yml

+ 4
- 6
roles/custom/matrix-appservice-draupnir-for-all/defaults/main.yml Просмотреть файл

@@ -46,18 +46,16 @@ matrix_appservice_draupnir_for_all_systemd_required_services_list_custom: []
# List of systemd services that matrix-bot-draupnir.service wants
matrix_appservice_draupnir_for_all_systemd_wanted_services_list: []

# Force restart tag is used to control if the tag that is used is rolling or not.
# When both Draupnir roles are enabled, we only force restart if they are on the same
# version string and that version string matches the moving tag.
matrix_appservice_draupnir_for_all_force_rolling_tag: "latest"
# Rolling tag: true if version doesn't match semver shape (vX.Y.Z with optional prerelease/build), false otherwise.
matrix_appservice_draupnir_for_all_rolling_tag: "{{ not (matrix_appservice_draupnir_for_all_version is match('^v[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$')) }}"

# Force restart the service on all runs only when both roles are enabled, both roles
# are using the same version string, and that version is the moving tag.
# are using the same version string, and that version is a classified as a moving tag.
matrix_appservice_draupnir_for_all_force_restart: "{{
matrix_bot_draupnir_enabled | bool and
matrix_appservice_draupnir_for_all_enabled | bool and
matrix_bot_draupnir_version == matrix_appservice_draupnir_for_all_version and
matrix_appservice_draupnir_for_all_version == matrix_appservice_draupnir_for_all_force_rolling_tag
matrix_appservice_draupnir_for_all_rolling_tag | bool
}}"

# The room ID where people can use the bot. The bot has no access controls, so


+ 1
- 1
roles/custom/matrix-appservice-draupnir-for-all/tasks/validate_config.yml Просмотреть файл

@@ -23,7 +23,7 @@
- {'old': 'matrix_appservice_draupnir_for_all_docker_image_registry_prefix_upstream', 'new': 'matrix_appservice_draupnir_for_all_container_image_registry_prefix_upstream'}
- {'old': 'matrix_appservice_draupnir_for_all_docker_image_registry_prefix_upstream_default', 'new': 'matrix_appservice_draupnir_for_all_container_image_registry_prefix_upstream_default'}
- {'old': 'matrix_appservice_draupnir_for_all_docker_src_files_path', 'new': 'matrix_appservice_draupnir_for_all_container_src_files_path'}
- {'old': 'matrix_appservice_draupnir_for_all_container_image_force_pull', 'new': '<removed> (No longer needed due to new docker module doing this natively only if needed. If you run both bot mode and appservice mode matrix_appservice_draupnir_for_all_rolling_tag_force_pull is needed to make sure restart logic works correctly for both roles.)'}
- {'old': 'matrix_appservice_draupnir_for_all_container_image_force_pull', 'new': '<removed> (No longer needed due to new docker module doing this natively only if needed.)'}

- name: Fail if required matrix-bot-draupnir variables are undefined
ansible.builtin.fail:


+ 4
- 6
roles/custom/matrix-bot-draupnir/defaults/main.yml Просмотреть файл

@@ -28,18 +28,16 @@ matrix_bot_draupnir_config_path: "{{ matrix_bot_draupnir_base_path }}/config"
matrix_bot_draupnir_data_path: "{{ matrix_bot_draupnir_base_path }}/data"
matrix_bot_draupnir_container_src_files_path: "{{ matrix_bot_draupnir_base_path }}/docker-src"

# Force restart tag is used to control if the tag that is used is rolling or not.
# When both Draupnir roles are enabled, we only force restart if they are on the same
# version string and that version string matches the moving tag.
matrix_bot_draupnir_force_rolling_tag: "latest"
# Rolling tag: true if version doesn't match semver shape (vX.Y.Z with optional prerelease/build), false otherwise.
matrix_bot_draupnir_rolling_tag: "{{ not (matrix_bot_draupnir_version is match('^v[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$')) }}"

# Force restart the service on all runs only when both roles are enabled, both roles
# are using the same version string, and that version is the moving tag.
# are using the same version string, and that version is a classified as a moving tag.
matrix_bot_draupnir_force_restart: "{{
matrix_bot_draupnir_enabled | bool and
matrix_appservice_draupnir_for_all_enabled | bool and
matrix_bot_draupnir_version == matrix_appservice_draupnir_for_all_version and
matrix_bot_draupnir_version == matrix_bot_draupnir_rolling_tag
matrix_bot_draupnir_rolling_tag | bool
}}"

matrix_bot_draupnir_config_web_enabled: "{{ matrix_bot_draupnir_config_web_abuseReporting or matrix_bot_draupnir_config_web_synapseHTTPAntispam_enabled }}" # noqa var-naming


+ 1
- 1
roles/custom/matrix-bot-draupnir/tasks/validate_config.yml Просмотреть файл

@@ -37,7 +37,7 @@
- {'old': 'matrix_bot_draupnir_docker_image_registry_prefix_upstream', 'new': 'matrix_bot_draupnir_container_image_registry_prefix_upstream'}
- {'old': 'matrix_bot_draupnir_docker_image_registry_prefix_upstream_default', 'new': 'matrix_bot_draupnir_container_image_registry_prefix_upstream_default'}
- {'old': 'matrix_bot_draupnir_docker_src_files_path', 'new': 'matrix_bot_draupnir_container_src_files_path'}
- {'old': 'matrix_bot_draupnir_container_image_force_pull', 'new': '<removed> (No longer needed due to new docker module doing this natively only if needed. If you run both bot mode and appservice mode matrix_bot_draupnir_rolling_tag_force_pull is needed to make sure restart logic works correctly for both roles.)'}
- {'old': 'matrix_bot_draupnir_container_image_force_pull', 'new': '<removed> (No longer needed due to new docker module doing this natively only if needed.)'}

- name: Fail if required matrix-bot-draupnir variables are undefined
ansible.builtin.fail:


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