Skip to content

Commit

Permalink
Try to use debug output from helm template if it fails
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Squizzato <[email protected]>
  • Loading branch information
squizzi committed Nov 5, 2024
1 parent e1cdd25 commit cdc71f1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions scripts/bundle-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function wait_for_deploy_exist() {

start_time=$(date +%s)

echo "Verifying provider Deployment with label: \"${deployment_label}\" exists in namespace: \"${NAMESPACE}\"..."
echo "Waiting up to ${max_wait_secs}s for provider Deployment with label: \"${deployment_label}\" to exist in namespace: \"${NAMESPACE}\"..."

while true; do
current_time=$(date +%s)
Expand Down Expand Up @@ -111,6 +111,8 @@ do

wait_for_deploy_exist "$LABEL_KEY=$label_value"

echo "Verifying Deployment(s) with ${LABEL_KEY}=${label_value} label is condition=available..."

${KUBECTL} wait --for condition=available --timeout=10m deploy -l ${LABEL_KEY}=${label_value} -n ${NAMESPACE}
if [[ $? -ne 0 ]]; then
echo "Error: Timed out waiting for available Deployment with ${LABEL_KEY}=${label_value} label"
Expand All @@ -136,7 +138,7 @@ do
exit 1
fi

if [[ $image == "docker.io/hmc/controller:latest" ]]; then
if [[ $image == "localhost/hmc/controller:latest" ]]; then
# Don't try to pull and package the local controller image.
continue
fi
Expand Down Expand Up @@ -185,6 +187,18 @@ do
fi

# Use 'helm template' to get the images used by the extension.
template_output=${HELM} template --repo ${url} --version ${version} ${name} --values ${name}-values.yaml
if [[ $? -ne 0 ]]; then
echo "Error: Failed to get images from Helm template for ${name}, trying to output values with debug..."

template_output=${HELM} template --repo ${url} --version ${version} ${name} --values ${name}-values.yaml --debug
if [[ $? -ne 0 ]]; then
echo "Error: Failed to get images from Helm template for ${name} with debug output"
exit 1
fi
fi


for image in $(${HELM} template --repo ${url} --version ${version} ${name} --values ${name}-values.yaml | $YQ -N e .spec.template.spec.containers[].image);
do
docker pull ${image}
Expand Down

0 comments on commit cdc71f1

Please sign in to comment.