From 94a1f3c41f997d4155a1edab647669051d19fb07 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Thu, 11 Jan 2018 10:01:58 -0800 Subject: [PATCH 1/3] Lint all code for golint tests --- cmd/common.go | 2 +- cmd/database.go | 2 +- cmd/root.go | 4 ++-- cmd/util.go | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/common.go b/cmd/common.go index c552f86..608195c 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -107,7 +107,7 @@ func runChecks(t check.NodeType) { fmt.Println(string(out)) } else { // if we want to store in PostgreSQL, convert to JSON and save it - if (summary.Fail > 0 || summary.Warn > 0 || summary.Pass > 0) && pgSql { + if (summary.Fail > 0 || summary.Warn > 0 || summary.Pass > 0) && pgSQL { out, err := controls.JSON() if err != nil { exitWithError(fmt.Errorf("failed to output in JSON format: %v", err)) diff --git a/cmd/database.go b/cmd/database.go index 46668ae..dbbbb94 100644 --- a/cmd/database.go +++ b/cmd/database.go @@ -7,7 +7,7 @@ import ( "github.com/golang/glog" "github.com/jinzhu/gorm" - _ "github.com/jinzhu/gorm/dialects/postgres" + _ "github.com/jinzhu/gorm/dialects/postgres" // database packages get blank imports "github.com/spf13/viper" ) diff --git a/cmd/root.go b/cmd/root.go index 3c80f5d..76d871a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -30,7 +30,7 @@ var ( defaultKubeVersion = "1.6" cfgFile string jsonFmt bool - pgSql bool + pgSQL bool checkList string groupList string masterFile string @@ -61,7 +61,7 @@ func init() { cobra.OnInitialize(initConfig) RootCmd.PersistentFlags().BoolVar(&jsonFmt, "json", false, "Prints the results as JSON") - RootCmd.PersistentFlags().BoolVar(&pgSql, "pgsql", false, "Save the results to PostgreSQL") + RootCmd.PersistentFlags().BoolVar(&pgSQL, "pgsql", false, "Save the results to PostgreSQL") RootCmd.PersistentFlags().StringVarP( &checkList, "check", diff --git a/cmd/util.go b/cmd/util.go index f2c6b29..d1c14fd 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -196,9 +196,8 @@ func findExecutable(candidates []string) (string, error) { for _, c := range candidates { if verifyBin(c) { return c, nil - } else { - glog.V(1).Info(fmt.Sprintf("executable '%s' not running", c)) } + glog.V(1).Info(fmt.Sprintf("executable '%s' not running", c)) } return "", fmt.Errorf("no candidates running") From c389d6ecf2cf601d145f1824d554b2ada5ca1855 Mon Sep 17 00:00:00 2001 From: Liz Rice Date: Tue, 30 Jan 2018 16:56:23 +0000 Subject: [PATCH 2/3] Fix build Copy the cfg files and entrypoint.sh from the first stage of the multistage build --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 115f429..10f1676 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,8 @@ RUN go get github.com/aquasecurity/kube-bench FROM alpine:latest WORKDIR / COPY --from=0 /go/bin/kube-bench /kube-bench -COPY cfg cfg -COPY entrypoint.sh /entrypoint.sh +COPY --from=0 /go/src/github.com/aquasecurity/kube-bench/cfg /cfg +COPY --from=0 /go/src/github.com/aquasecurity/kube-bench/entrypoint.sh /entrypoint.sh ENTRYPOINT /entrypoint.sh # Build-time metadata as defined at http://label-schema.org From fe23f8140a73018e29866fee4f76d3cc1871a603 Mon Sep 17 00:00:00 2001 From: Lee Briggs Date: Tue, 30 Jan 2018 11:16:53 -0800 Subject: [PATCH 3/3] Remove docker build --- .goreleaser.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 61aa356..7cb5822 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,11 +9,6 @@ builds: # Archive customization archive: format: tar.gz -dockers: - - - binary: kube-bench - image: aquasec/kube-bench - latest: true fpm: vendor: Aqua Security description: "The Kubernetes Bench for Security is a Go application that checks whether Kubernetes is deployed according to security best practices"