Skip to content
Snippets Groups Projects
Unverified Commit ec9779f5 authored by Liz Rice's avatar Liz Rice Committed by GitHub
Browse files

Merge pull request #313 from simar7/add-kube-bench-version

kube-bench: add version subcommand
parents 1d7449db 3b7438e2
No related branches found
No related tags found
No related merge requests found
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
var KubeBenchVersion string
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Shows the version of kube-bench.",
Long: `Shows the version of kube-bench.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(KubeBenchVersion)
},
}
func init() {
RootCmd.AddCommand(versionCmd)
}
......@@ -2,6 +2,7 @@ SOURCES := $(shell find . -name '*.go')
BINARY := kube-bench
DOCKER_REGISTRY ?= aquasec
VERSION ?= $(shell git rev-parse --short=7 HEAD)
KUBEBENCH_VERSION ?= $(shell git describe --tags --abbrev=0)
IMAGE_NAME ?= $(DOCKER_REGISTRY)/$(BINARY):$(VERSION)
TARGET_OS := linux
BUILD_OS := linux
......@@ -22,7 +23,7 @@ KIND_CONTAINER_NAME=$(KIND_PROFILE)-control-plane
build: kube-bench
$(BINARY): $(SOURCES)
GOOS=$(TARGET_OS) go build -o $(BINARY) .
GOOS=$(TARGET_OS) go build -ldflags "-X github.com/aquasecurity/kube-bench/cmd.KubeBenchVersion=$(KUBEBENCH_VERSION)" -o $(BINARY) .
# builds the current dev docker version
build-docker:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment