From a490569ede625922aa9882128611a82a19b93eb6 Mon Sep 17 00:00:00 2001 From: Zoran Regvart Date: Thu, 2 May 2024 12:45:53 +0200 Subject: [PATCH] Double quote variables This is to to prevent globs and multiple shell words being interpreted where one is expected. --- hack/build-and-push.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hack/build-and-push.sh b/hack/build-and-push.sh index 44579f6e18..4f9e75bd39 100755 --- a/hack/build-and-push.sh +++ b/hack/build-and-push.sh @@ -94,14 +94,14 @@ find task/*/*/ -maxdepth 0 -type d | awk -F '/' '{ print $0, $2, $3 }' | \ while read -r task_dir task_name task_version do prepared_task_file="${WORKDIR}/$task_name-${task_version}.yaml" - if [ -f $task_dir/$task_name.yaml ]; then - cp $task_dir/$task_name.yaml $prepared_task_file - task_file_sha=$(git log -n 1 --pretty=format:%H -- $task_dir/$task_name.yaml) - elif [ -f $task_dir/kustomization.yaml ]; then - oc kustomize $task_dir > $prepared_task_file - task_file_sha=$(sha256sum $prepared_task_file | awk '{print $1}') + if [ -f "$task_dir/$task_name.yaml" ]; then + cp "$task_dir/$task_name.yaml" "$prepared_task_file" + task_file_sha=$(git log -n 1 --pretty=format:%H -- "$task_dir/$task_name.yaml") + elif [ -f "$task_dir/kustomization.yaml" ]; then + oc kustomize "$task_dir" > "$prepared_task_file" + task_file_sha=$(sha256sum "$prepared_task_file" | awk '{print $1}') else - echo Unknown task in $task_dir + echo Unknown task in "$task_dir" continue fi repository=${TEST_REPO_NAME:-task-${task_name}}