[ARVADOS] created: 1.1.0-148-gca06cfb
Git user
git at public.curoverse.com
Tue Nov 28 19:56:04 EST 2017
at ca06cfbda0e84d469f7810a280cfa4dfa8997260 (commit)
commit ca06cfbda0e84d469f7810a280cfa4dfa8997260
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Nov 28 21:55:13 2017 -0300
10666: Added version number to go sdk and go tools & services
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/sdk/go/version/version.go b/sdk/go/version/version.go
new file mode 100644
index 0000000..ef9abe7
--- /dev/null
+++ b/sdk/go/version/version.go
@@ -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"
+}
diff --git a/services/arv-git-httpd/main.go b/services/arv-git-httpd/main.go
index 79a3eb3..2750ab9 100644
--- a/services/arv-git-httpd/main.go
+++ b/services/arv-git-httpd/main.go
@@ -7,12 +7,14 @@ package main
import (
"encoding/json"
"flag"
+ "fmt"
"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"
)
@@ -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)")
+ 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.")
@@ -57,6 +60,12 @@ func main() {
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")
@@ -84,6 +93,7 @@ func main() {
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 {
diff --git a/services/crunch-dispatch-local/crunch-dispatch-local.go b/services/crunch-dispatch-local/crunch-dispatch-local.go
index 888a214..c1d6d56 100644
--- a/services/crunch-dispatch-local/crunch-dispatch-local.go
+++ b/services/crunch-dispatch-local/crunch-dispatch-local.go
@@ -9,6 +9,7 @@ package main
import (
"context"
"flag"
+ "fmt"
"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"
+ arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
)
func main() {
@@ -49,9 +51,22 @@ func doMain() error {
"/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:])
+ // 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()
diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
index 30cbb79..e743fa5 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
@@ -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"
+ arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
"github.com/coreos/go-systemd/daemon"
)
@@ -69,10 +70,21 @@ func doMain() error {
"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:])
+ // 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
diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go
index 27a548a..2890978 100644
--- a/services/crunch-run/crunchrun.go
+++ b/services/crunch-run/crunchrun.go
@@ -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"
+ arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
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")
+ getVersion := flags.Bool("version", false, "Print version information and exit.")
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 != "" {
diff --git a/services/crunchstat/crunchstat.go b/services/crunchstat/crunchstat.go
index cd84770..454a5fc 100644
--- a/services/crunchstat/crunchstat.go
+++ b/services/crunchstat/crunchstat.go
@@ -7,6 +7,7 @@ package main
import (
"bufio"
"flag"
+ "fmt"
"io"
"log"
"os"
@@ -16,6 +17,7 @@ import (
"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
@@ -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")
+ getVersion := flag.Bool("version", false, "Print version information and exit.")
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 {
diff --git a/services/health/main.go b/services/health/main.go
index b6358de..d04b55b 100644
--- a/services/health/main.go
+++ b/services/health/main.go
@@ -2,21 +2,33 @@ package main
import (
"flag"
+ "fmt"
"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"
+ 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")
+ getVersion := flag.Bool("version", false, "Print version information and exit.")
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.Printf("arvados health %q started", arvadosVersion.GetVersion())
+
cfg, err := arvados.GetConfig(*configFile)
if err != nil {
log.Fatal(err)
diff --git a/services/keep-balance/main.go b/services/keep-balance/main.go
index 8a938cc..fe4a8c4 100644
--- a/services/keep-balance/main.go
+++ b/services/keep-balance/main.go
@@ -7,6 +7,7 @@ package main
import (
"encoding/json"
"flag"
+ "fmt"
"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"
+ arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
)
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")
+ getVersion := flag.Bool("version", false, "Print version information and exit.")
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)
@@ -97,6 +106,8 @@ func main() {
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 {
diff --git a/services/keep-web/main.go b/services/keep-web/main.go
index 27ceb48..8bd8903 100644
--- a/services/keep-web/main.go
+++ b/services/keep-web/main.go
@@ -6,12 +6,14 @@ package main
import (
"flag"
+ "fmt"
"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"
)
@@ -85,9 +87,17 @@ func main() {
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()
+ // 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.")
@@ -105,6 +115,8 @@ func main() {
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 {
diff --git a/services/keepproxy/keepproxy.go b/services/keepproxy/keepproxy.go
index 3d1b447..ec074cf 100644
--- a/services/keepproxy/keepproxy.go
+++ b/services/keepproxy/keepproxy.go
@@ -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"
+ arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
"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")
+ getVersion := flagset.Bool("version", false, "Print version information and exit.")
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")
@@ -99,6 +107,8 @@ func main() {
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())
diff --git a/services/keepstore/keepstore.go b/services/keepstore/keepstore.go
index 921176d..23af690 100644
--- a/services/keepstore/keepstore.go
+++ b/services/keepstore/keepstore.go
@@ -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"
+ arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
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)")
+ getVersion := flag.Bool("version", false, "Print version information and exit.")
defaultConfigPath := "/etc/arvados/keepstore/keepstore.yml"
var configPath string
@@ -100,6 +102,12 @@ func main() {
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)
@@ -111,6 +119,8 @@ func main() {
log.Fatal(config.DumpAndExit(theConfig))
}
+ log.Printf("keepstore %q started", arvadosVersion.GetVersion())
+
err = theConfig.Start()
if err != nil {
log.Fatal(err)
diff --git a/services/ws/main.go b/services/ws/main.go
index db33cbf..30d569c 100644
--- a/services/ws/main.go
+++ b/services/ws/main.go
@@ -7,9 +7,11 @@ package main
import (
"flag"
"fmt"
+ "os"
"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
@@ -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")
+ getVersion := flag.Bool("version", false, "Print version information and exit.")
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)
@@ -39,6 +48,8 @@ func main() {
return
}
+ log.Printf("arvados-ws %q started", arvadosVersion.GetVersion())
+
log.Info("started")
srv := &server{wsConfig: &cfg}
log.Fatal(srv.Run())
diff --git a/tools/arv-sync-groups/arv-sync-groups.go b/tools/arv-sync-groups/arv-sync-groups.go
index d7efdef..3530ce5 100644
--- a/tools/arv-sync-groups/arv-sync-groups.go
+++ b/tools/arv-sync-groups/arv-sync-groups.go
@@ -17,6 +17,7 @@ import (
"strings"
"git.curoverse.com/arvados.git/sdk/go/arvados"
+ arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
)
type resourceList interface {
@@ -150,6 +151,10 @@ func ParseFlags(config *ConfigParams) error {
"verbose",
false,
"Log informational messages. Off by default.")
+ getVersion := flags.Bool(
+ "version",
+ false,
+ "Print version information and exit.")
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:])
+ // 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")
@@ -276,7 +287,7 @@ func doMain(cfg *ConfigParams) error {
}
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)
diff --git a/tools/keep-block-check/keep-block-check.go b/tools/keep-block-check/keep-block-check.go
index 7dca329..9d3b45a 100644
--- a/tools/keep-block-check/keep-block-check.go
+++ b/tools/keep-block-check/keep-block-check.go
@@ -18,6 +18,7 @@ import (
"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() {
@@ -62,9 +63,20 @@ func doMain(args []string) error {
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)
+ // 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())
diff --git a/tools/keep-exercise/keep-exercise.go b/tools/keep-exercise/keep-exercise.go
index 6c8a866..d5386b0 100644
--- a/tools/keep-exercise/keep-exercise.go
+++ b/tools/keep-exercise/keep-exercise.go
@@ -22,14 +22,17 @@ import (
"crypto/rand"
"encoding/binary"
"flag"
+ "fmt"
"io"
"io/ioutil"
"log"
"net/http"
+ "os"
"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
@@ -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")
+ getVersion = flag.Bool("version", false, "Print version information and exit.")
)
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)
diff --git a/tools/keep-rsync/keep-rsync.go b/tools/keep-rsync/keep-rsync.go
index a299d17..df7f1ca 100644
--- a/tools/keep-rsync/keep-rsync.go
+++ b/tools/keep-rsync/keep-rsync.go
@@ -19,6 +19,7 @@ import (
"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() {
@@ -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.")
+ 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:])
+ // 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())
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list