Fix self-building for matrix-ma1sd on non-version tag/branch

Building `master` or something like this was failing.
This commit is contained in:
Slavi Pantaleev 2021-01-14 23:57:38 +02:00
parent 9e936e45ad
commit 26f0bbfdef
2 changed files with 12 additions and 6 deletions

View File

@ -5,10 +5,13 @@ matrix_ma1sd_enabled: true
matrix_ma1sd_container_image_self_build: false
matrix_ma1sd_container_image_self_build_repo: "https://github.com/ma1uta/ma1sd.git"
matrix_ma1sd_container_image_self_build_branch: "{{ matrix_ma1sd_version }}"
matrix_ma1sd_architecture: "amd64"
matrix_ma1sd_docker_image: "{{ matrix_ma1sd_docker_image_name_prefix }}ma1uta/ma1sd:2.4.0-{{ matrix_ma1sd_architecture }}"
matrix_ma1sd_version: "2.4.0"
matrix_ma1sd_docker_image: "{{ matrix_ma1sd_docker_image_name_prefix }}ma1uta/ma1sd:{{ matrix_ma1sd_version }}-{{ matrix_ma1sd_architecture }}"
matrix_ma1sd_docker_image_name_prefix: "{{ 'localhost/' if matrix_ma1sd_container_image_self_build else 'docker.io/' }}"
matrix_ma1sd_docker_image_force_pull: "{{ matrix_ma1sd_docker_image.endswith(':latest') }}"

View File

@ -79,7 +79,7 @@
git:
repo: "{{ matrix_ma1sd_container_image_self_build_repo }}"
dest: "{{ matrix_ma1sd_docker_src_files_path }}"
version: "{{ matrix_ma1sd_docker_image.split(':')[1].split('-')[0] }}"
version: "{{ matrix_ma1sd_container_image_self_build_branch }}"
force: "yes"
register: matrix_ma1sd_git_pull_results
@ -90,10 +90,13 @@
- name: Ensure ma1sd Docker image is tagged correctly
docker_image:
# The build script always tags the image with something like `ma1uta/ma1sd:2.4.0`.
# Remove the `-{{ matrix_ma1sd_architecture }}` suffix and our `localhost/` prefix (applied when self-building)
# to get to what has actually been built, so we can retag it as `{{ matrix_ma1sd_docker_image }}`.
name: "{{ matrix_ma1sd_docker_image.split('-')[0].replace('localhost/', '') }}"
# The build script always tags the image with 2 tags:
# - based on the branch/version: e.g. `ma1uta/ma1sd:2.4.0` (when on `2.4.0`)
# or `ma1uta/ma1sd:2.4.0-19-ga71d32b` (when on a given commit for a pre-release)
# - generic one: `ma1uta/ma1sd:latest-dev`
#
# It's hard to predict the first one, so we'll use the latter.
name: "ma1uta/ma1sd:latest-dev"
repository: "{{ matrix_ma1sd_docker_image }}"
force_tag: yes
source: local