From 1d1f519e3a50e992e154b4540ef2ad28c6804af2 Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Fri, 8 Nov 2024 18:29:35 +0100 Subject: [PATCH] chore(keycloak): split upstream container image coordinates --- roles/keycloak/defaults/main.yml | 12 +++++++++++- roles/keycloak/tasks/main.yml | 4 ++-- roles/keycloak/templates/Dockerfile.j2 | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/roles/keycloak/defaults/main.yml b/roles/keycloak/defaults/main.yml index 38473ee..b3a4c31 100644 --- a/roles/keycloak/defaults/main.yml +++ b/roles/keycloak/defaults/main.yml @@ -2,7 +2,17 @@ keycloak_version: 26.0.5 keycloak_container_name: keycloak -keycloak_container_upstream_image_name: quay.io/keycloak/keycloak +keycloak_container_image_upstream_registry: quay.io +keycloak_container_image_upstream_namespace: keycloak +keycloak_container_image_upstream_name: keycloak +keycloak_container_image_upstream: >-2 + {{ + ([ + keycloak_container_image_upstream_registry | default([]), + keycloak_container_image_upstream_namespace | default([]), + keycloak_container_image_upstream_name, + ] | flatten | join('/')) + }} keycloak_container_image_name: "keycloak:{{ keycloak_version }}-custom" keycloak_container_database_vendor: postgres diff --git a/roles/keycloak/tasks/main.yml b/roles/keycloak/tasks/main.yml index f56e8f7..e0a46c9 100644 --- a/roles/keycloak/tasks/main.yml +++ b/roles/keycloak/tasks/main.yml @@ -27,9 +27,9 @@ - keycloak-container - keycloak-build-container -- name: Ensure upstream Keycloak container image '{{ keycloak_container_upstream_image_name }}:{{ keycloak_version }}' is present +- name: Ensure upstream Keycloak container image '{{ keycloak_container_image_upstream }}:{{ keycloak_version }}' is present docker_image: - name: "{{ keycloak_container_upstream_image_name }}:{{ keycloak_version }}" + name: "{{ keycloak_container_image_upstream }}:{{ keycloak_version }}" source: pull state: present register: keycloak_container_image_upstream_status diff --git a/roles/keycloak/templates/Dockerfile.j2 b/roles/keycloak/templates/Dockerfile.j2 index cf1f785..33a8ba9 100644 --- a/roles/keycloak/templates/Dockerfile.j2 +++ b/roles/keycloak/templates/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM {{ keycloak_container_upstream_image_name }}:{{ keycloak_version }} as builder +FROM {{ keycloak_container_image_upstream }}:{{ keycloak_version }} as builder # Enable health and metrics support ENV KC_HEALTH_ENABLED={{ keycloak_config_health_enabled | ternary('true', 'false') }} @@ -27,7 +27,7 @@ RUN {{ keycloak_container_working_directory }}/bin/kc.sh --verbose \ {% endif %} -FROM {{ keycloak_container_upstream_image_name }}:{{ keycloak_version }} +FROM {{ keycloak_container_image_upstream }}:{{ keycloak_version }} COPY --from=builder {{ keycloak_container_working_directory }}/ {{ keycloak_container_working_directory }}/ ENV KC_HOSTNAME={{ keycloak_config_hostname }}