Feature #10666

All Arvados components should report their version

Added by Tom Clegg over 4 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Start date:
12/05/2016
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
-

Description

It should be possible to get the version of an arvados-prog via
  • arvados-prog -version
  • curl http://.../status.json | jq -r .Version
  • grep "started" .../log/main/current

Subtasks

Task #12490: Review 10666-report-versionResolvedLucas Di Pentima


Related issues

Related to Arvados - Bug #10587: All Python CLI utilities should report --versionResolved11/22/2016

Associated revisions

Revision d7db1f08
Added by Lucas Di Pentima over 3 years ago

Merge branch '10666-report-version'
Closes #10666

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <>

History

#1 Updated by Tom Clegg over 4 years ago

  • Description updated (diff)

#2 Updated by Tom Morris over 3 years ago

  • Target version set to Arvados Future Sprints

#3 Updated by Tom Morris over 3 years ago

  • Subject changed from Packaged go binaries should report their own version numbers to All Arvados components should report their version

This isn't specific to Go programs. I thought we'd already decided that all programs should return their version numbers (although I think we said --version, not -version).

Besides crunch-dispatch-slurm, what other components are we missing?

#4 Updated by Tom Morris over 3 years ago

  • Target version changed from Arvados Future Sprints to 2017-11-08 Sprint

#5 Updated by Nico C├ęsar over 3 years ago

+1

is hard to tell from the logs if deploys are using the correct version

#6 Updated by Tom Morris over 3 years ago

  • Assigned To set to Tom Clegg

#7 Updated by Tom Clegg over 3 years ago

  • Assigned To deleted (Tom Clegg)
  • Target version changed from 2017-11-08 Sprint to 2017-11-22 Sprint

#8 Updated by Tom Morris over 3 years ago

  • Assigned To set to Lucas Di Pentima

#9 Updated by Lucas Di Pentima over 3 years ago

  • Status changed from New to In Progress

#10 Updated by Lucas Di Pentima over 3 years ago

  • Target version changed from 2017-11-22 Sprint to 2017-12-06 Sprint

#11 Updated by Peter Amstutz over 3 years ago

For crunch-run, can we please also log the version number either to either the "crunch-run" (cr.CrunchLog) or "node-info" (LogNodeInfo()) logger?

#12 Updated by Lucas Di Pentima over 3 years ago

Updates at 7209d0ade - branch 10666-report-version
Test run: https://ci.curoverse.com/job/developer-run-tests/520/

Added a version package to Go SDK holding a variable that can be assigned the version number from the linker flags (taken from https://medium.com/@joshroppo/setting-go-1-5-variables-at-compile-time-for-versioning-5b30a965d33e)

Added a --version param and version logging to the following go programs:

  • Tools
    • arv-sync-groups
    • keep-block-check
    • keep-exercise
    • keep-rsync
  • Services
    • arv-git-httpd
    • crunch-dispatch-local
    • crunch-dispatch-slurm
    • arvados-health
    • keep-balance
    • crunchstat
    • crunch-run
    • keep-web
    • keepproxy
    • keepstore
    • arvados-ws

There are some services that should also be reporting their version on their /status.json endpoint (pending)

#13 Updated by Lucas Di Pentima over 3 years ago

Updates at 60a60a176
Test run: https://ci.curoverse.com/job/developer-run-tests/521/

Added version information to /status.json endpoint on the following services:
  • keepstore
  • keep-web
  • ws

Also added corresponding tests.

#14 Updated by Tom Clegg over 3 years ago

Isn't the version package superfluous? Seems like adding

var version = "dev"

to each program would achieve the same thing with less code...?

I suppose package_go_binary() in source:build/run-library.sh needs to learn how to pass the appropriate flags to go get, in order for this to be effective? Something like

go get -ldflags "-X main.version=${version}" "git.curoverse.com/arvados.git/$src_path"

#15 Updated by Tom Clegg over 3 years ago

$ cat <<EOF >main.go
package main
import "fmt" 
var version="foo" 
func main(){
  fmt.Println(version)
}
EOF
$ go run main.go
foo
$ go run -ldflags "-X main.version=bar" main.go
bar

#16 Updated by Lucas Di Pentima over 3 years ago

Updates at 92656b214
Test run: https://ci.curoverse.com/job/developer-run-tests/523/

Removed the version package, replaced it with version var on every program.

#17 Updated by Lucas Di Pentima over 3 years ago

Updates at c24ca3f71
Test run: https://ci.curoverse.com/job/developer-run-tests/524/

Add version information to arv-mount startup logging, and nodemanager logging & /status.json endpoint.

#18 Updated by Tom Clegg over 3 years ago

Suggest %s rather than %q when logging version numbers at startup (hopefully we won't have version numbers that need quoting, right?)

"arvados health %q started" → "arvados-health %s started"

Should probably change the "--version" output from "Version: 1.2.3" → "arvados-health 1.2.3".

In arvados-ws the existing "started" log is now superfluous and should be removed.

       log.Printf("arvados-ws %q started", version)

       log.Info("started")

When you're in func main(), os.Exit(0) can also be written as "return", which might be a better habit since it runs any deferred statements on the way out.

#19 Updated by Lucas Di Pentima over 3 years ago

Updates at 0c3b77f800
Test run: https://ci.curoverse.com/job/developer-run-tests/526/

Addressed comments from note-18, and also updated the build script to pass the version as linker flags on go programs.
Started to work on passing the version info to api & workbench but realized both already have that feature.

#20 Updated by Tom Clegg over 3 years ago

Looks like the bits in "tools" dir didn't get updated from "Version: X" to "progname: X": arv-sync-groups, keep-block-check, etc.

with that, LGTM

#21 Updated by Lucas Di Pentima over 3 years ago

Updates at 0c888bcc93b559339c8abbce784bdcc44746bca2
Test run: https://ci.curoverse.com/job/developer-run-tests/528/

Fixed missing tools && merged master. Will merge after a successful test run.

#22 Updated by Anonymous over 3 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF