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
Unverified Commit d9dd54be authored by Ash McKenzie's avatar Ash McKenzie
Browse files

Ensure all binaries respond to -version

parent 17beda32
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -12,7 +12,21 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/v14/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("check %s-%s\n", Version, BuildTime)
os.Exit(0)
}
readWriter := &readwriter.ReadWriter{
Out: os.Stdout,
In: os.Stdin,
Loading
Loading
Loading
Loading
@@ -13,7 +13,21 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/v14/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
Loading
Loading
@@ -13,7 +13,21 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/v14/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
Loading
Loading
@@ -3,6 +3,7 @@ package main
import (
"context"
"flag"
"fmt"
"os"
"os/signal"
"syscall"
Loading
Loading
@@ -19,11 +20,12 @@ import (
var (
configDir = flag.String("config-dir", "", "The directory the config is in")
version = flag.Bool("version", false, "Prints current version")
// BuildTime signifies the time the binary was build.
BuildTime = "2021-02-16T09:28:07+01:00" // Set at build time in the Makefile
// Version is the current version of GitLab Shell sshd.
// 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 overrideConfigFromEnvironment(cfg *config.Config) {
Loading
Loading
@@ -44,6 +46,12 @@ func overrideConfigFromEnvironment(cfg *config.Config) {
func main() {
flag.Parse()
if *version {
fmt.Printf("gitlab-sshd %s-%s\n", Version, BuildTime)
os.Exit(0)
}
cfg := new(config.Config)
if *configDir != "" {
var err error
Loading
Loading
@@ -52,6 +60,7 @@ func main() {
log.WithError(err).Fatal("failed to load configuration from specified directory")
}
}
overrideConfigFromEnvironment(cfg)
if err := cfg.IsSane(); err != nil {
if *configDir == "" {
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