edit function build_image
This commit is contained in:
@@ -598,17 +598,30 @@ EOF
|
|||||||
|
|
||||||
# Projektparameter laden
|
# Projektparameter laden
|
||||||
load_project_config() {
|
load_project_config() {
|
||||||
local config_file="$1"
|
local project="$1"
|
||||||
registry=$(grep "^registry=" "$config_file" | cut -d= -f2)
|
local config_file="$CONFIG_DIR/$project.conf"
|
||||||
|
if [[ -f "$config_file" ]]; then
|
||||||
|
echo "Lade Konfiguration für Projekt: $project"
|
||||||
image_name=$(grep "^image_name=" "$config_file" | cut -d= -f2)
|
image_name=$(grep "^image_name=" "$config_file" | cut -d= -f2)
|
||||||
architectures=$(grep "^architectures=" "$config_file" | cut -d= -f2)
|
dockerfile=$(grep "^dockerfile=" "$config_file" | cut -d= -f2)
|
||||||
push=$(grep "^push=" "$config_file" | cut -d= -f2)
|
context=$(grep "^context=" "$config_file" | cut -d= -f2)
|
||||||
version=$(grep "^version=" "$config_file" | cut -d= -f2)
|
version=$(grep "^version=" "$config_file" | cut -d= -f2)
|
||||||
latest=$(grep "^latest=" "$config_file" | cut -d= -f2)
|
architectures=$(grep "^architectures=" "$config_file" | cut -d= -f2)
|
||||||
git_repo=$(grep "^git_repo=" "$config_file" | cut -d= -f2)
|
registries=$(grep "^registries=" "$config_file" | cut -d= -f2)
|
||||||
auto_subversion=$(grep "^auto_subversion=" "$config_file" | cut -d= -f2 || echo "no")
|
|
||||||
|
# Architekturen vereinheitlichen → Kommata in Leerzeichen umwandeln
|
||||||
|
architectures="${architectures//,/ }"
|
||||||
|
# Mehrfache Leerzeichen säubern
|
||||||
|
architectures=$(echo "$architectures" | xargs)
|
||||||
|
|
||||||
|
echo "Geladene Konfiguration: image_name=$image_name, dockerfile=$dockerfile, context=$context, version=$version, architectures=$architectures, registries=$registries"
|
||||||
|
else
|
||||||
|
echo "Konfigurationsdatei $config_file nicht gefunden!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Gibt die URL einer Registry anhand des Config-Files zurück
|
# Gibt die URL einer Registry anhand des Config-Files zurück
|
||||||
get_registry_url() {
|
get_registry_url() {
|
||||||
local reg=$1
|
local reg=$1
|
||||||
@@ -664,17 +677,23 @@ build_image() {
|
|||||||
echo "====================================" | tee -a "$logfile"
|
echo "====================================" | tee -a "$logfile"
|
||||||
|
|
||||||
# Architekturen-Array vorbereiten
|
# Architekturen-Array vorbereiten
|
||||||
|
load_project_config "$project"
|
||||||
|
|
||||||
|
local platforms=""
|
||||||
|
local arch_array=()
|
||||||
|
# Split nach Leerzeichen
|
||||||
read -r -a arch_array <<< "$architectures"
|
read -r -a arch_array <<< "$architectures"
|
||||||
platforms=""
|
|
||||||
for arch in "${arch_array[@]}"; do
|
for arch in "${arch_array[@]}"; do
|
||||||
case "$arch" in
|
case "$arch" in
|
||||||
amd64) platforms+="linux/amd64," ;;
|
amd64) platforms+="linux/amd64," ;;
|
||||||
arm64) platforms+="linux/arm64," ;;
|
arm64) platforms+="linux/arm64," ;;
|
||||||
armhf) platforms+="linux/arm/v7," ;;
|
armhf) platforms+="linux/arm/v7," ;;
|
||||||
x86) platforms+="linux/386," ;;
|
x86) platforms+="linux/386," ;;
|
||||||
*) echo "WARNUNG: Unbekannte Architektur '$arch' wird ignoriert." | tee -a "$logfile" ;;
|
*) echo "WARNUNG: Unbekannte Architektur '$arch' wird ignoriert." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
platforms="${platforms%,}"
|
platforms="${platforms%,}"
|
||||||
|
|
||||||
echo "DEBUG platforms='$platforms'" | tee -a "$logfile"
|
echo "DEBUG platforms='$platforms'" | tee -a "$logfile"
|
||||||
|
|||||||
Reference in New Issue
Block a user