Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan plugin #528

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions plugins/scan.installer
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

set -e

source "$(dirname "$0")/.common"
PKG=github.com/docker/scan-cli-plugin
GOPATH=$(go env GOPATH)
REPO=https://${PKG}.git
COMMIT=v0.7.0
DEST=${GOPATH}/src/${PKG}

build() {
if [ ! -d "${DEST}" ]; then
git clone "${REPO}" "${DEST}"
fi
(
cd "${DEST}"
git fetch --all
git checkout -q "${COMMIT}"
# TODO remove GOPROXY override once we updated to Go 1.14+
# Using goproxy instead of "direct" to work around an issue in go mod
# on Go 1.13 not working with older git versions (default version on
# CentOS 7 is git 1.8), see https://github.com/golang/go/issues/38373
GOPROXY="https://proxy.golang.org" PLATFORM_BINARY=docker-scan make native-build
)
}

install_plugin() {
(
cd "${DEST}"
install_binary bin/docker-scan
)
}

case "$(uname -i)" in
aarch64)
echo "Skipping scan plugin on ARM arch";;
arm*)
echo "Skipping scan plugin on ARM arch";;
*)
build_or_install "$@";;
esac