Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: Fix a bug in script path, use ${script_dir} consistently #39

Merged
merged 1 commit into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ root_dir="$(git rev-parse --show-toplevel)"

cd "${root_dir}"

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

image_name="${1}"
image_dir="${2}"

Expand All @@ -32,9 +34,9 @@ shift 5
registries=("${@}")

if [ "${with_root_context}" = "false" ] ; then
image_tag="$("${root_dir}/images/scripts/make-image-tag.sh" "${image_dir}")"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has slipped in form #37, as I was testing this script with slightly different directory structure.

image_tag="$("${script_dir}/make-image-tag.sh" "${image_dir}")"
else
image_tag="$("${root_dir}/images/scripts/make-image-tag.sh")"
image_tag="$("${script_dir}/make-image-tag.sh")"
fi

tag_args=()
Expand Down
4 changes: 3 additions & 1 deletion scripts/update-alpine-base-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ root_dir="$(git rev-parse --show-toplevel)"

cd "${root_dir}"

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

image="${1:-alpine:3.11}"

image_digest="$("${root_dir}/scripts/get-image-digest.sh" "${image}")"
image_digest="$("${script_dir}/get-image-digest.sh" "${image}")"

# shellcheck disable=SC2207
used_by=($(git grep -l ALPINE_BASE_IMAGE= images))
Expand Down
6 changes: 4 additions & 2 deletions scripts/update-compilers-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ root_dir="$(git rev-parse --show-toplevel)"

cd "${root_dir}"

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

image_name="${1}/image-compilers"

image_tag="$(WITHOUT_SUFFIX=1 "${root_dir}/scripts/make-image-tag.sh" images/compilers)"
image_tag="$(WITHOUT_SUFFIX=1 "${script_dir}/make-image-tag.sh" images/compilers)"

image_digest="$("${root_dir}/scripts/get-image-digest.sh" "${image_name}:${image_tag}")"
image_digest="$("${script_dir}/get-image-digest.sh" "${image_name}:${image_tag}")"

# shellcheck disable=SC2207
used_by=($(git grep -l COMPILERS_IMAGE= images))
Expand Down
6 changes: 4 additions & 2 deletions scripts/update-maker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ root_dir="$(git rev-parse --show-toplevel)"

cd "${root_dir}"

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

image_name="${1}/image-maker"

image_tag="$(WITHOUT_SUFFIX=1 "${root_dir}/scripts/make-image-tag.sh" images/maker)"
image_tag="$(WITHOUT_SUFFIX=1 "${script_dir}/make-image-tag.sh" images/maker)"

# shellcheck disable=SC2207
used_by_workflows=($(git grep -l "docker://${image_name}:" .github/workflows))
Expand All @@ -29,7 +31,7 @@ for i in "${used_by_workflows[@]}" ; do
done

# shellcheck disable=SC2207
used_by_scripts=($(git grep -l "MAKER_IMAGE=\"\${MAKER_IMAGE:-${image_name}:" scripts))
used_by_scripts=($(git grep -l "MAKER_IMAGE=\"\${MAKER_IMAGE:-${image_name}:" "${script_dir}"))

for i in "${used_by_scripts[@]}" ; do
sed "s|\(MAKER_IMAGE=\"\${MAKER_IMAGE:-${image_name}\):.*\(}\"\)\$|\1:${image_tag}\2|" "${i}" > "${i}.sedtmp" && mv "${i}.sedtmp" "${i}" && chmod +x "${i}"
Expand Down