[registry] Add dd-sso-admin as an image

This would be the first image that is already distributed directly
from the registry to improve setup and maintenance.
mejoras_instalacion
Evilham 2022-09-09 11:37:31 +02:00
parent 3c53a5aead
commit 3ae974432a
No known key found for this signature in database
GPG Key ID: AE3EE30D970886BF
2 changed files with 42 additions and 0 deletions

41
dd-ctl
View File

@ -174,6 +174,10 @@ ddupdate(){
}
build_compose(){
DD_DEFAULT_BUILD="$(git rev-parse --short HEAD)"
export DD_BUILD="${DD_BUILD:-${DD_DEFAULT_BUILD}}"
setconf DD_BUILD "${DD_BUILD}" .env
setconf CUSTOM_PATH "$CUSTOM_PATH" .env
setconf BUILD_APPS_ROOT_PATH "$CUSTOM_PATH/dd-apps" .env
setconf BUILD_SSO_ROOT_PATH "$CUSTOM_PATH/dd-sso" .env
@ -755,6 +759,40 @@ setconf() {
fi
}
special_image_tags() {
# Special image tags that apply to this build
head="$(git rev-parse HEAD)"
# loop through BRANCH:TAG1[:TAG2:...:TAG_N] items
for tag_info in develop:latest main:stable; do
branch="$(echo "${tag_info}" | cut -d ':' -f 1)"
upstream="$(git rev-parse "${DD_REMOTE:-origin}/${branch}" 2>/dev/null || true)"
if [ "${head}" = "${upstream}" ]; then
# If head and upstream match, use these tags
special_tags="$(echo "${tag_info}" | cut -d ':' -f 2- | tr ':' ' ')"
echo "${special_tags}"
fi
done
}
push_images() {
#
# Note this requires docker login on the registry
# (Runs on CI)
#
# Get images that are using the registry
images="$(docker ps --format '{{ .Names }}\t{{ .Image }}' | grep "${DD_REGISTRY:-registry.dd-work.space}")"
for extra_tag in $(special_image_tags); do
# And apply the special tags on them
for image in $(echo "${images}" | cut -f 2); do
docker tag "${image}" "${image%:*}:${extra_tag}"
done
done
image_names="$(echo "${images}" | cut -f 1 | tr '\n' '\t')"
# Finally, actually push all tags to the registry
# shellcheck disable=SC2086 # We do want multiple arguments
docker-compose push ${image_names:?}
}
# Argument handling
case "$OPERATION" in
build)
@ -876,6 +914,9 @@ case "$OPERATION" in
listpatches)
listpatches
;;
push-images)
push_images
;;
failing-containers)
fc="$(docker ps --format '{{.Names}}' -f 'health=unhealthy')"
if [ -n "${fc}" ]; then

View File

@ -21,6 +21,7 @@ version: '3.7'
services:
dd-sso-admin:
container_name: dd-sso-admin
image: registry.dd-work.space/dd/sso-admin:${DD_BUILD:-latest}
build:
context: ${BUILD_SSO_ROOT_PATH}
dockerfile: admin/docker/Dockerfile