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