[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
parent
3c53a5aead
commit
3ae974432a
41
dd-ctl
41
dd-ctl
|
@ -174,6 +174,10 @@ ddupdate(){
|
||||||
}
|
}
|
||||||
|
|
||||||
build_compose(){
|
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 CUSTOM_PATH "$CUSTOM_PATH" .env
|
||||||
setconf BUILD_APPS_ROOT_PATH "$CUSTOM_PATH/dd-apps" .env
|
setconf BUILD_APPS_ROOT_PATH "$CUSTOM_PATH/dd-apps" .env
|
||||||
setconf BUILD_SSO_ROOT_PATH "$CUSTOM_PATH/dd-sso" .env
|
setconf BUILD_SSO_ROOT_PATH "$CUSTOM_PATH/dd-sso" .env
|
||||||
|
@ -755,6 +759,40 @@ setconf() {
|
||||||
fi
|
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
|
# Argument handling
|
||||||
case "$OPERATION" in
|
case "$OPERATION" in
|
||||||
build)
|
build)
|
||||||
|
@ -876,6 +914,9 @@ case "$OPERATION" in
|
||||||
listpatches)
|
listpatches)
|
||||||
listpatches
|
listpatches
|
||||||
;;
|
;;
|
||||||
|
push-images)
|
||||||
|
push_images
|
||||||
|
;;
|
||||||
failing-containers)
|
failing-containers)
|
||||||
fc="$(docker ps --format '{{.Names}}' -f 'health=unhealthy')"
|
fc="$(docker ps --format '{{.Names}}' -f 'health=unhealthy')"
|
||||||
if [ -n "${fc}" ]; then
|
if [ -n "${fc}" ]; then
|
||||||
|
|
|
@ -21,6 +21,7 @@ version: '3.7'
|
||||||
services:
|
services:
|
||||||
dd-sso-admin:
|
dd-sso-admin:
|
||||||
container_name: dd-sso-admin
|
container_name: dd-sso-admin
|
||||||
|
image: registry.dd-work.space/dd/sso-admin:${DD_BUILD:-latest}
|
||||||
build:
|
build:
|
||||||
context: ${BUILD_SSO_ROOT_PATH}
|
context: ${BUILD_SSO_ROOT_PATH}
|
||||||
dockerfile: admin/docker/Dockerfile
|
dockerfile: admin/docker/Dockerfile
|
||||||
|
|
Loading…
Reference in New Issue