diff --git a/.circleci/config.yml b/.circleci/config.yml index e19f7a19..e1731816 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,12 @@ +defaults: &defaults + docker: + - image: circleci/golang:1.9 + working_directory: /go/src/github.com/ernoaapa/eliot + version: 2 jobs: test: - docker: - - image: circleci/golang:1.9 - working_directory: /go/src/github.com/ernoaapa/eliot + <<: *defaults steps: - checkout @@ -12,84 +15,22 @@ jobs: - run: go test -v ./... build: - docker: - - image: circleci/golang:1.9 - working_directory: /go/src/github.com/ernoaapa/eliot + <<: *defaults steps: - checkout - - setup_remote_docker - - run: - name: Install tools - command: go get github.com/mitchellh/gox - - - run: - name: Build binaries - command: | - export VERSION=$(git describe --tags --always --dirty) - export CGO_ENABLED=0 - gox -osarch="darwin/amd64 linux/amd64 linux/arm64" -ldflags "-X github.com/ernoaapa/eliot/pkg/version.VERSION=${VERSION}" -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" ./cmd/... - - - run: - name: Verify binaries - command: | - ./dist/eliotd_linux_amd64 -h + - run: go get github.com/goreleaser/goreleaser + - run: goreleaser --snapshot --skip-publish - - run: - name: Build images - command: ./.circleci/scripts/docker-build.sh - - - save_cache: - key: binaries-{{ .Revision }} - paths: - - dist - - publish-binaries: - docker: - - image: circleci/golang:1.9 - working_directory: /go/src/github.com/ernoaapa/eliot - steps: - - - restore_cache: - key: binaries-{{ .Revision }} - - - run: - name: Install tools - command: go get github.com/tcnksm/ghr - - - run: - name: Push binaries to GitHub - command: | - ghr -token $GITHUB_TOKEN -username $CIRCLE_PROJECT_USERNAME -repository $CIRCLE_PROJECT_REPONAME $CIRCLE_TAG dist/ - - publish-images: - docker: - - image: circleci/golang:1.9 - working_directory: /go/src/github.com/ernoaapa/eliot + publish: + <<: *defaults steps: - checkout - - setup_remote_docker - - restore_cache: - key: binaries-{{ .Revision }} - - - run: - name: Install tools - command: go get github.com/estesp/manifest-tool - - - run: - name: Login Docker hub - command: echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin - - - run: - name: Build images - command: ./.circleci/scripts/docker-build.sh - - - run: - name: Push images - command: ./.circleci/scripts/docker-push.sh + - run: go get github.com/goreleaser/goreleaser + - run: goreleaser workflows: version: 2 @@ -109,20 +50,7 @@ workflows: tags: only: /.*/ - - publish-binaries: - requires: - - test - - build - - # Don't run when branches updates, only when tags get created - filters: - branches: - ignore: /.*/ - tags: - only: - - /v.*/ - - - publish-images: + - publish: requires: - test - build diff --git a/.circleci/scripts/docker-build.sh b/.circleci/scripts/docker-build.sh deleted file mode 100755 index a2e82f0c..00000000 --- a/.circleci/scripts/docker-build.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -e - -REGISTRY=ernoaapa -PLATFORMS="linux/amd64,linux/arm64" -GIT_HASH=$(git describe --contains --always --dirty) - -for bin in eliotd; do - image="${REGISTRY}/${bin}" - - for osarch in ${PLATFORMS//,/ }; do - os="${osarch%%/*}" - arch="${osarch#*/}" - version="${GIT_HASH}-${arch}" - tag="${image}:${version}" - echo "Building container for: $bin $os $arch, tag: ${tag}" - - if [ ! -f "./dist/${bin}_${os}_${arch}" ]; then - echo "Missing binary dist/${bin}_${os}_${arch}!" - exit 1 - else - chmod +x "./dist/${bin}_${os}_${arch}" - - if [ $arch == "amd64" ]; then - echo "Test running the binary by printing help text" - ./dist/${bin}_${os}_${arch} -h - fi - fi - - sed \ - -e "s|ARG_BIN|${bin}|g" \ - -e "s|ARG_OS|${os}|g" \ - -e "s|ARG_ARCH|${arch}|g" \ - Dockerfile.tmpl > .dockerfile-${arch} - - echo "Build docker image ${tag}:" - echo "---------------Dockerfile start---------------------" - cat .dockerfile-${arch} - echo "----------------Dockerfile end----------------------" - - docker build -t ${tag} -f .dockerfile-${arch} . - - # Test spin up amd64 container because running in circleCI - if [ $arch == "amd64" ]; then - echo "Test running the container by printing help text" - docker run -it ${tag} -h - fi - done -done diff --git a/.circleci/scripts/docker-push.sh b/.circleci/scripts/docker-push.sh deleted file mode 100755 index d25425ce..00000000 --- a/.circleci/scripts/docker-push.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -e - -REGISTRY=ernoaapa -PLATFORMS="linux/amd64,linux/arm64" -GIT_HASH=$(git describe --tags --always --dirty) - - -for bin in eliotd; do - image="${REGISTRY}/${bin}" - - for osarch in ${PLATFORMS//,/ }; do - os="${osarch%%/*}" - arch="${osarch#*/}" - version="${GIT_HASH}-${arch}" - tag="${image}:${version}" - echo "Building container for: $bin $os $arch, tag: ${tag}" - - docker push ${tag} - done - - manifest-tool \ - --username ${DOCKER_USER} \ - --password ${DOCKER_PASS} \ - push from-args \ - --platforms $PLATFORMS \ - --template ${image}:${GIT_HASH}-ARCH \ - --target ${image}:${GIT_HASH} -done diff --git a/.gitignore b/.gitignore index 39268c60..d30eff61 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ /dist /bin /.go -/.push-* -/.container-* -/.dockerfile-* node_modules # Ignore because just used with gitbook diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..d5b0e153 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,58 @@ +builds: + - binary: eli + main: ./cmd/eli + goos: + - darwin + - linux + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=0 + + - binary: eliotd + main: ./cmd/eliotd + goos: + - linux + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=0 + +archive: + name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + +brew: + github: + owner: ernoaapa + name: homebrew-eliot + homepage: "http://eliot.run" + description: "Container management system for IoT devices" + test: | + system "#{bin}/eli --version" + +dockers: + - binary: eli + goos: linux + goarch: amd64 + image: ernoaapa/eli + dockerfile: Dockerfile.eli + tag_templates: + - "v{{ .Version }}" + + - binary: eliotd + goos: linux + goarch: amd64 + image: ernoaapa/eliotd + dockerfile: Dockerfile.eliotd + tag_templates: + - "v{{ .Version }}-amd64" + + - binary: eliotd + goos: linux + goarch: arm64 + image: ernoaapa/eliotd + dockerfile: Dockerfile.eliotd + tag_templates: + - "v{{ .Version }}-arm64" diff --git a/Dockerfile.in b/Dockerfile.eli similarity index 78% rename from Dockerfile.in rename to Dockerfile.eli index 70c3f14c..aaad006b 100644 --- a/Dockerfile.in +++ b/Dockerfile.eli @@ -7,6 +7,6 @@ COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ LABEL maintainer="Erno Aapa " -ADD bin/ARG_OS-ARG_ARCH/ARG_BIN /ARG_BIN +COPY eli / -ENTRYPOINT ["/ARG_BIN"] +ENTRYPOINT ["/eli"] \ No newline at end of file diff --git a/Dockerfile.tmpl b/Dockerfile.eliotd similarity index 78% rename from Dockerfile.tmpl rename to Dockerfile.eliotd index a9ec4819..2789e35d 100644 --- a/Dockerfile.tmpl +++ b/Dockerfile.eliotd @@ -7,6 +7,6 @@ COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ LABEL maintainer="Erno Aapa " -ADD dist/ARG_BIN_ARG_OS_ARG_ARCH /ARG_BIN +COPY eliotd / -ENTRYPOINT ["/ARG_BIN"] +ENTRYPOINT ["/eliotd"] \ No newline at end of file diff --git a/Makefile b/Makefile index ec19d2c1..a3ab7c03 100644 --- a/Makefile +++ b/Makefile @@ -1,165 +1,3 @@ -# Modified version of -# https://github.com/thockin/go-build-template - -# The binary to build (just the basename). -BIN ?= eliotd - -# This repo's root import path (under GOPATH). -PKG := github.com/ernoaapa/eliot - -# Where to push the docker image. -REGISTRY ?= ernoaapa - -# Which architecture to build -ARCH ?= amd64 -OS ?= linux - -# This version-strategy uses git tags to set the version string -# Use tag if current commit is tag otherise git hash and include -dirty if uncommited files -GIT_HASH ?= $(shell git describe --contains --always --dirty) -VERSION := $(GIT_HASH)-$(ARCH) - -### -### These variables should not need tweaking. -### - -SRC_DIRS := cmd pkg # directories which hold app source (not vendored) - -ALL_PLATFORMS := darwin-amd64 linux-amd64 linux-arm64 -CONTAINER_PLATFORMS := linux-amd64 linux-arm64 - -IMAGE := $(REGISTRY)/$(BIN) - -BUILD_IMAGE ?= golang:1.9-alpine - -# If you want to build all binaries, see the 'all-build' rule. -# If you want to build all containers, see the 'all-container' rule. -# If you want to build AND push all containers, see the 'all-push' rule. -all: build - -build-%: - @$(MAKE) --no-print-directory ARCH=$(word 2,$(subst -, ,$*)) OS=$(word 1,$(subst -, ,$*)) build - -container-%: - @$(MAKE) --no-print-directory ARCH=$(word 2,$(subst -, ,$*)) OS=$(word 1,$(subst -, ,$*)) container - -push-%: - @$(MAKE) --no-print-directory ARCH=$(word 2,$(subst -, ,$*)) OS=$(word 1,$(subst -, ,$*)) push - -all-build: $(addprefix build-, $(ALL_PLATFORMS)) - -all-container: $(addprefix container-, $(CONTAINER_PLATFORMS)) - -all-push: $(addprefix push-, $(CONTAINER_PLATFORMS)) - -build: bin/$(OS)-$(ARCH)/$(BIN) - - bin/$(OS)-$(ARCH)/$(BIN): build-dirs - ifeq ($(filter $(OS)-$(ARCH),$(ALL_PLATFORMS)),) - $(error unsupported platform $(OS)-$(ARCH) not in $(ALL_PLATFORMS)) - endif - @echo "building: $@" - @docker run \ - -ti \ - --rm \ - -u $$(id -u):$$(id -g) \ - -v "$$(pwd)/.go:/go" \ - -v "$$(pwd):/go/src/$(PKG)" \ - -v "$$(pwd)/bin/$(OS)-$(ARCH):/go/bin" \ - -v "$$(pwd)/bin/$(OS)-$(ARCH):/go/bin/$(OS)_$(ARCH)" \ - -v "$$(pwd)/.go/std/$(OS)-$(ARCH):/usr/local/go/pkg/$(OS)_$(ARCH)_static" \ - -w /go/src/$(PKG) \ - $(BUILD_IMAGE) \ - /bin/sh -c " \ - ARCH=$(ARCH) \ - OS=$(OS) \ - VERSION=$(VERSION) \ - PKG=$(PKG) \ - ./build/build.sh \ - " - -# Example: make shell CMD="-c 'date > datefile'" -shell: build-dirs - @echo "launching a shell in the containerized build environment" - @docker run \ - -ti \ - --rm \ - -u $$(id -u):$$(id -g) \ - -v "$$(pwd)/.go:/go" \ - -v "$$(pwd):/go/src/$(PKG)" \ - -v "$$(pwd)/bin/$(OS)-$(ARCH):/go/bin" \ - -v "$$(pwd)/bin/$(OS)-$(ARCH):/go/bin/$(OS)_$(ARCH)" \ - -v "$$(pwd)/.go/std/$(OS)-$(ARCH):/usr/local/go/pkg/$(OS)_$(ARCH)_static" \ - -w /go/src/$(PKG) \ - $(BUILD_IMAGE) \ - /bin/sh $(CMD) - -DOTFILE_IMAGE = $(subst :,_,$(subst /,_,$(IMAGE))-$(VERSION)) - -container: .container-$(DOTFILE_IMAGE) container-name -.container-$(DOTFILE_IMAGE): bin/$(OS)-$(ARCH)/$(BIN) Dockerfile.in - @sed \ - -e 's|ARG_BIN|$(BIN)|g' \ - -e 's|ARG_OS|$(OS)|g' \ - -e 's|ARG_ARCH|$(ARCH)|g' \ - Dockerfile.in > .dockerfile-$(ARCH) - @docker build -t $(IMAGE):$(VERSION) -f .dockerfile-$(ARCH) . - @docker images -q $(IMAGE):$(VERSION) > $@ - -container-name: - @echo "container: $(IMAGE):$(VERSION)" - -push: .push-$(DOTFILE_IMAGE) push-name -.push-$(DOTFILE_IMAGE): .container-$(DOTFILE_IMAGE) -ifeq ($(findstring gcr.io,$(REGISTRY)),gcr.io) - @gcloud docker -- push $(IMAGE):$(VERSION) -else - @docker push $(IMAGE):$(VERSION) -endif - @docker images -q $(IMAGE):$(VERSION) > $@ - -push-name: - @echo "pushed: $(IMAGE):$(VERSION)" - -push-manifest: - manifest-tool \ - --username $(DOCKER_USER) \ - --password $(DOCKER_PASS) \ - push from-args \ - --platforms linux/amd64,linux/arm64 \ - --template $(IMAGE):$(GIT_HASH)-ARCH \ - --target $(IMAGE):$(GIT_HASH) - -version: - @echo $(VERSION) - -test: build-dirs - @docker run \ - -ti \ - --rm \ - -u $$(id -u):$$(id -g) \ - -v "$$(pwd)/.go:/go" \ - -v "$$(pwd):/go/src/$(PKG)" \ - -v "$$(pwd)/bin/$(ARCH):/go/bin" \ - -v "$$(pwd)/.go/std/$(OS)-$(ARCH):/usr/local/go/pkg/$(OS)_$(ARCH)_static" \ - -w /go/src/$(PKG) \ - $(BUILD_IMAGE) \ - /bin/sh -c " \ - ./build/test.sh $(SRC_DIRS) \ - " - -build-dirs: - @mkdir -p bin/$(OS)-$(ARCH) - @mkdir -p .go/src/$(PKG) .go/pkg .go/bin .go/std/$(OS)-$(ARCH) - -clean: container-clean bin-clean - -container-clean: - rm -rf .container-* .dockerfile-* .push-* - -bin-clean: - rm -rf .go bin - publish-docs: ./build/docs.sh \ No newline at end of file diff --git a/build/build.sh b/build/build.sh deleted file mode 100755 index a5247d8e..00000000 --- a/build/build.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -# Copyright 2016 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o errexit -set -o nounset -set -o pipefail - -if [ -z "${PKG}" ]; then - echo "PKG must be set" - exit 1 -fi -if [ -z "${ARCH}" ]; then - echo "ARCH must be set" - exit 1 -fi -if [ -z "${OS}" ]; then - echo "OS must be set" - exit 1 -fi -if [ -z "${VERSION}" ]; then - echo "VERSION must be set" - exit 1 -fi - -export CGO_ENABLED=0 -export GOARCH="${ARCH}" -export GOOS="${OS}" - -go install \ - -installsuffix "static" \ - -ldflags "-X ${PKG}/pkg/version.VERSION=${VERSION}" \ - ./... diff --git a/build/test.sh b/build/test.sh deleted file mode 100755 index 49b36a14..00000000 --- a/build/test.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Copyright 2016 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o errexit -set -o nounset -set -o pipefail - -export CGO_ENABLED=0 - -TARGETS=$(for d in "$@"; do echo ./$d/...; done) - -echo "Running tests:" -go test -i -installsuffix "static" ${TARGETS} -go test -installsuffix "static" ${TARGETS} -echo - -echo -n "Checking gofmt: " -ERRS=$(find "$@" -type f -name \*.go | xargs gofmt -l 2>&1 || true) -if [ -n "${ERRS}" ]; then - echo "FAIL - the following files need to be gofmt'ed:" - for e in ${ERRS}; do - echo " $e" - done - echo - exit 1 -fi -echo "PASS" -echo - -echo -n "Checking go vet: " -ERRS=$(go vet ${TARGETS} 2>&1 || true) -if [ -n "${ERRS}" ]; then - echo "FAIL" - echo "${ERRS}" - echo - exit 1 -fi -echo "PASS" -echo diff --git a/cmd/eli/main.go b/cmd/eli/main.go index f6d149f8..fa5a3e25 100644 --- a/cmd/eli/main.go +++ b/cmd/eli/main.go @@ -1,14 +1,20 @@ package main import ( + "fmt" "os" + "time" "github.com/ernoaapa/eliot/cmd" - "github.com/ernoaapa/eliot/pkg/version" log "github.com/sirupsen/logrus" "github.com/urfave/cli" ) +// Get overrided at build time +var version = "master" +var commit = "unknown" +var date = time.Now().Format("2006-01-02_15:04:05") + func main() { app := cli.NewApp() app.Name = "eli" @@ -52,7 +58,7 @@ func main() { EnvVar: "ELIOT_DEVICE", }, }, cmd.GlobalFlags...) - app.Version = version.VERSION + app.Version = fmt.Sprintf("Version: %s, Commit: %s, Build at: %s", version, commit, date) app.Before = cmd.GlobalBefore app.Commands = []cli.Command{ diff --git a/cmd/eliotd/main.go b/cmd/eliotd/main.go index ae6e3ed8..77e01b70 100644 --- a/cmd/eliotd/main.go +++ b/cmd/eliotd/main.go @@ -2,9 +2,11 @@ package main import ( "errors" + "fmt" "os" "strconv" "strings" + "time" "github.com/ernoaapa/eliot/cmd" "github.com/ernoaapa/eliot/pkg/api" @@ -12,12 +14,16 @@ import ( "github.com/ernoaapa/eliot/pkg/device" "github.com/ernoaapa/eliot/pkg/discovery" "github.com/ernoaapa/eliot/pkg/profile" - "github.com/ernoaapa/eliot/pkg/version" log "github.com/sirupsen/logrus" "github.com/thejerf/suture" "github.com/urfave/cli" ) +// Get overrided at build time +var version = "master" +var commit = "unknown" +var date = time.Now().Format("2006-01-02_15:04:05") + func main() { app := cli.NewApp() app.Name = "eliotd" @@ -83,7 +89,7 @@ func main() { EnvVar: "ELIOT_LABELS", }, }, cmd.GlobalFlags...) - app.Version = version.VERSION + app.Version = fmt.Sprintf("Version: %s, Commit: %s, Build at: %s", version, commit, date) app.Before = cmd.GlobalBefore app.Action = func(clicontext *cli.Context) error { @@ -93,7 +99,7 @@ func main() { ) resolver := device.NewResolver(cmd.GetLabels(clicontext)) - device := resolver.GetInfo(grpcPort) + device := resolver.GetInfo(grpcPort, version) client := cmd.GetRuntimeClient(clicontext, device.Hostname) supervisor := suture.NewSimple("eliotd") @@ -120,7 +126,7 @@ func main() { if clicontext.Bool("grpc-api") && clicontext.Bool("discovery") { log.Infoln("grpc discovery over zeroconf enabled") - supervisor.Add(discovery.NewServer(device.Hostname, grpcPort)) + supervisor.Add(discovery.NewServer(device.Hostname, grpcPort, version)) serviceCount++ } diff --git a/pkg/device/resolver_darwin.go b/pkg/device/resolver_darwin.go index c90aa25b..6f24fc50 100644 --- a/pkg/device/resolver_darwin.go +++ b/pkg/device/resolver_darwin.go @@ -11,18 +11,17 @@ import ( log "github.com/sirupsen/logrus" "github.com/ernoaapa/eliot/pkg/model" - "github.com/ernoaapa/eliot/pkg/version" ) // GetInfo resolves information about the device // Note: Darwin (OSX) implementation is just for development purpose // For example, BootID get generated every time when process restarts -func (r *Resolver) GetInfo(grpcPort int) *model.DeviceInfo { +func (r *Resolver) GetInfo(grpcPort int, version string) *model.DeviceInfo { ioregOutput := runCommandOrFail("ioreg", "-rd1", "-c", "IOPlatformExpertDevice") hostname, _ := os.Hostname() return &model.DeviceInfo{ - Version: version.VERSION, + Version: version, Labels: r.labels, Arch: runtime.GOARCH, OS: runtime.GOOS, diff --git a/pkg/device/resolver_darwin_test.go b/pkg/device/resolver_darwin_test.go index 7390594d..97a77f50 100644 --- a/pkg/device/resolver_darwin_test.go +++ b/pkg/device/resolver_darwin_test.go @@ -11,7 +11,7 @@ func TestGetInfo(t *testing.T) { "foo": "bar", } - info := NewResolver(labels).GetInfo(5000) + info := NewResolver(labels).GetInfo(5000, "test-version") assert.NotEmpty(t, info.BootID, "should resolve BootID") assert.NotEmpty(t, info.MachineID, "should resolve MachineID") diff --git a/pkg/device/resolver_linux.go b/pkg/device/resolver_linux.go index cdb75904..f39e9b58 100644 --- a/pkg/device/resolver_linux.go +++ b/pkg/device/resolver_linux.go @@ -5,14 +5,13 @@ import ( "runtime" "github.com/ernoaapa/eliot/pkg/model" - "github.com/ernoaapa/eliot/pkg/version" ) // GetInfo resolves information about the device -func (r *Resolver) GetInfo(grpcPort int) *model.DeviceInfo { +func (r *Resolver) GetInfo(grpcPort int, version string) *model.DeviceInfo { hostname, _ := os.Hostname() return &model.DeviceInfo{ - Version: version.VERSION, + Version: version, Labels: r.labels, Arch: runtime.GOARCH, OS: runtime.GOOS, diff --git a/pkg/discovery/server.go b/pkg/discovery/server.go index 52949760..30829c5e 100644 --- a/pkg/discovery/server.go +++ b/pkg/discovery/server.go @@ -3,7 +3,6 @@ package discovery import ( "fmt" - "github.com/ernoaapa/eliot/pkg/version" "github.com/grandcat/zeroconf" log "github.com/sirupsen/logrus" ) @@ -13,16 +12,18 @@ type Server struct { Name string Domain string Port int + Version string server *zeroconf.Server shutdown chan bool } // NewServer creates new discovery server -func NewServer(name string, port int) *Server { +func NewServer(name string, port int, version string) *Server { return &Server{ - Name: name, - Domain: "local.", - Port: port, + Name: name, + Domain: "local.", + Port: port, + Version: version, } } @@ -31,7 +32,7 @@ func (s *Server) Serve() { log.Infof("Start discovery server...") log.Debugf("Exposing %s in port %d", s.Name, s.Port) server, err := zeroconf.Register(s.Name, ZeroConfServiceName, s.Domain, s.Port, []string{ - fmt.Sprintf("v=%s", version.VERSION), + fmt.Sprintf("v=%s", s.Version), }, nil) if err != nil { log.Fatalf("Failed to create zeroconf server: %s", err) diff --git a/pkg/version/version.go b/pkg/version/version.go deleted file mode 100644 index e1ade439..00000000 --- a/pkg/version/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package version - -// VERSION is the app-global version string, which should be substituted with a real value during build. -var VERSION = "UNKNOWN"