user-install additions for saagent split docker image

Post Reply
wroomwroom
Posts: 48
Joined: Wed Jul 31, 2024 5:59 pm

user-install additions for saagent split docker image

Post by wroomwroom »

on top, after outbound_net_interface="${15}", add

Code: Select all

# Full image request including optional --key--value settings.
# New sagent passes the clean Docker image in $12 and the full request in $16.
docker_request="${16:-$docker_image}"

# Docker commands must only ever receive the real image reference.
docker_image="${docker_image%%--*}"

echo "DEBUG USER-INSTALL CUSTOM SETTINGS PATCH A"
echo "DEBUG argc=[$#]"
echo "DEBUG docker_image=[$docker_image]"
echo "DEBUG docker_request=[$docker_request]"
replace

Code: Select all

# Extract additional settings if present, replaces all -- with |, and use that string to create an array
echo
echo "# checking for any additional config elements within image name $docker_image"
IFS='|' read -r -a image_array <<< "$(echo $docker_image | sed 's/--/|/g' | cut -d'|' -f2-)"
with

Code: Select all

# Extract optional settings from the FULL request.
#
# Example:
#   everweb/webcbuilder:latest--subdomain--test
#
# becomes:
#   image_array[0]="subdomain"
#   image_array[1]="test"

echo
echo "# checking for additional config elements within docker request: $docker_request"

image_array=()

if [[ "$docker_request" == *"--"* ]]; then
    custom_settings="${docker_request#*--}"
    custom_settings="${custom_settings//--/|}"

    IFS='|' read -r -a image_array <<< "$custom_settings"

    echo "captured additional docker settings:"
    for i in "${!image_array[@]}"; do
        echo "DEBUG image_array[$i]=[${image_array[$i]}]"
    done
else
    echo "no additional docker settings found in request"
fi

sagent changes (splitting the docker image)
https://evernode.forum/viewtopic.php?t=1929

sagent building:
https://evernode.forum/viewtopic.php?t=1928
Post Reply