From 223fdded68ebf040a1309b9605ba3b1959120f41 Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Tue, 8 Feb 2022 07:01:39 -0500 Subject: [PATCH 1/9] use main.version rather than subpackage variables --- main.go | 3 +++ netclient/main.go | 5 ++++- netclient/ncutils/netclientutils.go | 5 +++++ scripts/build-binaries.sh | 26 +++++++++++++------------- servercfg/serverconf.go | 5 +++++ 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/main.go b/main.go index 0e3b9f71..e061b1ae 100644 --- a/main.go +++ b/main.go @@ -27,8 +27,11 @@ import ( "google.golang.org/grpc" ) +var version = "dev" + // Start DB Connection and start API Request Handler func main() { + servercfg.SetVersion(version) fmt.Println(models.RetrieveLogo()) // print the logo initialize() // initial db and grpc server setGarbageCollection() diff --git a/netclient/main.go b/netclient/main.go index e6d04867..54bc3538 100644 --- a/netclient/main.go +++ b/netclient/main.go @@ -13,11 +13,14 @@ import ( "github.com/urfave/cli/v2" ) +var version = "dev" + func main() { app := cli.NewApp() app.Name = "Netclient CLI" app.Usage = "Netmaker's netclient agent and CLI. Used to perform interactions with Netmaker server and set local WireGuard config." - app.Version = ncutils.Version + app.Version = version + ncutils.SetVersion(version) cliFlags := cli_options.GetFlags(ncutils.GetHostname()) app.Commands = cli_options.GetCommands(cliFlags[:]) diff --git a/netclient/ncutils/netclientutils.go b/netclient/ncutils/netclientutils.go index cd44e221..c0087f18 100644 --- a/netclient/ncutils/netclientutils.go +++ b/netclient/ncutils/netclientutils.go @@ -62,6 +62,11 @@ const DEFAULT_GC_PERCENT = 10 // KEY_SIZE = ideal length for keys const KEY_SIZE = 2048 +// SetVersion -- set netclient version for use by other packages +func SetVersion(ver string) { + Version = ver +} + // Log - logs a message func Log(message string) { log.SetFlags(log.Flags() &^ (log.Llongfile | log.Lshortfile)) diff --git a/scripts/build-binaries.sh b/scripts/build-binaries.sh index f88d6116..baec2998 100755 --- a/scripts/build-binaries.sh +++ b/scripts/build-binaries.sh @@ -1,20 +1,20 @@ #!/bin/bash #server build -env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/servercfg/serverconf.Version=$VERSION'" -o netclient/build/netmaker main.go +env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o netclient/build/netmaker main.go cd netclient #client build -env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm5 main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm6 main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm7 main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm64 main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-mipsle main.go && upx build/netclient-mipsle -env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd main.go -env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm5 main.go -env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm6 main.go -env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm7 main.go -env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm64 main.go -env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-darwin main.go \ No newline at end of file +env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm5 main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm6 main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm7 main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm64 main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'main.version=$VERSION'" -o build/netclient-mipsle main.go && upx build/netclient-mipsle +env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd main.go +env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm5 main.go +env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm6 main.go +env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm7 main.go +env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm64 main.go +env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-darwin main.go diff --git a/servercfg/serverconf.go b/servercfg/serverconf.go index 50fb367b..fc9d8d0d 100644 --- a/servercfg/serverconf.go +++ b/servercfg/serverconf.go @@ -118,6 +118,11 @@ func GetAPIConnString() string { return conn } +// SetVersion - set version of netmaker +func SetVersion(v string) { + Version = v +} + // GetVersion - version of netmaker func GetVersion() string { return Version From 61193f4a9d11e4f7a2fbee70889a84404d62265c Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Wed, 9 Feb 2022 07:28:17 -0500 Subject: [PATCH 2/9] update workflow to use version number --- .github/workflows/buildandrelease.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/buildandrelease.yml b/.github/workflows/buildandrelease.yml index 99b253f3..042928fd 100644 --- a/.github/workflows/buildandrelease.yml +++ b/.github/workflows/buildandrelease.yml @@ -33,20 +33,20 @@ jobs: - name: Build run: | - env GOOS=linux GOARCH=amd64 go build -o build/netmaker main.go + env GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netmaker main.go cd netclient - env GOOS=linux GOARCH=amd64 go build -o build/netclient main.go - env GOOS=linux GOARCH=arm GOARM=5 go build -o build/netclient-arm5/netclient main.go - env GOOS=linux GOARCH=arm GOARM=6 go build -o build/netclient-arm6/netclient main.go - env GOOS=linux GOARCH=arm GOARM=7 go build -o build/netclient-arm7/netclient main.go - env GOOS=linux GOARCH=arm64 go build -o build/netclient-arm64/netclient main.go - env GOOS=linux GOARCH=mipsle go build -ldflags "-s -w" -o build/netclient-mipsle/netclient main.go && upx build/netclient-mipsle/netclient - env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o build/netclient-freebsd/netclient main.go - env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -o build/netclient-freebsd-arm5/netclient main.go - env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -o build/netclient-freebsd-arm6/netclient main.go - env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -o build/netclient-freebsd-arm7/netclient main.go - env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -o build/netclient-freebsd-arm64/netclient main.go - env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/netclient-darwin/netclient main.go + env GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient main.go + env GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm5/netclient main.go + env GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm6/netclient main.go + env GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm7/netclient main.go + env GOOS=linux GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm64/netclient main.go + env GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'main.version=$NETMAKER_VERSION'" -o build/netclient-mipsle/netclient main.go && upx build/netclient-mipsle/netclient + env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'main.Version=${NETMAKER_VERSION}'" -o build/netclient-freebsd/netclient main.go + env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm5/netclient main.go + env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm6/netclient main.go + env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm7/netclient main.go + env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm64/netclient main.go + env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-darwin/netclient main.go - name: Upload netmaker x86 to Release uses: svenstaro/upload-release-action@v2 From aa5ac68ac13b403f68f944b0779da3ca90c89a4d Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Thu, 10 Feb 2022 07:33:10 -0500 Subject: [PATCH 3/9] updates for netclient docker images --- docker/Dockerfile-netclient-multiarch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile-netclient-multiarch b/docker/Dockerfile-netclient-multiarch index 907bc8d5..7144c2a3 100644 --- a/docker/Dockerfile-netclient-multiarch +++ b/docker/Dockerfile-netclient-multiarch @@ -1,12 +1,13 @@ FROM gravitl/builder:latest as builder # add glib support daemon manager WORKDIR /app +ARG version COPY . . ENV GO111MODULE=auto -RUN GOOS=linux GOARCH=arm64 CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s" -o netclient-app netclient/main.go +RUN GOOS=linux CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s -X 'main.version=${TAG}'" -o netclient-app netclient/main.go WORKDIR /root/ From 4ab924af3e178927d7af8107fe89d191406b8e2c Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Tue, 8 Feb 2022 07:01:39 -0500 Subject: [PATCH 4/9] use main.version rather than subpackage variables --- main.go | 3 +++ netclient/main.go | 5 ++++- netclient/ncutils/netclientutils.go | 5 +++++ scripts/build-binaries.sh | 26 +++++++++++++------------- servercfg/serverconf.go | 5 +++++ 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/main.go b/main.go index 5b94ef20..48ce82eb 100644 --- a/main.go +++ b/main.go @@ -26,8 +26,11 @@ import ( "google.golang.org/grpc" ) +var version = "dev" + // Start DB Connection and start API Request Handler func main() { + servercfg.SetVersion(version) fmt.Println(models.RetrieveLogo()) // print the logo initialize() // initial db and grpc server setGarbageCollection() diff --git a/netclient/main.go b/netclient/main.go index e6d04867..54bc3538 100644 --- a/netclient/main.go +++ b/netclient/main.go @@ -13,11 +13,14 @@ import ( "github.com/urfave/cli/v2" ) +var version = "dev" + func main() { app := cli.NewApp() app.Name = "Netclient CLI" app.Usage = "Netmaker's netclient agent and CLI. Used to perform interactions with Netmaker server and set local WireGuard config." - app.Version = ncutils.Version + app.Version = version + ncutils.SetVersion(version) cliFlags := cli_options.GetFlags(ncutils.GetHostname()) app.Commands = cli_options.GetCommands(cliFlags[:]) diff --git a/netclient/ncutils/netclientutils.go b/netclient/ncutils/netclientutils.go index 380e247d..a3d0d054 100644 --- a/netclient/ncutils/netclientutils.go +++ b/netclient/ncutils/netclientutils.go @@ -73,6 +73,11 @@ const ( letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits ) +// SetVersion -- set netclient version for use by other packages +func SetVersion(ver string) { + Version = ver +} + // Log - logs a message func Log(message string) { log.SetFlags(log.Flags() &^ (log.Llongfile | log.Lshortfile)) diff --git a/scripts/build-binaries.sh b/scripts/build-binaries.sh index f88d6116..baec2998 100755 --- a/scripts/build-binaries.sh +++ b/scripts/build-binaries.sh @@ -1,20 +1,20 @@ #!/bin/bash #server build -env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/servercfg/serverconf.Version=$VERSION'" -o netclient/build/netmaker main.go +env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o netclient/build/netmaker main.go cd netclient #client build -env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm5 main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm6 main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm7 main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-arm64 main.go -env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-mipsle main.go && upx build/netclient-mipsle -env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd main.go -env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm5 main.go -env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm6 main.go -env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm7 main.go -env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-freebsd-arm64 main.go -env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'github.com/gravitl/netmaker/netclient/ncutils/netclientutils.Version=$VERSION'" -o build/netclient-darwin main.go \ No newline at end of file +env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm5 main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm6 main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm7 main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-arm64 main.go +env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'main.version=$VERSION'" -o build/netclient-mipsle main.go && upx build/netclient-mipsle +env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd main.go +env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm5 main.go +env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm6 main.go +env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm7 main.go +env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-freebsd-arm64 main.go +env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.version=$VERSION'" -o build/netclient-darwin main.go diff --git a/servercfg/serverconf.go b/servercfg/serverconf.go index 50fb367b..fc9d8d0d 100644 --- a/servercfg/serverconf.go +++ b/servercfg/serverconf.go @@ -118,6 +118,11 @@ func GetAPIConnString() string { return conn } +// SetVersion - set version of netmaker +func SetVersion(v string) { + Version = v +} + // GetVersion - version of netmaker func GetVersion() string { return Version From 83131c6066980ff4753889180fb7733e0e316c32 Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Wed, 9 Feb 2022 07:28:17 -0500 Subject: [PATCH 5/9] update workflow to use version number --- .github/workflows/buildandrelease.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/buildandrelease.yml b/.github/workflows/buildandrelease.yml index 99b253f3..042928fd 100644 --- a/.github/workflows/buildandrelease.yml +++ b/.github/workflows/buildandrelease.yml @@ -33,20 +33,20 @@ jobs: - name: Build run: | - env GOOS=linux GOARCH=amd64 go build -o build/netmaker main.go + env GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netmaker main.go cd netclient - env GOOS=linux GOARCH=amd64 go build -o build/netclient main.go - env GOOS=linux GOARCH=arm GOARM=5 go build -o build/netclient-arm5/netclient main.go - env GOOS=linux GOARCH=arm GOARM=6 go build -o build/netclient-arm6/netclient main.go - env GOOS=linux GOARCH=arm GOARM=7 go build -o build/netclient-arm7/netclient main.go - env GOOS=linux GOARCH=arm64 go build -o build/netclient-arm64/netclient main.go - env GOOS=linux GOARCH=mipsle go build -ldflags "-s -w" -o build/netclient-mipsle/netclient main.go && upx build/netclient-mipsle/netclient - env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o build/netclient-freebsd/netclient main.go - env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -o build/netclient-freebsd-arm5/netclient main.go - env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -o build/netclient-freebsd-arm6/netclient main.go - env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -o build/netclient-freebsd-arm7/netclient main.go - env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -o build/netclient-freebsd-arm64/netclient main.go - env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/netclient-darwin/netclient main.go + env GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient main.go + env GOOS=linux GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm5/netclient main.go + env GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm6/netclient main.go + env GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm7/netclient main.go + env GOOS=linux GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-arm64/netclient main.go + env GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -X 'main.version=$NETMAKER_VERSION'" -o build/netclient-mipsle/netclient main.go && upx build/netclient-mipsle/netclient + env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags="-X 'main.Version=${NETMAKER_VERSION}'" -o build/netclient-freebsd/netclient main.go + env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=5 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm5/netclient main.go + env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm6/netclient main.go + env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm7/netclient main.go + env CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-freebsd-arm64/netclient main.go + env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-X 'main.version=${NETMAKER_VERSION}'" -o build/netclient-darwin/netclient main.go - name: Upload netmaker x86 to Release uses: svenstaro/upload-release-action@v2 From 06430a69323494804b3072219f75efd6ece2974f Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Thu, 10 Feb 2022 07:33:10 -0500 Subject: [PATCH 6/9] updates for netclient docker images --- docker/Dockerfile-netclient-multiarch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile-netclient-multiarch b/docker/Dockerfile-netclient-multiarch index 907bc8d5..7144c2a3 100644 --- a/docker/Dockerfile-netclient-multiarch +++ b/docker/Dockerfile-netclient-multiarch @@ -1,12 +1,13 @@ FROM gravitl/builder:latest as builder # add glib support daemon manager WORKDIR /app +ARG version COPY . . ENV GO111MODULE=auto -RUN GOOS=linux GOARCH=arm64 CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s" -o netclient-app netclient/main.go +RUN GOOS=linux CGO_ENABLED=0 /usr/local/go/bin/go build -ldflags="-w -s -X 'main.version=${TAG}'" -o netclient-app netclient/main.go WORKDIR /root/ From afb27619d485a56edfcaf913cbbc09e03c2f69f1 Mon Sep 17 00:00:00 2001 From: "Matthew R. Kasun" Date: Thu, 10 Feb 2022 15:12:04 -0500 Subject: [PATCH 7/9] update Dockerfile to use main.version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index eadc7f43..81c87747 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ COPY . . ENV GO111MODULE=auto # RUN GOOS=linux CGO_ENABLED=1 go build -tags debug -ldflags="-s -X 'main.version=$version'" -o netmaker main.go -RUN GOOS=linux CGO_ENABLED=1 go build -ldflags="-s -X 'github.com/gravitl/netmaker/servercfg/serverconf.Version=$VERSION'" -o netmaker main.go +RUN GOOS=linux CGO_ENABLED=1 go build -ldflags="-s -X 'main.version=$VERSION'" -o netmaker main.go FROM alpine:3.14.3 # add a c lib From 36cb6969ebfb40597289501c7f52f656c16939d0 Mon Sep 17 00:00:00 2001 From: Chay Choong Date: Fri, 11 Feb 2022 10:12:01 +0800 Subject: [PATCH 8/9] docs: fix wrong path --- docs/_build/html/_sources/client-installation.rst.txt | 2 +- docs/client-installation.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_build/html/_sources/client-installation.rst.txt b/docs/_build/html/_sources/client-installation.rst.txt index a3752b7c..033ecdb4 100644 --- a/docs/_build/html/_sources/client-installation.rst.txt +++ b/docs/_build/html/_sources/client-installation.rst.txt @@ -185,7 +185,7 @@ If the daemon is not running correctly run, try restarting the daemon, or pullin Making Updates ---------------- -``vim /etc/netclient/netconfig-`` +``vim /etc/netclient/config/netconfig-`` Change any of the variables in this file, and changes will be pushed to the server and processed locally on the next checkin. diff --git a/docs/client-installation.rst b/docs/client-installation.rst index a3752b7c..033ecdb4 100644 --- a/docs/client-installation.rst +++ b/docs/client-installation.rst @@ -185,7 +185,7 @@ If the daemon is not running correctly run, try restarting the daemon, or pullin Making Updates ---------------- -``vim /etc/netclient/netconfig-`` +``vim /etc/netclient/config/netconfig-`` Change any of the variables in this file, and changes will be pushed to the server and processed locally on the next checkin. From c7a3c4890c56c6f2f45036ec0251a957b5b424d2 Mon Sep 17 00:00:00 2001 From: lianlian Date: Fri, 11 Feb 2022 12:17:21 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netclient/cli_options/flags.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netclient/cli_options/flags.go b/netclient/cli_options/flags.go index 64995bdf..1a42b99b 100644 --- a/netclient/cli_options/flags.go +++ b/netclient/cli_options/flags.go @@ -110,13 +110,13 @@ func GetFlags(hostname string) []cli.Flag { Name: "apiserver", EnvVars: []string{"NETCLIENT_API_SERVER"}, Value: "", - Usage: "Address + GRPC Port (e.g. 1.2.3.4:50051) of Netmaker server.", + Usage: "Address + API Port (e.g. 1.2.3.4:8081) of Netmaker server.", }, &cli.StringFlag{ Name: "grpcserver", EnvVars: []string{"NETCLIENT_GRPC_SERVER"}, Value: "", - Usage: "Address + API Port (e.g. 1.2.3.4:8081) of Netmaker server.", + Usage: "Address + GRPC Port (e.g. 1.2.3.4:50051) of Netmaker server.", }, &cli.StringFlag{ Name: "grpcssl",