packer/scripts/upgrade_plugins.sh
Adrien Delorme 27d89ac8d4
update all plugins + pin go to go 1.17 (#11237)
* up plugins and get rid of a dependency loop from packer to packer
2021-09-02 12:15:13 +02:00

68 lines
1.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=(
"alicloud"
"amazon"
"ansible"
"azure"
"chef"
"cloudstack"
"converge"
"digitalocean"
"docker"
"googlecompute"
"hcloud"
"hyperone"
"hyperv"
"jdcloud"
"linode"
"lxc"
"lxd"
"ncloud"
"openstack"
"oracle"
"outscale"
"oneandone"
"parallels"
"profitbricks"
"proxmox"
"puppet"
"qemu"
"scaleway"
"sdk"
"tencentcloud"
"triton"
"ucloud"
"vagrant"
"virtualbox"
"vmware"
"vsphere"
"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/hashicorp/packer-plugin-$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