diff --git a/Dockerfile b/Dockerfile index d7d59d32f..596518160 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN apk add --no-cache git jq gcc libc-dev make bash gettext COPY . . -RUN BUILD_VERSION="$(git describe --tags `git rev-list --tags --max-count=1`)-docker" make release +RUN SYSTEM="docker" make release RUN /bin/bash wizard.sh --docker-mode RUN cscli hub update && cscli collections install crowdsecurity/linux diff --git a/Makefile b/Makefile index d8ef37542..0d6ebed5f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ROOT= $(shell git rev-parse --show-toplevel) -SYSTEM = $(shell uname -s | tr '[A-Z]' '[a-z]') +SYSTEM?= $(shell uname -s | tr '[A-Z]' '[a-z]') ifneq ("$(wildcard $(ROOT)/platform/$(SYSTEM).mk)", "") include $(ROOT)/platform/$(SYSTEM).mk @@ -34,6 +34,7 @@ BUILD_CODENAME=$(shell cat RELEASE.json | jq -r .CodeName) BUILD_TIMESTAMP=$(shell date +%F"_"%T) BUILD_TAG="$(shell git rev-parse HEAD)" export LD_OPTS=-ldflags "-s -w -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \ +-X github.com/crowdsecurity/crowdsec/pkg/cwversion.System=$(SYSTEM) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.BuildDate=$(BUILD_TIMESTAMP) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=$(BUILD_CODENAME) \ -X github.com/crowdsecurity/crowdsec/pkg/cwversion.Tag=$(BUILD_TAG) \ diff --git a/pkg/cwversion/version.go b/pkg/cwversion/version.go index 28ca180f4..4ac64d1ec 100644 --- a/pkg/cwversion/version.go +++ b/pkg/cwversion/version.go @@ -28,6 +28,7 @@ var ( BuildDate string // = "I don't remember exactly" Tag string // = "dev" GoVersion string // = "1.13" + System string // = "linux" Constraint_parser = ">= 1.0, <= 2.0" Constraint_scenario = ">= 1.0, < 3.0" Constraint_api = "v1" @@ -40,6 +41,7 @@ func ShowStr() string { ret += fmt.Sprintf("Codename: %s\n", Codename) ret += fmt.Sprintf("BuildDate: %s\n", BuildDate) ret += fmt.Sprintf("GoVersion: %s\n", GoVersion) + ret += fmt.Sprintf("Platform: %s\n", System) return ret } @@ -55,7 +57,7 @@ func Show() { } func VersionStr() string { - return fmt.Sprintf("%s-%s", Version, Tag) + return fmt.Sprintf("%s-%s-%s", Version, System, Tag) } func VersionStrip() string {