mirror of
https://github.com/containers/podman.git
synced 2025-05-17 15:18:43 +08:00

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>
30 lines
934 B
Bash
Executable File
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
|