Upgrade mjolnir (0.1.17 -> 0.1.18) and implement self building
This commit is contained in:
parent
6294e58304
commit
19ed8d1d17
|
@ -26,6 +26,7 @@ List of roles where self-building the Docker image is currently possible:
|
||||||
- `matrix-bridge-mautrix-hangouts`
|
- `matrix-bridge-mautrix-hangouts`
|
||||||
- `matrix-bridge-mautrix-telegram`
|
- `matrix-bridge-mautrix-telegram`
|
||||||
- `matrix-bridge-mx-puppet-skype`
|
- `matrix-bridge-mx-puppet-skype`
|
||||||
|
- `matrix-bot-mjolnir`
|
||||||
|
|
||||||
Adding self-building support to other roles is welcome. Feel free to contribute!
|
Adding self-building support to other roles is welcome. Feel free to contribute!
|
||||||
|
|
||||||
|
|
|
@ -851,6 +851,8 @@ matrix_bot_go_neb_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_en
|
||||||
# We don't enable bots by default.
|
# We don't enable bots by default.
|
||||||
matrix_bot_mjolnir_enabled: false
|
matrix_bot_mjolnir_enabled: false
|
||||||
|
|
||||||
|
matrix_bot_mjolnir_container_image_self_build: "{{ matrix_architecture != 'amd64'}}"
|
||||||
|
|
||||||
matrix_bot_mjolnir_systemd_required_services_list: |
|
matrix_bot_mjolnir_systemd_required_services_list: |
|
||||||
{{
|
{{
|
||||||
['docker.service']
|
['docker.service']
|
||||||
|
|
|
@ -2,13 +2,20 @@
|
||||||
# See: https://github.com/matrix-org/mjolnir
|
# See: https://github.com/matrix-org/mjolnir
|
||||||
|
|
||||||
matrix_bot_mjolnir_enabled: true
|
matrix_bot_mjolnir_enabled: true
|
||||||
matrix_bot_mjolnir_version: "v0.1.17"
|
|
||||||
matrix_bot_mjolnir_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/mjolnir:{{ matrix_bot_mjolnir_version }}"
|
matrix_bot_mjolnir_version: "v0.1.18"
|
||||||
|
|
||||||
|
matrix_bot_mjolnir_container_image_self_build: false
|
||||||
|
matrix_bot_mjolnir_container_image_self_build_repo: "https://github.com/matrix-org/mjolnir.git"
|
||||||
|
|
||||||
|
matrix_bot_mjolnir_docker_image: "{{ matrix_bot_mjolnir_docker_image_name_prefix }}matrixdotorg/mjolnir:{{ matrix_bot_mjolnir_version }}"
|
||||||
|
matrix_bot_mjolnir_docker_image_name_prefix: "{{ 'localhost/' if matrix_bot_mjolnir_container_image_self_build else matrix_container_global_registry_prefix }}"
|
||||||
matrix_bot_mjolnir_docker_image_force_pull: "{{ matrix_bot_mjolnir_docker_image.endswith(':latest') }}"
|
matrix_bot_mjolnir_docker_image_force_pull: "{{ matrix_bot_mjolnir_docker_image.endswith(':latest') }}"
|
||||||
|
|
||||||
matrix_bot_mjolnir_base_path: "{{ matrix_base_data_path }}/mjolnir"
|
matrix_bot_mjolnir_base_path: "{{ matrix_base_data_path }}/mjolnir"
|
||||||
matrix_bot_mjolnir_config_path: "{{ matrix_bot_mjolnir_base_path }}/config"
|
matrix_bot_mjolnir_config_path: "{{ matrix_bot_mjolnir_base_path }}/config"
|
||||||
matrix_bot_mjolnir_data_path: "{{ matrix_bot_mjolnir_base_path }}/data"
|
matrix_bot_mjolnir_data_path: "{{ matrix_bot_mjolnir_base_path }}/data"
|
||||||
|
matrix_bot_mjolnir_docker_src_files_path: "{{ matrix_bot_mjolnir_base_path }}/docker-src"
|
||||||
|
|
||||||
# A list of extra arguments to pass to the container
|
# A list of extra arguments to pass to the container
|
||||||
matrix_bot_mjolnir_container_extra_arguments: []
|
matrix_bot_mjolnir_container_extra_arguments: []
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
# See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070
|
||||||
|
# and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407
|
||||||
|
- name: Fail if trying to self-build on Ansible < 2.8
|
||||||
|
fail:
|
||||||
|
msg: "To self-build the Mjolnir image, you should use Ansible 2.8 or higher. See docs/ansible.md"
|
||||||
|
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_bot_mjolnir_container_image_self_build and matrix_bot_mjolnir_enabled"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-mjolnir.service'] }}"
|
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-mjolnir.service'] }}"
|
||||||
when: matrix_bot_mjolnir_enabled|bool
|
when: matrix_bot_mjolnir_enabled|bool
|
||||||
|
|
|
@ -14,14 +14,36 @@
|
||||||
- { path: "{{ matrix_bot_mjolnir_base_path }}", when: true }
|
- { path: "{{ matrix_bot_mjolnir_base_path }}", when: true }
|
||||||
- { path: "{{ matrix_bot_mjolnir_config_path }}", when: true }
|
- { path: "{{ matrix_bot_mjolnir_config_path }}", when: true }
|
||||||
- { path: "{{ matrix_bot_mjolnir_data_path }}", when: true }
|
- { path: "{{ matrix_bot_mjolnir_data_path }}", when: true }
|
||||||
|
- { path: "{{ matrix_bot_mjolnir_docker_src_files_path }}", when: "{{ matrix_bot_mjolnir_container_image_self_build }}" }
|
||||||
when: "item.when|bool"
|
when: "item.when|bool"
|
||||||
|
|
||||||
- name: Ensure mjolnir image is pulled
|
- name: Ensure mjolnir Docker image is pulled
|
||||||
docker_image:
|
docker_image:
|
||||||
name: "{{ matrix_bot_mjolnir_docker_image }}"
|
name: "{{ matrix_bot_mjolnir_docker_image }}"
|
||||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||||
force_source: "{{ matrix_bot_mjolnir_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
force_source: "{{ matrix_bot_mjolnir_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_mjolnir_docker_image_force_pull }}"
|
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_mjolnir_docker_image_force_pull }}"
|
||||||
|
when: "not matrix_bot_mjolnir_container_image_self_build|bool"
|
||||||
|
|
||||||
|
- name: Ensure mjolnir repository is present on self-build
|
||||||
|
git:
|
||||||
|
repo: "{{ matrix_bot_mjolnir_container_image_self_build_repo }}"
|
||||||
|
dest: "{{ matrix_bot_mjolnir_docker_src_files_path }}"
|
||||||
|
version: "{{ matrix_bot_mjolnir_docker_image.split(':')[1] }}"
|
||||||
|
force: "yes"
|
||||||
|
register: matrix_bot_mjolnir_git_pull_results
|
||||||
|
when: "matrix_bot_mjolnir_container_image_self_build|bool"
|
||||||
|
|
||||||
|
- name: Ensure mjolnir Docker image is built
|
||||||
|
docker_image:
|
||||||
|
name: "{{ matrix_bot_mjolnir_docker_image }}"
|
||||||
|
source: build
|
||||||
|
force_source: "{{ matrix_bot_mjolnir_git_pull_results.changed }}"
|
||||||
|
build:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
path: "{{ matrix_bot_mjolnir_docker_src_files_path }}"
|
||||||
|
pull: yes
|
||||||
|
when: "matrix_bot_mjolnir_container_image_self_build|bool"
|
||||||
|
|
||||||
- name: Ensure matrix-bot-mjolnir config installed
|
- name: Ensure matrix-bot-mjolnir config installed
|
||||||
copy:
|
copy:
|
||||||
|
|
Loading…
Reference in a new issue