10666: Added version number to go sdk and go tools & services
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Wed, 29 Nov 2017 00:55:13 +0000 (21:55 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Wed, 29 Nov 2017 00:55:13 +0000 (21:55 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

16 files changed:
sdk/go/version/version.go [new file with mode: 0644]
services/arv-git-httpd/main.go
services/crunch-dispatch-local/crunch-dispatch-local.go
services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
services/crunch-run/crunchrun.go
services/crunchstat/crunchstat.go
services/health/main.go
services/keep-balance/main.go
services/keep-web/main.go
services/keepproxy/keepproxy.go
services/keepstore/keepstore.go
services/ws/main.go
tools/arv-sync-groups/arv-sync-groups.go
tools/keep-block-check/keep-block-check.go
tools/keep-exercise/keep-exercise.go
tools/keep-rsync/keep-rsync.go

diff --git a/sdk/go/version/version.go b/sdk/go/version/version.go
new file mode 100644 (file)
index 0000000..ef9abe7
--- /dev/null
@@ -0,0 +1,15 @@
+package version
+
+var (
+       // Version will get assigned the release number at compile time
+       Version string
+)
+
+// GetVersion returns the release number if it was assigned by the compiler
+// or "dev" otherwise.
+func GetVersion() string {
+       if Version != "" {
+               return Version
+       }
+       return "dev"
+}
index 79a3eb3f7b85de9667c04fe1b24f2a5217db5772..2750ab9eaf0ab51b8517deba914f8726592ce674 100644 (file)
@@ -7,12 +7,14 @@ package main
 import (
        "encoding/json"
        "flag"
 import (
        "encoding/json"
        "flag"
+       "fmt"
        "log"
        "os"
        "regexp"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/config"
        "log"
        "os"
        "regexp"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/config"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
        "github.com/coreos/go-systemd/daemon"
 )
 
        "github.com/coreos/go-systemd/daemon"
 )
 
@@ -50,6 +52,7 @@ func main() {
 
        cfgPath := flag.String("config", defaultCfgPath, "Configuration file `path`.")
        dumpConfig := flag.Bool("dump-config", false, "write current configuration to stdout and exit (useful for migrating from command line flags to config file)")
 
        cfgPath := flag.String("config", defaultCfgPath, "Configuration file `path`.")
        dumpConfig := flag.Bool("dump-config", false, "write current configuration to stdout and exit (useful for migrating from command line flags to config file)")
+       getVersion := flag.Bool("version", false, "print version information and exit.")
 
        flag.StringVar(&theConfig.ManagementToken, "management-token", theConfig.ManagementToken,
                "Authorization token to be included in all health check requests.")
 
        flag.StringVar(&theConfig.ManagementToken, "management-token", theConfig.ManagementToken,
                "Authorization token to be included in all health check requests.")
@@ -57,6 +60,12 @@ func main() {
        flag.Usage = usage
        flag.Parse()
 
        flag.Usage = usage
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        err := config.LoadFile(theConfig, *cfgPath)
        if err != nil {
                h := os.Getenv("ARVADOS_API_HOST")
        err := config.LoadFile(theConfig, *cfgPath)
        if err != nil {
                h := os.Getenv("ARVADOS_API_HOST")
@@ -84,6 +93,7 @@ func main() {
        if _, err := daemon.SdNotify(false, "READY=1"); err != nil {
                log.Printf("Error notifying init daemon: %v", err)
        }
        if _, err := daemon.SdNotify(false, "READY=1"); err != nil {
                log.Printf("Error notifying init daemon: %v", err)
        }
+       log.Printf("arv-git-httpd %q started", arvadosVersion.GetVersion())
        log.Println("Listening at", srv.Addr)
        log.Println("Repository root", theConfig.RepoRoot)
        if err := srv.Wait(); err != nil {
        log.Println("Listening at", srv.Addr)
        log.Println("Repository root", theConfig.RepoRoot)
        if err := srv.Wait(); err != nil {
index 888a2148c1797aa330167d6ca4b44c6a914e5000..c1d6d562a2c963209be94a590fcd14bc8eea272b 100644 (file)
@@ -9,6 +9,7 @@ package main
 import (
        "context"
        "flag"
 import (
        "context"
        "flag"
+       "fmt"
        "log"
        "os"
        "os/exec"
        "log"
        "os"
        "os/exec"
@@ -20,6 +21,7 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/dispatch"
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/dispatch"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 func main() {
 )
 
 func main() {
@@ -49,9 +51,22 @@ func doMain() error {
                "/usr/bin/crunch-run",
                "Crunch command to run container")
 
                "/usr/bin/crunch-run",
                "Crunch command to run container")
 
+       getVersion := flags.Bool(
+               "version",
+               false,
+               "Print version information and exit.")
+
        // Parse args; omit the first arg which is the command name
        flags.Parse(os.Args[1:])
 
        // Parse args; omit the first arg which is the command name
        flags.Parse(os.Args[1:])
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
+       log.Printf("crunch-dispatch-local %q started", arvadosVersion.GetVersion())
+
        runningCmds = make(map[string]*exec.Cmd)
 
        arv, err := arvadosclient.MakeArvadosClient()
        runningCmds = make(map[string]*exec.Cmd)
 
        arv, err := arvadosclient.MakeArvadosClient()
index 30cbb79dc186de45366d648e2a26e42266ee7de3..e743fa585451b732734e2a3e10ec6d1c60298221 100644 (file)
@@ -23,6 +23,7 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/dispatch"
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/dispatch"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
        "github.com/coreos/go-systemd/daemon"
 )
 
        "github.com/coreos/go-systemd/daemon"
 )
 
@@ -69,10 +70,21 @@ func doMain() error {
                "dump-config",
                false,
                "write current configuration to stdout and exit")
                "dump-config",
                false,
                "write current configuration to stdout and exit")
-
+       getVersion := flags.Bool(
+               "version",
+               false,
+               "Print version information and exit.")
        // Parse args; omit the first arg which is the command name
        flags.Parse(os.Args[1:])
 
        // Parse args; omit the first arg which is the command name
        flags.Parse(os.Args[1:])
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
+       log.Printf("crunch-dispatch-slurm %q started", arvadosVersion.GetVersion())
+
        err := readConfig(&theConfig, *configPath)
        if err != nil {
                return err
        err := readConfig(&theConfig, *configPath)
        if err != nil {
                return err
index 27a548aa61e94c5bb9e555a6737cd5bcdf6b1c9f..28909780b0194b7c5966819c90386df2ca129e64 100644 (file)
@@ -32,6 +32,7 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
        "git.curoverse.com/arvados.git/sdk/go/manifest"
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
        "git.curoverse.com/arvados.git/sdk/go/manifest"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 
        dockertypes "github.com/docker/docker/api/types"
        dockercontainer "github.com/docker/docker/api/types/container"
 
        dockertypes "github.com/docker/docker/api/types"
        dockercontainer "github.com/docker/docker/api/types/container"
@@ -1593,8 +1594,17 @@ func main() {
                `Set networking mode for container.  Corresponds to Docker network mode (--net).
        `)
        memprofile := flag.String("memprofile", "", "write memory profile to `file` after running container")
                `Set networking mode for container.  Corresponds to Docker network mode (--net).
        `)
        memprofile := flag.String("memprofile", "", "write memory profile to `file` after running container")
+       getVersion := flags.Bool("version", false, "Print version information and exit.")
        flag.Parse()
 
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
+       log.Printf("crunch-run %q started", arvadosVersion.GetVersion())
+
        containerId := flag.Arg(0)
 
        if *caCertsPath != "" {
        containerId := flag.Arg(0)
 
        if *caCertsPath != "" {
index cd84770e54e637bd9b195362d7dba7f14ff49601..454a5fc3a4363d24b6f858183da6d404750ea6a1 100644 (file)
@@ -7,6 +7,7 @@ package main
 import (
        "bufio"
        "flag"
 import (
        "bufio"
        "flag"
+       "fmt"
        "io"
        "log"
        "os"
        "io"
        "log"
        "os"
@@ -16,6 +17,7 @@ import (
        "time"
 
        "git.curoverse.com/arvados.git/lib/crunchstat"
        "time"
 
        "git.curoverse.com/arvados.git/lib/crunchstat"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 const MaxLogLine = 1 << 14 // Child stderr lines >16KiB will be split
 )
 
 const MaxLogLine = 1 << 14 // Child stderr lines >16KiB will be split
@@ -36,9 +38,18 @@ func main() {
        flag.IntVar(&signalOnDeadPPID, "signal-on-dead-ppid", signalOnDeadPPID, "Signal to send child if crunchstat's parent process disappears (0 to disable)")
        flag.DurationVar(&ppidCheckInterval, "ppid-check-interval", ppidCheckInterval, "Time between checks for parent process disappearance")
        pollMsec := flag.Int64("poll", 1000, "Reporting interval, in milliseconds")
        flag.IntVar(&signalOnDeadPPID, "signal-on-dead-ppid", signalOnDeadPPID, "Signal to send child if crunchstat's parent process disappears (0 to disable)")
        flag.DurationVar(&ppidCheckInterval, "ppid-check-interval", ppidCheckInterval, "Time between checks for parent process disappearance")
        pollMsec := flag.Int64("poll", 1000, "Reporting interval, in milliseconds")
+       getVersion := flag.Bool("version", false, "Print version information and exit.")
 
        flag.Parse()
 
 
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
+       reporter.Logger.Printf("crunchstat %q started", arvadosVersion.GetVersion())
+
        if reporter.CgroupRoot == "" {
                reporter.Logger.Fatal("error: must provide -cgroup-root")
        } else if signalOnDeadPPID < 0 {
        if reporter.CgroupRoot == "" {
                reporter.Logger.Fatal("error: must provide -cgroup-root")
        } else if signalOnDeadPPID < 0 {
index b6358deefcf8d333971435b2a9ede4021bc68f54..d04b55bc6c1a111b5ad5c1b8418dcddf131fe4e0 100644 (file)
@@ -2,21 +2,33 @@ package main
 
 import (
        "flag"
 
 import (
        "flag"
+       "fmt"
        "net/http"
        "net/http"
+       "os"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/health"
        "git.curoverse.com/arvados.git/sdk/go/httpserver"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/health"
        "git.curoverse.com/arvados.git/sdk/go/httpserver"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
        log "github.com/Sirupsen/logrus"
 )
 
 func main() {
        configFile := flag.String("config", arvados.DefaultConfigFile, "`path` to arvados configuration file")
        log "github.com/Sirupsen/logrus"
 )
 
 func main() {
        configFile := flag.String("config", arvados.DefaultConfigFile, "`path` to arvados configuration file")
+       getVersion := flag.Bool("version", false, "Print version information and exit.")
        flag.Parse()
 
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        log.SetFormatter(&log.JSONFormatter{
                TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00",
        })
        log.SetFormatter(&log.JSONFormatter{
                TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00",
        })
+       log.Printf("arvados health %q started", arvadosVersion.GetVersion())
+
        cfg, err := arvados.GetConfig(*configFile)
        if err != nil {
                log.Fatal(err)
        cfg, err := arvados.GetConfig(*configFile)
        if err != nil {
                log.Fatal(err)
index 8a938ccf5308393311a121835c1eaef631f194ca..fe4a8c41c572932853076a8b0465d5e0bee01049 100644 (file)
@@ -7,6 +7,7 @@ package main
 import (
        "encoding/json"
        "flag"
 import (
        "encoding/json"
        "flag"
+       "fmt"
        "log"
        "os"
        "os/signal"
        "log"
        "os"
        "os/signal"
@@ -15,6 +16,7 @@ import (
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/config"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/config"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 const defaultConfigPath = "/etc/arvados/keep-balance/keep-balance.yml"
 )
 
 const defaultConfigPath = "/etc/arvados/keep-balance/keep-balance.yml"
@@ -85,9 +87,16 @@ func main() {
        dumpConfig := flag.Bool("dump-config", false, "write current configuration to stdout and exit")
        dumpFlag := flag.Bool("dump", false, "dump details for each block to stdout")
        debugFlag := flag.Bool("debug", false, "enable debug messages")
        dumpConfig := flag.Bool("dump-config", false, "write current configuration to stdout and exit")
        dumpFlag := flag.Bool("dump", false, "dump details for each block to stdout")
        debugFlag := flag.Bool("debug", false, "enable debug messages")
+       getVersion := flag.Bool("version", false, "Print version information and exit.")
        flag.Usage = usage
        flag.Parse()
 
        flag.Usage = usage
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        mustReadConfig(&cfg, *configPath)
        if *serviceListPath != "" {
                mustReadConfig(&cfg.KeepServiceList, *serviceListPath)
        mustReadConfig(&cfg, *configPath)
        if *serviceListPath != "" {
                mustReadConfig(&cfg.KeepServiceList, *serviceListPath)
@@ -97,6 +106,8 @@ func main() {
                log.Fatal(config.DumpAndExit(cfg))
        }
 
                log.Fatal(config.DumpAndExit(cfg))
        }
 
+       log.Printf("keep-balance %q started", arvadosVersion.GetVersion())
+
        if *debugFlag {
                debugf = log.Printf
                if j, err := json.Marshal(cfg); err != nil {
        if *debugFlag {
                debugf = log.Printf
                if j, err := json.Marshal(cfg); err != nil {
index 27ceb48c78bfebbc40aa9d3732cbcbba6ad63155..8bd890322e2cae303c508304c33d852038a2557d 100644 (file)
@@ -6,12 +6,14 @@ package main
 
 import (
        "flag"
 
 import (
        "flag"
+       "fmt"
        "log"
        "os"
        "time"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/config"
        "log"
        "os"
        "time"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "git.curoverse.com/arvados.git/sdk/go/config"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
        "github.com/coreos/go-systemd/daemon"
 )
 
        "github.com/coreos/go-systemd/daemon"
 )
 
@@ -85,9 +87,17 @@ func main() {
 
        dumpConfig := flag.Bool("dump-config", false,
                "write current configuration to stdout and exit")
 
        dumpConfig := flag.Bool("dump-config", false,
                "write current configuration to stdout and exit")
+       getVersion := flag.Bool("version", false,
+               "print version information and exit.")
        flag.Usage = usage
        flag.Parse()
 
        flag.Usage = usage
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        if err := config.LoadFile(cfg, configPath); err != nil {
                if h := os.Getenv("ARVADOS_API_HOST"); h != "" && configPath == defaultConfigPath {
                        log.Printf("DEPRECATED: Using ARVADOS_API_HOST environment variable. Use config file instead.")
        if err := config.LoadFile(cfg, configPath); err != nil {
                if h := os.Getenv("ARVADOS_API_HOST"); h != "" && configPath == defaultConfigPath {
                        log.Printf("DEPRECATED: Using ARVADOS_API_HOST environment variable. Use config file instead.")
@@ -105,6 +115,8 @@ func main() {
                log.Fatal(config.DumpAndExit(cfg))
        }
 
                log.Fatal(config.DumpAndExit(cfg))
        }
 
+       log.Printf("keep-web %q started", arvadosVersion.GetVersion())
+
        os.Setenv("ARVADOS_API_HOST", cfg.Client.APIHost)
        srv := &server{Config: cfg}
        if err := srv.Start(); err != nil {
        os.Setenv("ARVADOS_API_HOST", cfg.Client.APIHost)
        srv := &server{Config: cfg}
        if err := srv.Start(); err != nil {
index 3d1b4476255d0cadf2274ad12b9aae78f164f72f..ec074cff3f4a772a39e7a345d3e4307be5a04c7f 100644 (file)
@@ -26,6 +26,7 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/health"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/health"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
        "github.com/coreos/go-systemd/daemon"
        "github.com/ghodss/yaml"
        "github.com/gorilla/mux"
        "github.com/coreos/go-systemd/daemon"
        "github.com/ghodss/yaml"
        "github.com/gorilla/mux"
@@ -74,8 +75,15 @@ func main() {
        const defaultCfgPath = "/etc/arvados/keepproxy/keepproxy.yml"
        flagset.StringVar(&cfgPath, "config", defaultCfgPath, "Configuration file `path`")
        dumpConfig := flagset.Bool("dump-config", false, "write current configuration to stdout and exit")
        const defaultCfgPath = "/etc/arvados/keepproxy/keepproxy.yml"
        flagset.StringVar(&cfgPath, "config", defaultCfgPath, "Configuration file `path`")
        dumpConfig := flagset.Bool("dump-config", false, "write current configuration to stdout and exit")
+       getVersion := flagset.Bool("version", false, "Print version information and exit.")
        flagset.Parse(os.Args[1:])
 
        flagset.Parse(os.Args[1:])
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        err := config.LoadFile(cfg, cfgPath)
        if err != nil {
                h := os.Getenv("ARVADOS_API_HOST")
        err := config.LoadFile(cfg, cfgPath)
        if err != nil {
                h := os.Getenv("ARVADOS_API_HOST")
@@ -99,6 +107,8 @@ func main() {
                log.Fatal(config.DumpAndExit(cfg))
        }
 
                log.Fatal(config.DumpAndExit(cfg))
        }
 
+       log.Printf("keepproxy %q started", arvadosVersion.GetVersion())
+
        arv, err := arvadosclient.New(&cfg.Client)
        if err != nil {
                log.Fatalf("Error setting up arvados client %s", err.Error())
        arv, err := arvadosclient.New(&cfg.Client)
        if err != nil {
                log.Fatalf("Error setting up arvados client %s", err.Error())
index 921176dbbe93f481f497af476f176c2116ef3bce..23af6906bbcf89ec0832e8416a3198096edbef1c 100644 (file)
@@ -18,6 +18,7 @@ import (
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/httpserver"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/httpserver"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
        log "github.com/Sirupsen/logrus"
        "github.com/coreos/go-systemd/daemon"
 )
        log "github.com/Sirupsen/logrus"
        "github.com/coreos/go-systemd/daemon"
 )
@@ -89,6 +90,7 @@ func main() {
        deprecated.beforeFlagParse(theConfig)
 
        dumpConfig := flag.Bool("dump-config", false, "write current configuration to stdout and exit (useful for migrating from command line flags to config file)")
        deprecated.beforeFlagParse(theConfig)
 
        dumpConfig := flag.Bool("dump-config", false, "write current configuration to stdout and exit (useful for migrating from command line flags to config file)")
+       getVersion := flag.Bool("version", false, "Print version information and exit.")
 
        defaultConfigPath := "/etc/arvados/keepstore/keepstore.yml"
        var configPath string
 
        defaultConfigPath := "/etc/arvados/keepstore/keepstore.yml"
        var configPath string
@@ -100,6 +102,12 @@ func main() {
        flag.Usage = usage
        flag.Parse()
 
        flag.Usage = usage
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        deprecated.afterFlagParse(theConfig)
 
        err := config.LoadFile(theConfig, configPath)
        deprecated.afterFlagParse(theConfig)
 
        err := config.LoadFile(theConfig, configPath)
@@ -111,6 +119,8 @@ func main() {
                log.Fatal(config.DumpAndExit(theConfig))
        }
 
                log.Fatal(config.DumpAndExit(theConfig))
        }
 
+       log.Printf("keepstore %q started", arvadosVersion.GetVersion())
+
        err = theConfig.Start()
        if err != nil {
                log.Fatal(err)
        err = theConfig.Start()
        if err != nil {
                log.Fatal(err)
index db33cbfd004173ff787f9767eddd06a448744d63..30d569c98890264aa4a1028085d94764e01a7da4 100644 (file)
@@ -7,9 +7,11 @@ package main
 import (
        "flag"
        "fmt"
 import (
        "flag"
        "fmt"
+       "os"
 
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/ctxlog"
 
        "git.curoverse.com/arvados.git/sdk/go/config"
        "git.curoverse.com/arvados.git/sdk/go/ctxlog"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 var logger = ctxlog.FromContext
 )
 
 var logger = ctxlog.FromContext
@@ -19,9 +21,16 @@ func main() {
 
        configPath := flag.String("config", "/etc/arvados/ws/ws.yml", "`path` to config file")
        dumpConfig := flag.Bool("dump-config", false, "show current configuration and exit")
 
        configPath := flag.String("config", "/etc/arvados/ws/ws.yml", "`path` to config file")
        dumpConfig := flag.Bool("dump-config", false, "show current configuration and exit")
+       getVersion := flag.Bool("version", false, "Print version information and exit.")
        cfg := defaultConfig()
        flag.Parse()
 
        cfg := defaultConfig()
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        err := config.LoadFile(&cfg, *configPath)
        if err != nil {
                log.Fatal(err)
        err := config.LoadFile(&cfg, *configPath)
        if err != nil {
                log.Fatal(err)
@@ -39,6 +48,8 @@ func main() {
                return
        }
 
                return
        }
 
+       log.Printf("arvados-ws %q started", arvadosVersion.GetVersion())
+
        log.Info("started")
        srv := &server{wsConfig: &cfg}
        log.Fatal(srv.Run())
        log.Info("started")
        srv := &server{wsConfig: &cfg}
        log.Fatal(srv.Run())
index d7efdefb6f68a791c1417c05357b5f2636227e84..3530ce56deb54528186afbc5a360b164baea95a7 100644 (file)
@@ -17,6 +17,7 @@ import (
        "strings"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
        "strings"
 
        "git.curoverse.com/arvados.git/sdk/go/arvados"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 type resourceList interface {
 )
 
 type resourceList interface {
@@ -150,6 +151,10 @@ func ParseFlags(config *ConfigParams) error {
                "verbose",
                false,
                "Log informational messages. Off by default.")
                "verbose",
                false,
                "Log informational messages. Off by default.")
+       getVersion := flags.Bool(
+               "version",
+               false,
+               "Print version information and exit.")
        parentGroupUUID := flags.String(
                "parent-group-uuid",
                "",
        parentGroupUUID := flags.String(
                "parent-group-uuid",
                "",
@@ -158,6 +163,12 @@ func ParseFlags(config *ConfigParams) error {
        // Parse args; omit the first arg which is the command name
        flags.Parse(os.Args[1:])
 
        // Parse args; omit the first arg which is the command name
        flags.Parse(os.Args[1:])
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        // Input file as a required positional argument
        if flags.NArg() == 0 {
                return fmt.Errorf("please provide a path to an input file")
        // Input file as a required positional argument
        if flags.NArg() == 0 {
                return fmt.Errorf("please provide a path to an input file")
@@ -276,7 +287,7 @@ func doMain(cfg *ConfigParams) error {
        }
        defer f.Close()
 
        }
        defer f.Close()
 
-       log.Printf("Group sync starting. Using %q as users id and parent group UUID %q", cfg.UserID, cfg.ParentGroupUUID)
+       log.Printf("arv-sync-groups %q started. Using %q as users id and parent group UUID %q", arvadosVersion.GetVersion(), cfg.UserID, cfg.ParentGroupUUID)
 
        // Get the complete user list to minimize API Server requests
        allUsers := make(map[string]arvados.User)
 
        // Get the complete user list to minimize API Server requests
        allUsers := make(map[string]arvados.User)
index 7dca3293d25fce94111eb1708fde156fc5c52387..9d3b45a6bd988a20f01838dfa8b176098152c7f9 100644 (file)
@@ -18,6 +18,7 @@ import (
 
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
 
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 func main() {
 )
 
 func main() {
@@ -62,9 +63,20 @@ func doMain(args []string) error {
                false,
                "Log progress of each block verification")
 
                false,
                "Log progress of each block verification")
 
+       getVersion := flags.Bool(
+               "version",
+               false,
+               "Print version information and exit.")
+
        // Parse args; omit the first arg which is the command name
        flags.Parse(args)
 
        // Parse args; omit the first arg which is the command name
        flags.Parse(args)
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        config, blobSigningKey, err := loadConfig(*configFile)
        if err != nil {
                return fmt.Errorf("Error loading configuration from file: %s", err.Error())
        config, blobSigningKey, err := loadConfig(*configFile)
        if err != nil {
                return fmt.Errorf("Error loading configuration from file: %s", err.Error())
index 6c8a866291b10ca0efcff8e7d9f50ca6d727703b..d5386b0ef5d4cce751b0ee7731e8682cc8ae7d41 100644 (file)
@@ -22,14 +22,17 @@ import (
        "crypto/rand"
        "encoding/binary"
        "flag"
        "crypto/rand"
        "encoding/binary"
        "flag"
+       "fmt"
        "io"
        "io/ioutil"
        "log"
        "net/http"
        "io"
        "io/ioutil"
        "log"
        "net/http"
+       "os"
        "time"
 
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
        "time"
 
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 // Command line config knobs
 )
 
 // Command line config knobs
@@ -43,11 +46,20 @@ var (
        StatsInterval = flag.Duration("stats-interval", time.Second, "time interval between IO stats reports, or 0 to disable")
        ServiceURL    = flag.String("url", "", "specify scheme://host of a single keep service to exercise (instead of using all advertised services like normal clients)")
        ServiceUUID   = flag.String("uuid", "", "specify UUID of a single advertised keep service to exercise")
        StatsInterval = flag.Duration("stats-interval", time.Second, "time interval between IO stats reports, or 0 to disable")
        ServiceURL    = flag.String("url", "", "specify scheme://host of a single keep service to exercise (instead of using all advertised services like normal clients)")
        ServiceUUID   = flag.String("uuid", "", "specify UUID of a single advertised keep service to exercise")
+       getVersion    = flag.Bool("version", false, "Print version information and exit.")
 )
 
 func main() {
        flag.Parse()
 
 )
 
 func main() {
        flag.Parse()
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
+       log.Printf("keep-exercise %q started", arvadosVersion.GetVersion())
+
        arv, err := arvadosclient.MakeArvadosClient()
        if err != nil {
                log.Fatal(err)
        arv, err := arvadosclient.MakeArvadosClient()
        if err != nil {
                log.Fatal(err)
index a299d17febb1a46fc276ab6ed0fac5ee49ac09be..df7f1caf3e0f990aaf781792475871d0f4dbbe64 100644 (file)
@@ -19,6 +19,7 @@ import (
 
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
 
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 func main() {
 )
 
 func main() {
@@ -69,9 +70,20 @@ func doMain() error {
                0,
                "Lifetime of blob permission signatures on source keepservers. If not provided, this will be retrieved from the API server's discovery document.")
 
                0,
                "Lifetime of blob permission signatures on source keepservers. If not provided, this will be retrieved from the API server's discovery document.")
 
+       getVersion := flags.Bool(
+               "version",
+               false,
+               "Print version information and exit.")
+
        // Parse args; omit the first arg which is the command name
        flags.Parse(os.Args[1:])
 
        // Parse args; omit the first arg which is the command name
        flags.Parse(os.Args[1:])
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        srcConfig, srcBlobSigningKey, err := loadConfig(*srcConfigFile)
        if err != nil {
                return fmt.Errorf("Error loading src configuration from file: %s", err.Error())
        srcConfig, srcBlobSigningKey, err := loadConfig(*srcConfigFile)
        if err != nil {
                return fmt.Errorf("Error loading src configuration from file: %s", err.Error())