Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
Version (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
genevieveluyt authored Apr 22, 2021
1 parent 5212a75 commit 634a047
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- "1.13.x"
- "1.16.x"

services:
- docker
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions VERSION
1 change: 1 addition & 0 deletions cmd/commands/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.14.0
24 changes: 24 additions & 0 deletions cmd/commands/version.go
Original file line number Diff line number Diff line change
@@ -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)
}
12 changes: 7 additions & 5 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <VERSION> -m "<VERSION>"
Expand All @@ -22,19 +24,19 @@ 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.

```
GITHUB_TOKEN=<YOUR 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.

Expand All @@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ require (
k8s.io/client-go v0.19.1
)

go 1.13
go 1.16

0 comments on commit 634a047

Please sign in to comment.