goshorly/utils/build-vars.go

41 lines
736 B
Go
Raw 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() {
if CI_COMMIT_SHORT_SHA == "" && CI_COMMIT_BRANCH == "" {
CI_BUILD = false
2021-12-08 10:04:28 +00:00
} else {
CI_BUILD = true
}
if CI_COMMIT_TAG == "" {
CI_TAGGED = false
} else {
CI_TAGGED = true
2021-12-08 10:04:28 +00:00
}
}
2022-01-25 16:25:23 +00:00
func Print_Starting_Screen() {
if CI_BUILD {
if CI_TAGGED {
fmt.Println("---- Starting goshorly " + CI_COMMIT_TAG + " ----")
} else {
fmt.Println("---- Starting goshorly " + CI_COMMIT_SHORT_SHA + " ----")
}
} else {
fmt.Println("---- Starting goshorly " + "unknown version" + " ----")
}
time.Sleep(1 * time.Second)
}