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

ark version changes #1124

Merged
merged 3 commits into from
Dec 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ about: Tell us about a problem you are experiencing

**Environment:**

- Ark version (use `ark version`):
- Ark version (use `ark version`):
- Kubernetes version (use `kubectl version`):
- Kubernetes installer & version:
- Cloud provider or hardware configuration:
Expand Down
4 changes: 1 addition & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ builds:
- goos: windows
goarch: arm64
ldflags:
- -X "github.com/heptio/ark/pkg/buildinfo.Version={{ .Tag }}" -X "github.com/heptio/ark/pkg/buildinfo.GitSHA={{ .Env.GIT_SHA }}" -X "github.com/heptio/ark/pkg/buildinfo.GitTreeState={{ .Env.GIT_TREE_STATE }}"
- -X "github.com/heptio/ark/pkg/buildinfo.Version={{ .Tag }}" -X "github.com/heptio/ark/pkg/buildinfo.GitSHA={{ .FullCommit }}" -X "github.com/heptio/ark/pkg/buildinfo.GitTreeState={{ .Env.GIT_TREE_STATE }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line still has GitTreeState?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're still showing it, just not as a separate line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, I saw the removal of it below but didn't pay attention that it was from the bug command file.

archive:
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
files:
- LICENSE
- config/**/*
checksum:
name_template: 'CHECKSUM'
snapshot:
name_template: "{{ .Env.GIT_SHA }}"
release:
github:
owner: heptio
Expand Down
1 change: 1 addition & 0 deletions changelogs/unreleased/1124-skriss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'ark version': show full git SHA & combine git tree state indicator with git SHA line
2 changes: 1 addition & 1 deletion hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fi

export CGO_ENABLED=0

GIT_SHA=$(git describe --tags --always)
GIT_SHA=$(git rev-parse HEAD)
GIT_DIRTY=$(git status --porcelain 2> /dev/null)
if [[ -z "${GIT_DIRTY}" ]]; then
GIT_TREE_STATE=clean
Expand Down
2 changes: 0 additions & 2 deletions hack/goreleaser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ if [ -z "${RELEASE_NOTES_FILE}" ]; then
exit 1
fi

export GIT_SHA=$(git describe --tags --always)

GIT_DIRTY=$(git status --porcelain 2> /dev/null)
if [[ -z "${GIT_DIRTY}" ]]; then
export GIT_TREE_STATE=clean
Expand Down
13 changes: 7 additions & 6 deletions hack/set-example-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ set -o nounset
set -o errexit
set -o pipefail

GIT_TAG=$(git describe --tags --always)

# this script copies all of the files under examples/ into a new directory,
# config/ (which is gitignored so it doesn't result in the git
# state being dirty, which would prevent goreleaser from running), and then
# updates all of the image tags in those files to use $GIT_SHA (which will
# be the release/tag name).
# config/ (which is gitignored so it doesn't result in the git state being
# dirty, which would prevent goreleaser from running), and then updates all
# of the image tags in those files to use $GIT_TAG.

rm -rf config/ && cp -r examples/ config/

# the "-i'.bak'" flag to sed is necessary, with no space between the flag
# and the value, for this to be compatible across BSD/OSX sed and GNU sed.
# remove the ".bak" files afterwards (they're copies of the originals).
find config/ -type f -name "*.yaml" | xargs sed -i'.bak' "s|gcr.io/heptio-images/ark:latest|gcr.io/heptio-images/ark:$GIT_SHA|g"
find config/ -type f -name "*.yaml" | xargs sed -i'.bak' "s|gcr.io/heptio-images/ark:latest|gcr.io/heptio-images/ark:$GIT_TAG|g"
find config/ -type f -name "*.bak" | xargs rm

find config/ -type f -name "*.yaml" | xargs sed -i'.bak' "s|gcr.io/heptio-images/fsfreeze-pause:latest|gcr.io/heptio-images/fsfreeze-pause:$GIT_SHA|g"
find config/ -type f -name "*.yaml" | xargs sed -i'.bak' "s|gcr.io/heptio-images/fsfreeze-pause:latest|gcr.io/heptio-images/fsfreeze-pause:$GIT_TAG|g"
find config/ -type f -name "*.bak" | xargs rm
6 changes: 2 additions & 4 deletions pkg/cmd/cli/bug/bug.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ about: Tell us about a problem you are experiencing

**Environment:**

- Ark version (use ` + "`ark version`" + `):{{.ArkVersion}} {{.GitCommit}} {{.GitTreeState}}
- Ark version (use ` + "`ark version`" + `):{{.ArkVersion}} {{.GitCommit}}
- Kubernetes version (use ` + "`kubectl version`" + `):
{{- if .KubectlVersion}}
` + "```" + `
Expand Down Expand Up @@ -109,7 +109,6 @@ func NewCommand() *cobra.Command {
type ArkBugInfo struct {
ArkVersion string
GitCommit string
GitTreeState string
RuntimeOS string
RuntimeArch string
KubectlVersion string
Expand Down Expand Up @@ -162,8 +161,7 @@ func getKubectlVersion() (string, error) {
func newBugInfo(kubectlVersion string) *ArkBugInfo {
return &ArkBugInfo{
ArkVersion: buildinfo.Version,
GitCommit: buildinfo.GitSHA,
GitTreeState: buildinfo.GitTreeState,
GitCommit: buildinfo.FormattedGitSHA(),
RuntimeOS: runtime.GOOS,
RuntimeArch: runtime.GOARCH,
KubectlVersion: kubectlVersion}
Expand Down
3 changes: 1 addition & 2 deletions pkg/cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ func NewCommand() *cobra.Command {
Short: "Print the ark version and associated image",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Version: %s\n", buildinfo.Version)
fmt.Printf("Git commit: %s\n", buildinfo.GitSHA)
fmt.Printf("Git tree state: %s\n", buildinfo.GitTreeState)
fmt.Printf("Git commit: %s\n", buildinfo.FormattedGitSHA())
},
}

Expand Down