Previously we would run `go mod vendor` before `go mod tidy`, meaning
that we were snapshotting dependencies before we were really finished
updating them.
Since Cluster Autoscaler versioning should be in sync with Kubernetes,
update-vendor.sh can simply set the version after a successful
dependency update.
Use shell syntax instead of pipe so error messages are printed out. Before
this change, if it could not download a module, it would just exit without
printing an error message due to the pipe. With this change it now prints
out the error message(unable to download) from the underlying process.
The update-vendor.sh script needed some fixes to work with zsh on OSX.
Various binaries are expected to be GNU utils, which are not installed
by default on OSX. I've added suggestions to install ported binaries
using homebrew if they are not found in PATH.
Skip `shopt -s lastpipe` when `$BASH` is not defined.
The `git restore` command was introduced in Git version 2.23.0, which
was released in August 2019. Even late Linux distributions do not
include this modern of a Git binary. For example, Ubuntu 19.10 as of Nov
26, 2019 only includes Git 2.20.1.
In order to run hack/update-vendor.sh on machines with Git <2.23.0, I've
modified the script to use `git reset .` instead of `git restore
--staged`.
Issue #2560
Running this script as-is fails as `git ci` is not a recognised
command. Fixed by referencing `git commit` explicitly; I guess it
works as it may be aliased.