Files
podman/hack/install_golangci.sh
Chris Evich bb2b47dc70 Add swagger install + allow version updates in CI
Support swagger testing and optional runtime updates similar to
the current golangci-lint tool.  This allows developers to update the
version of swagger at runtime if needed.  Otherwise new CI VM images
will pick up the prescribed version at image build-time via
`make install.tools`.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-10-14 08:18:52 -04:00

30 lines
934 B
Bash
Executable File

#!/usr/bin/env bash
# This script is intended to be a convenience, to be called from the
# Makefile `.install.golangci-lint` target. Any other usage is not recommended.
die() { echo "${1:-No error message given} (from $(basename $0))"; exit 1; }
[ -n "$VERSION" ] || die "\$VERSION is empty or undefined"
function install() {
echo "Installing golangci-lint v$VERSION into $BIN"
curl -sSL --retry 5 https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v$VERSION
}
# Undocumented behavior: golangci-lint installer requires $BINDIR in env,
# will default to ./bin but we can't rely on that.
export BINDIR="./bin"
BIN="$BINDIR/golangci-lint"
if [ ! -x "$BIN" ]; then
install
else
# Prints its own file name as part of --version output
$BIN --version | grep "$VERSION"
if [ $? -eq 0 ]; then
echo "Using existing $BINDIR/$($BIN --version)"
else
install
fi
fi