fix function build_image

This commit is contained in:
2025-09-27 21:25:24 +02:00
parent 0b1c3d54cf
commit 9de438f4c7

View File

@@ -639,10 +639,8 @@ build_image() {
# Tags vorbereiten # Tags vorbereiten
local tags=() local tags=()
IFS=',' read -ra regs <<< "$registry"
for reg in "${regs[@]}"; do for reg in "${regs[@]}"; do
local url source "$CONFIG_DIR/registries/$reg/config-file"
url=$(jq -r '.url' "$CONFIG_DIR/registries/$reg/config-file")
tags+=("-t" "${url}/${image_name}:${version}") tags+=("-t" "${url}/${image_name}:${version}")
[[ "$latest" == "yes" ]] && tags+=("-t" "${url}/${image_name}:latest") [[ "$latest" == "yes" ]] && tags+=("-t" "${url}/${image_name}:latest")
done done
@@ -651,9 +649,9 @@ build_image() {
if [[ "$push" == "yes" ]]; then if [[ "$push" == "yes" ]]; then
for reg in "${regs[@]}"; do for reg in "${regs[@]}"; do
local url username password local url username password
url=$(jq -r '.url' "$CONFIG_DIR/registries/$reg/config-file") # key=value Datei einlesen
username=$(jq -r '.username // ""' "$CONFIG_DIR/registries/$reg/config-file") source "$CONFIG_DIR/registries/$reg/config-file"
password=$(jq -r '.password // ""' "$CONFIG_DIR/registries/$reg/config-file") # url, username, password stehen jetzt als Variablen zur Verfügung
if [[ -n "$username" && -n "$password" ]]; then if [[ -n "$username" && -n "$password" ]]; then
docker login "$url" -u "$username" -p "$password" &>> "$logfile" docker login "$url" -u "$username" -p "$password" &>> "$logfile"
fi fi