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

pin packer version to 1.9.5 #1383

Merged
merged 1 commit into from
Jun 7, 2024
Merged
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
22 changes: 21 additions & 1 deletion images/capi/hack/ensure-packer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,28 @@ source hack/utils.sh
# invoked, so we are timeboxing it to 10 seconds. This shouldn't be the
# case with Packer installed from Hashicorp releases, which should give
# us a version number. This helps us distinguish the two Packer executables.
if (command -v packer && timeout 10 packer version) >/dev/null 2>&1; then exit 0; fi

if (command -v packer) >/dev/null 2>&1; then
echo "Packer is already installed, checking version..."
# if it's not the hashicorp packer, return "unexpected packer found"
if !(timeout 10 packer version) >/dev/null 2>&1; then
echo "unexpected packer found";
echo "downloading hashicorp packer version v1.9.5"
fi
existing_packer_version=$(packer version | head -1 | cut -d 'v' -f 2; exit 0)
echo "existing packer version: $existing_packer_version"
if [ "$existing_packer_version" != "$_version" ]; then
echo "unsupported packer version ($existing_packer_version) found"
echo "current packer version: $existing_packer_version is not supported"
echo "Downgrading packer to ${_version}"
else
echo "Packer version is as expected"
echo "Packer version $existing_packer_version is already installed"
exit 0
fi
drew-viles marked this conversation as resolved.
Show resolved Hide resolved
fi

echo "Installing packer v${_version} in .local/bin"
mkdir -p .local/bin && cd .local/bin

SED="sed"
Expand Down