diff --git a/.travis.yml b/.travis.yml index 0cf7a926..41071db9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - "1.13.x" + - "1.16.x" services: - docker diff --git a/Makefile b/Makefile index fdb8fb58..ae7c72cc 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ LDFLAGS=$(shell build/ldflags.sh) # kubernetes client won't build with go<1.10 GOVERSION:=$(shell go version | awk '{print $$3}') -GOVERSION_MIN:=go1.12 +GOVERSION_MIN:=go1.16 GOVERSION_CHECK=$(shell printf "%s\n%s\n" "$(GOVERSION)" "$(GOVERSION_MIN)" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | head -n 1) # Test parameters diff --git a/README.md b/README.md index cf8129fd..0334bf56 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,7 @@ For all the ways kubeaudit can be customized, see [Global Flags](#global-flags). | :-------- | :------------------------------------------------------------------------ | :---------------------- | | `all` | Runs all available auditors, or those specified using a kubeaudit config. | [docs](docs/all.md) | | `autofix` | Automatically fixes security issues. | [docs](docs/autofix.md) | +| `version` | Prints the current kubeaudit version. | | ### Auditors diff --git a/VERSION b/VERSION new file mode 120000 index 00000000..b13e7fec --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +cmd/commands/VERSION \ No newline at end of file diff --git a/cmd/commands/VERSION b/cmd/commands/VERSION new file mode 100644 index 00000000..850e7424 --- /dev/null +++ b/cmd/commands/VERSION @@ -0,0 +1 @@ +1.14.0 diff --git a/cmd/commands/version.go b/cmd/commands/version.go new file mode 100644 index 00000000..e2eea971 --- /dev/null +++ b/cmd/commands/version.go @@ -0,0 +1,24 @@ +package commands + +import ( + _ "embed" + "fmt" + "strings" + + "github.com/spf13/cobra" +) + +//go:embed VERSION +var version string + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Prints the current kubeaudit version", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println(strings.TrimSpace(version)) + }, +} + +func init() { + RootCmd.AddCommand(versionCmd) +} diff --git a/docs/release.md b/docs/release.md index 83bd98a9..15aee04b 100644 --- a/docs/release.md +++ b/docs/release.md @@ -8,7 +8,9 @@ If the changes since the most recent release are bug fixes only, bump the last number (the patch version). If any of the changes since the last release include a new feature or breaking change, bump the second number (the minor version) and set the last number to 0 (the patch version). For example, if the latest release is `v0.11.5` and there were only bug fixes merged to master since then, the next version number will be `v0.11.6`. If there were new features added or a breaking change was made, the next version would be `v0.12.0`. -3. Create a tag with the new version and push it up to Github: +3. Update the `VERSION` file if necessary. You'll have to open / merge a PR to do this. + +4. Create a tag with the new version and push it up to Github: ``` git tag -a -m "" @@ -22,11 +24,11 @@ git tag -a v0.11.6 -m "v0.11.6" git push origin v0.11.6 ``` -4. You will need a Github token in order for Goreleaser to be able to create a release in Github. If you already have one, skip to the next step. +5. You will need a Github token in order for Goreleaser to be able to create a release in Github. If you already have one, skip to the next step. [Create a Github token](https://github.com/settings/tokens/new) with the `repo` scope. -5. Run Goreleaser +6. Run Goreleaser Make sure you have Docker running. @@ -34,7 +36,7 @@ Make sure you have Docker running. GITHUB_TOKEN= goreleaser --rm-dist ``` -6. Publish the release in Github +7. Publish the release in Github Goreleaser is set to draft mode which means it will create a draft release in Github, allowing you to double check the release and make changes to the Changelog. Find the [draft release](https://github.com/Shopify/kubeaudit/releases) and make sure there are no commits to master since the release. @@ -48,7 +50,7 @@ Click `Edit` on the right of the draft release and tidy up the Changelog if nece Click on `Publish release` at the bottom. -7. Publish Docker images +8. Publish Docker images Since Goreleaser is set to draft mode, it will build Docker images but not publish them. You can see the images with `docker images`. diff --git a/go.mod b/go.mod index 3cde5cd8..504c812c 100644 --- a/go.mod +++ b/go.mod @@ -13,4 +13,4 @@ require ( k8s.io/client-go v0.19.1 ) -go 1.13 +go 1.16