Fix self-building for Synapse v1.51.0 (requires BuildKit)

Synapse v1.51.0 requires to be built with BuildKit since
https://github.com/matrix-org/synapse/pull/11691

The `docker_image` Ansible module does not support BuildKit
(https://github.com/ansible-collections/community.general/issues/514),
so we had to switch to a `docker build` call.
development
Slavi Pantaleev 3 years ago
parent cf46b7fed5
commit ad082b3b1b

@ -18,6 +18,7 @@
group: "{{ matrix_user_groupname }}" group: "{{ matrix_user_groupname }}"
when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists" when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists"
- block:
- name: Ensure Synapse repository is present on self-build - name: Ensure Synapse repository is present on self-build
git: git:
repo: "{{ matrix_synapse_container_image_self_build_repo }}" repo: "{{ matrix_synapse_container_image_self_build_repo }}"
@ -25,18 +26,25 @@
version: "{{ matrix_synapse_docker_image.split(':')[1] }}" version: "{{ matrix_synapse_docker_image.split(':')[1] }}"
force: "yes" force: "yes"
register: matrix_synapse_git_pull_results register: matrix_synapse_git_pull_results
when: "matrix_synapse_container_image_self_build|bool"
- name: Check if Synapse Docker image exists
command: "{{ matrix_host_command_docker }} images --quiet --filter 'reference={{ matrix_synapse_docker_image }}'"
register: matrix_synapse_docker_image_check_result
# Invoking the `docker build` command here, instead of calling the `docker_image` Ansible module,
# because the latter does not support BuildKit.
# See: https://github.com/ansible-collections/community.general/issues/514
- name: Ensure Synapse Docker image is built - name: Ensure Synapse Docker image is built
docker_image: shell:
name: "{{ matrix_synapse_docker_image }}" chdir: "{{ matrix_synapse_docker_src_files_path }}"
source: build cmd: |
force_source: "{{ matrix_synapse_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" {{ matrix_host_command_docker }} build \
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_synapse_git_pull_results.changed }}" -t "{{ matrix_synapse_docker_image }}" \
build: -f docker/Dockerfile \
dockerfile: docker/Dockerfile .
path: "{{ matrix_synapse_docker_src_files_path }}" environment:
pull: yes DOCKER_BUILDKIT: 1
when: "matrix_synapse_git_pull_results.changed|bool or matrix_synapse_docker_image_check_result.stdout == ''"
when: "matrix_synapse_container_image_self_build|bool" when: "matrix_synapse_container_image_self_build|bool"
- name: Ensure Synapse Docker image is pulled - name: Ensure Synapse Docker image is pulled

Loading…
Cancel
Save