Make statusd distinct from StatusIM client (#1008)

This commit is contained in:
Adam Babik 2018-06-08 11:20:30 +02:00 committed by GitHub
parent feed9158bd
commit 8ce6efc749
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 15 deletions

View File

@ -13,7 +13,7 @@ CGO_CFLAGS=-I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin
GOBIN=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin
GIT_COMMIT := $(shell git rev-parse --short HEAD)
BUILD_FLAGS := $(shell echo "-ldflags '-X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` -X main.gitCommit=$(GIT_COMMIT) -X github.com/status-im/status-go/geth/params.VersionMeta=$(GIT_COMMIT)'")
BUILD_FLAGS ?= $(shell echo "-ldflags '-X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` -X github.com/status-im/status-go/geth/params.VersionMeta=$(GIT_COMMIT)'")
GO ?= latest
XGOVERSION ?= 1.10.x
@ -100,10 +100,9 @@ statusgo-library: ##@cross-compile Build status-go as static library for current
@echo "Static library built:"
@ls -la $(GOBIN)/libstatus.*
docker-image: BUILD_TAGS ?= metrics prometheus
docker-image: ##@docker Build docker image (use DOCKER_IMAGE_NAME to set the image name)
@echo "Building docker image..."
docker build --file _assets/build/Dockerfile --build-arg "build_tags=$(BUILD_TAGS)" . -t $(DOCKER_IMAGE_NAME):latest
docker build --file _assets/build/Dockerfile --build-arg "build_tags=$(BUILD_TAGS)" --build-arg "build_flags=$(BUILD_FLAGS)" . -t $(DOCKER_IMAGE_NAME):latest
bootnode-image:
@echo "Building docker image for bootnode..."

View File

@ -2,12 +2,16 @@
FROM golang:1.10-alpine as builder
ARG build_tags
ARG build_flags
RUN apk add --no-cache make gcc musl-dev linux-headers
RUN mkdir -p /go/src/github.com/status-im/status-go
ADD . /go/src/github.com/status-im/status-go
RUN cd /go/src/github.com/status-im/status-go && make statusgo BUILD_TAGS="$build_tags"
RUN cd /go/src/github.com/status-im/status-go && \
make statusgo \
BUILD_TAGS="$build_tags" \
BUILD_FLAGS="$build_flags"
# Copy the binary to the second image
FROM alpine:latest

View File

@ -24,8 +24,11 @@ import (
"github.com/status-im/status-go/profiling"
)
const (
serverClientName = "Statusd"
)
var (
gitCommit = "N/A" // rely on linker: -ldflags -X main.GitCommit"
buildStamp = "N/A" // rely on linker: -ldflags -X main.buildStamp"
)
@ -98,9 +101,11 @@ func main() {
if err != nil {
stdlog.Fatalf("Making config failed, %s", err)
}
// We want statusd to be distinct from StatusIM client.
config.Name = serverClientName
if *version {
printVersion(config, gitCommit, buildStamp)
printVersion(config, buildStamp)
return
}
@ -288,16 +293,10 @@ func configureStatusService(flagValue string, nodeConfig *params.NodeConfig) (*p
}
// printVersion prints verbose output about version and config.
func printVersion(config *params.NodeConfig, gitCommit, buildStamp string) {
if gitCommit != "" && len(gitCommit) > 8 {
params.Version += "-" + gitCommit[:8]
}
func printVersion(config *params.NodeConfig, buildStamp string) {
fmt.Println(strings.Title(config.Name))
fmt.Println("Version:", config.Version)
fmt.Println(strings.Title(params.ClientIdentifier))
fmt.Println("Version:", params.Version)
if gitCommit != "" {
fmt.Println("Git Commit:", gitCommit)
}
if buildStamp != "" {
fmt.Println("Build Stamp:", buildStamp)
}

View File

@ -137,6 +137,8 @@ func (s *PeerPoolSimulationSuite) TestPeerPoolCache() {
}
func (s *PeerPoolSimulationSuite) TestSingleTopicDiscoveryWithFailover() {
s.T().Skip("Skipping due to being flaky")
var err error
// Buffered channels must be used because we expect the events