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

YQ-2811: prepare version for Arcadia #34

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
22 changes: 17 additions & 5 deletions app/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

var (
HasInfo string
InfoSource string
Tag string
Author string
CommitHash string
Expand All @@ -27,15 +27,18 @@ var Cmd = &cobra.Command{
Use: "version",
Short: "version of current build",
Run: func(cmd *cobra.Command, args []string) {
if HasInfo == "true" {
fmt.Println(GetInfo())
} else {
switch InfoSource {
case "git":
fmt.Println(GetGitInfo())
case "arcadia":
fmt.Println(GetArcadiaInfo())
default:
fmt.Println("No information provided")
}
},
}

func GetInfo() string {
func GetGitInfo() string {
sb := strings.Builder{}

sb.WriteString("Git info:\n")
Expand All @@ -58,3 +61,12 @@ func GetInfo() string {

return sb.String()
}

func GetArcadiaInfo() string {
sb := strings.Builder{}

sb.WriteString("Arcadia info:\n")
sb.WriteString(fmt.Sprintf("\tTag: %s\n", Tag))
tsmax2004 marked this conversation as resolved.
Show resolved Hide resolved

return sb.String()
}
2 changes: 1 addition & 1 deletion get_ldflags.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

echo "-X 'github.com/ydb-platform/fq-connector-go/app/version.HasInfo=true' \
echo "-X 'github.com/ydb-platform/fq-connector-go/app/version.InfoSource=git' \
-X 'github.com/ydb-platform/fq-connector-go/app/version.Branch=$(git rev-parse --abbrev-ref HEAD)' \
-X 'github.com/ydb-platform/fq-connector-go/app/version.CommitHash=$(git rev-parse HEAD)' \
-X 'github.com/ydb-platform/fq-connector-go/app/version.Tag=$(git describe --tags)' \
Expand Down