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 GOBIN=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin
GIT_COMMIT := $(shell git rev-parse --short HEAD) 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 GO ?= latest
XGOVERSION ?= 1.10.x XGOVERSION ?= 1.10.x
@ -100,10 +100,9 @@ statusgo-library: ##@cross-compile Build status-go as static library for current
@echo "Static library built:" @echo "Static library built:"
@ls -la $(GOBIN)/libstatus.* @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) docker-image: ##@docker Build docker image (use DOCKER_IMAGE_NAME to set the image name)
@echo "Building docker image..." @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: bootnode-image:
@echo "Building docker image for bootnode..." @echo "Building docker image for bootnode..."

View File

@ -2,12 +2,16 @@
FROM golang:1.10-alpine as builder FROM golang:1.10-alpine as builder
ARG build_tags ARG build_tags
ARG build_flags
RUN apk add --no-cache make gcc musl-dev linux-headers RUN apk add --no-cache make gcc musl-dev linux-headers
RUN mkdir -p /go/src/github.com/status-im/status-go RUN mkdir -p /go/src/github.com/status-im/status-go
ADD . /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 # Copy the binary to the second image
FROM alpine:latest FROM alpine:latest

View File

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

View File

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