Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #34 from kinvolk/schu/server-log-version
Browse files Browse the repository at this point in the history
pkg/server: log karydia version when starting
  • Loading branch information
alban authored Dec 19, 2018
2 parents 9eb62ce + b278fb5 commit 930977a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ all: build
.PHONY: build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/karydia \
-ldflags "-s -X github.com/kinvolk/karydia/cli/cmd.version=$(VERSION)" \
-ldflags "-s -X github.com/kinvolk/karydia.Version=$(VERSION)" \
cli/main.go

.PHONY: container
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import (
"fmt"

"github.com/spf13/cobra"
)

var version = "unknown"
"github.com/kinvolk/karydia"
)

var versionCmd = &cobra.Command{
Use: "version",
Short: "Print version and exit",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version)
fmt.Println(karydia.Version)
},
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/sirupsen/logrus"

"github.com/kinvolk/karydia"
"github.com/kinvolk/karydia/pkg/webhook"
)

Expand Down Expand Up @@ -63,6 +64,7 @@ func New(config *Config, webhook *webhook.Webhook) (*Server, error) {
}

func (s *Server) ListenAndServe() error {
s.logger.Infof("karydia server version: %s", karydia.Version)
s.logger.Infof("Listening on %s", s.config.Addr)
return s.httpServer.ListenAndServeTLS("", "")
}
Expand Down
3 changes: 3 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package karydia

var Version = "unknown"

0 comments on commit 930977a

Please sign in to comment.