packer/scripts/upgrade_plugins.sh
Wilken Rivera d7dca51108
Update Packer to use Go 1.18 (#11927)
This change updates Packer core Go version to 1.18. The move to Go 1.18 and not Go 1.19
is to allow the HCP Packer SDK time to upgrade to Go 1.18.

Changes Made:
* Bump go mod file to use Go 1.18
* Bump release pipeline to use Go 1.18
* Update plugin updater script to run go mod tidy for Go 1.18
* Update Linux job to use setup-go action
2022-08-18 09:41:29 -04:00

66 lines
2 KiB
Bash
Executable file

#!/bin/zsh
## This script is to be run before a Packer release in order to update
## all vendored plugins to the latest available release.
## The SDK is included in the plugin list and will be upgraded as well if a
## newest version is available.
## This script should be run in packer's root.
declare -a plugins=(
"hashicorp/packer-plugin-alicloud"
"hashicorp/packer-plugin-amazon"
"hashicorp/packer-plugin-ansible"
"hashicorp/packer-plugin-azure"
"hashicorp/packer-plugin-chef"
"hashicorp/packer-plugin-cloudstack"
"hashicorp/packer-plugin-converge"
"digitalocean/packer-plugin-digitalocean"
"hashicorp/packer-plugin-docker"
"hashicorp/packer-plugin-googlecompute"
"hashicorp/packer-plugin-hcloud"
"hashicorp/packer-plugin-hyperone"
"hashicorp/packer-plugin-hyperv"
"hashicorp/packer-plugin-jdcloud"
"hashicorp/packer-plugin-linode"
"hashicorp/packer-plugin-lxc"
"hashicorp/packer-plugin-lxd"
"hashicorp/packer-plugin-ncloud"
"hashicorp/packer-plugin-openstack"
"hashicorp/packer-plugin-oracle"
"hashicorp/packer-plugin-oneandone"
"hashicorp/packer-plugin-parallels"
"hashicorp/packer-plugin-profitbricks"
"hashicorp/packer-plugin-proxmox"
"hashicorp/packer-plugin-puppet"
"hashicorp/packer-plugin-qemu"
"hashicorp/packer-plugin-sdk"
"hashicorp/packer-plugin-tencentcloud"
"hashicorp/packer-plugin-triton"
"hashicorp/packer-plugin-ucloud"
"hashicorp/packer-plugin-vagrant"
"hashicorp/packer-plugin-virtualbox"
"hashicorp/packer-plugin-vmware"
"hashicorp/packer-plugin-vsphere"
"hashicorp/packer-plugin-yandex"
)
## now loop through the above plugin array
## update the plugins and the SDK to the latest available version
for i in "${plugins[@]}"
do
happy=false
while ! $happy
do
echo "upgrading $i"
output=$(go get -d github.com/$i)
happy=true
if [[ $output == *"443: Connection refused"* ]]; then
echo "Try again after 5 seconds"
sleep 5
happy=false
fi
done
sleep 1
done
go mod tidy -compat=1.18