As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 6da1094b authored by Ash McKenzie's avatar Ash McKenzie
Browse files

Merge branch 'sh-add-version-arg' into 'master'

Add support for -version argument

See merge request gitlab-org/gitlab-shell!421
parents 890bda90 89a23f19
No related branches found
No related tags found
No related merge requests found
.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang coverage coverage_golang setup _install build compile check clean
GO_SOURCES := $(shell find . -name '*.go')
VERSION_STRING := $(shell git describe --match v* 2>/dev/null || awk '$0="v"$0' VERSION 2>/dev/null || echo unknown)
BUILD_TIME := $(shell date -u +%Y%m%d.%H%M%S)
GOBUILD_FLAGS := -ldflags "-X main.Version=$(VERSION_STRING) -X main.BuildTime=$(BUILD_TIME)"
validate: verify test
Loading
Loading
@@ -37,7 +40,7 @@ _install:
build: bin/gitlab-shell
compile: bin/gitlab-shell
bin/gitlab-shell: $(GO_SOURCES)
GOBIN="$(CURDIR)/bin" go install ./cmd/...
GOBIN="$(CURDIR)/bin" go install $(GOBUILD_FLAGS) ./cmd/...
check:
bin/check
Loading
Loading
Loading
Loading
@@ -12,7 +12,21 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/internal/logger"
)
var (
// Version is the current version of gitlab-shell
Version = "(unknown version)" // Set at build time in the Makefile
// BuildTime signifies the time the binary was build
BuildTime = "19700101.000000" // Set at build time in the Makefile
)
func main() {
// We can't use the flag library because gitlab-shell receives other arguments
// that confuse the parser.
if len(os.Args) == 2 && os.Args[1] == "-version" {
fmt.Printf("gitlab-shell %s-%s\n", Version, BuildTime)
os.Exit(0)
}
readWriter := &readwriter.ReadWriter{
Out: os.Stdout,
In: os.Stdin,
Loading
Loading
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