From b0e984136f88f77b6a730578e4c4fef81347265a Mon Sep 17 00:00:00 2001 From: Matt Cengia Date: Fri, 17 Jul 2020 13:57:47 +1000 Subject: [PATCH 1/4] Fix issues building ma1sd Docker image The tag format used in the `ma1sd` repo have change. Versions no longer start with 'v', and when building for non-amd64, we also need to strip off the '-$arch' bit from the Docker image name. Further, when building the .jar file, `ma1sd` currently names the .jar based on the project's directory, which we call 'docker-src'. This means other parts of the `ma1sd` build can't find the .jar file. Remedy this by ensuring that the dir is called `docker-src/ma1sd`. --- roles/matrix-ma1sd/defaults/main.yml | 2 +- roles/matrix-ma1sd/tasks/setup_ma1sd.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/matrix-ma1sd/defaults/main.yml b/roles/matrix-ma1sd/defaults/main.yml index 822cc942..8fa8662a 100644 --- a/roles/matrix-ma1sd/defaults/main.yml +++ b/roles/matrix-ma1sd/defaults/main.yml @@ -11,7 +11,7 @@ matrix_ma1sd_docker_image: "ma1uta/ma1sd:2.4.0-{{ matrix_ma1sd_architecture }}" matrix_ma1sd_docker_image_force_pull: "{{ matrix_ma1sd_docker_image.endswith(':latest') }}" matrix_ma1sd_base_path: "{{ matrix_base_data_path }}/ma1sd" -matrix_ma1sd_docker_src_files_path: "{{ matrix_ma1sd_base_path }}/docker-src" +matrix_ma1sd_docker_src_files_path: "{{ matrix_ma1sd_base_path }}/docker-src/ma1sd" matrix_ma1sd_config_path: "{{ matrix_ma1sd_base_path }}/config" matrix_ma1sd_data_path: "{{ matrix_ma1sd_base_path }}/data" diff --git a/roles/matrix-ma1sd/tasks/setup_ma1sd.yml b/roles/matrix-ma1sd/tasks/setup_ma1sd.yml index ee055afd..cef94a24 100644 --- a/roles/matrix-ma1sd/tasks/setup_ma1sd.yml +++ b/roles/matrix-ma1sd/tasks/setup_ma1sd.yml @@ -54,7 +54,7 @@ git: repo: https://github.com/ma1uta/ma1sd.git dest: "{{ matrix_ma1sd_docker_src_files_path }}" - version: "v{{ matrix_ma1sd_docker_image.split(':')[1] }}" + version: "{{ matrix_ma1sd_docker_image.split(':')[1].split('-')[0] }}" force: "yes" - name: Ensure ma1sd Docker image is built From fede58fe96d44161d56ca25cc409a9f0167f2148 Mon Sep 17 00:00:00 2001 From: Matt Cengia Date: Fri, 17 Jul 2020 17:12:16 +1000 Subject: [PATCH 2/4] Correctly tag self-built ma1sd Docker image --- roles/matrix-ma1sd/tasks/setup_ma1sd.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/matrix-ma1sd/tasks/setup_ma1sd.yml b/roles/matrix-ma1sd/tasks/setup_ma1sd.yml index cef94a24..82595c1d 100644 --- a/roles/matrix-ma1sd/tasks/setup_ma1sd.yml +++ b/roles/matrix-ma1sd/tasks/setup_ma1sd.yml @@ -61,7 +61,15 @@ shell: "./gradlew dockerBuild" args: chdir: "{{ matrix_ma1sd_docker_src_files_path }}" - when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_container_image_self_build" + when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_container_image_self_build" + + - name: Ensure ma1sd Docker image is tagged correctly + docker_image: + name: "{{ matrix_ma1sd_docker_image.split('-')[0] }}" + repository: "{{ matrix_ma1sd_docker_image }}" + force_tag: yes + source: local + when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_container_image_self_build" - name: Ensure ma1sd config installed copy: From ab188018f3794ecc52e765a5950affab3592e610 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 17 Jul 2020 11:44:26 +0300 Subject: [PATCH 3/4] Move when statement to block The when statement is supposed to be on the block, not on the individual task. It affects all tasks within the block (they're all to be executed when ma1sd is enabled and self-building is requested0. --- roles/matrix-ma1sd/tasks/setup_ma1sd.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/matrix-ma1sd/tasks/setup_ma1sd.yml b/roles/matrix-ma1sd/tasks/setup_ma1sd.yml index 82595c1d..44fe6b19 100644 --- a/roles/matrix-ma1sd/tasks/setup_ma1sd.yml +++ b/roles/matrix-ma1sd/tasks/setup_ma1sd.yml @@ -61,7 +61,6 @@ shell: "./gradlew dockerBuild" args: chdir: "{{ matrix_ma1sd_docker_src_files_path }}" - when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_container_image_self_build" - name: Ensure ma1sd Docker image is tagged correctly docker_image: @@ -69,7 +68,7 @@ repository: "{{ matrix_ma1sd_docker_image }}" force_tag: yes source: local - when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_container_image_self_build" + when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_container_image_self_build" - name: Ensure ma1sd config installed copy: From 28855d1bb4f1fe5b78ffaeea370b2a13ec7a449c Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 17 Jul 2020 11:47:15 +0300 Subject: [PATCH 4/4] Document matrix_ma1sd_docker_src_files_path naming --- roles/matrix-ma1sd/defaults/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/matrix-ma1sd/defaults/main.yml b/roles/matrix-ma1sd/defaults/main.yml index 8fa8662a..713dd3ed 100644 --- a/roles/matrix-ma1sd/defaults/main.yml +++ b/roles/matrix-ma1sd/defaults/main.yml @@ -11,6 +11,7 @@ matrix_ma1sd_docker_image: "ma1uta/ma1sd:2.4.0-{{ matrix_ma1sd_architecture }}" matrix_ma1sd_docker_image_force_pull: "{{ matrix_ma1sd_docker_image.endswith(':latest') }}" matrix_ma1sd_base_path: "{{ matrix_base_data_path }}/ma1sd" +# We need the docker src directory to be named ma1sd. See: https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/588 matrix_ma1sd_docker_src_files_path: "{{ matrix_ma1sd_base_path }}/docker-src/ma1sd" matrix_ma1sd_config_path: "{{ matrix_ma1sd_base_path }}/config" matrix_ma1sd_data_path: "{{ matrix_ma1sd_base_path }}/data"