goshorly/utils/build-vars.go

31 lines
563 B
Go
Raw Permalink Normal View History

2021-12-08 10:04:28 +00:00
package utils
2022-01-25 16:25:23 +00:00
import (
"fmt"
"time"
)
2021-12-08 10:04:28 +00:00
var (
CI_COMMIT_SHORT_SHA string
CI_COMMIT_BRANCH string
CI_COMMIT_TAG string
CI_TAGGED bool
CI_BUILD bool
2021-12-08 10:04:28 +00:00
)
func Init_build_vars() {
2023-04-05 20:29:43 +00:00
CI_BUILD = CI_COMMIT_SHORT_SHA != "" || CI_COMMIT_BRANCH != ""
CI_TAGGED = CI_COMMIT_TAG != ""
2021-12-08 10:04:28 +00:00
}
2022-01-25 16:25:23 +00:00
func Print_Starting_Screen() {
2023-04-05 20:29:43 +00:00
version := "unknown version"
if CI_TAGGED {
version = CI_COMMIT_TAG
} else if CI_BUILD {
version = CI_COMMIT_SHORT_SHA
2022-01-25 16:25:23 +00:00
}
2023-04-05 20:29:43 +00:00
fmt.Println("---- Starting goshorly " + version + " ----")
2022-01-25 16:25:23 +00:00
time.Sleep(1 * time.Second)
}