summaryrefslogtreecommitdiffhomepage
path: root/runsc/main.go
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2019-04-01 16:17:40 -0700
committerShentubot <shentubot@google.com>2019-04-01 16:18:43 -0700
commit7543e9ec2043af7d071373aeec04b92a98051087 (patch)
treef43044f892c853d5cf97fe5d12f6d6702a2a02f1 /runsc/main.go
parent7cff746ef2bbe5351e5985bebc88efc9e0881c78 (diff)
Add release hook and version flag
PiperOrigin-RevId: 241421671 Change-Id: Ic0cebfe3efd458dc42c49f7f812c13318705199a
Diffstat (limited to 'runsc/main.go')
-rw-r--r--runsc/main.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/runsc/main.go b/runsc/main.go
index 4b3f55ad1..bbf08228c 100644
--- a/runsc/main.go
+++ b/runsc/main.go
@@ -18,6 +18,7 @@ package main
import (
"context"
+ "fmt"
"io"
"os"
"path/filepath"
@@ -40,6 +41,7 @@ var (
logFilename = flag.String("log", "", "file path where internal debug information is written, default is stdout")
logFormat = flag.String("log-format", "text", "log format: text (default), json, or json-k8s")
debug = flag.Bool("debug", false, "enable debug logging")
+ showVersion = flag.Bool("version", false, "show version and exit")
// These flags are unique to runsc, and are used to configure parts of the
// system that are not covered by the runtime spec.
@@ -69,9 +71,6 @@ var (
testOnlyAllowRunAsCurrentUserWithoutChroot = flag.Bool("TESTONLY-unsafe-nonroot", false, "TEST ONLY; do not ever use! This skips many security measures that isolate the host from the sandbox.")
)
-// gitRevision is set during linking.
-var gitRevision = ""
-
func main() {
// Help and flags commands are generated automatically.
subcommands.Register(subcommands.HelpCommand(), "")
@@ -107,6 +106,14 @@ func main() {
// All subcommands must be registered before flag parsing.
flag.Parse()
+ // Are we showing the version?
+ if *showVersion {
+ // The format here is the same as runc.
+ fmt.Fprintf(os.Stdout, "runsc version %s\n", version)
+ fmt.Fprintf(os.Stdout, "spec: %s\n", specutils.Version)
+ os.Exit(0)
+ }
+
platformType, err := boot.MakePlatformType(*platform)
if err != nil {
cmd.Fatalf("%v", err)
@@ -215,7 +222,7 @@ func main() {
log.Infof("***************************")
log.Infof("Args: %s", os.Args)
- log.Infof("Git Revision: %s", gitRevision)
+ log.Infof("Version %s", version)
log.Infof("PID: %d", os.Getpid())
log.Infof("UID: %d, GID: %d", os.Getuid(), os.Getgid())
log.Infof("Configuration:")