Merge pull request #743 from gravitl/v0.10.0

V0.10.0
This commit is contained in:
dcarns 2022-02-11 18:50:44 -05:00 committed by GitHub
commit 3ce6d1a343
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 50 additions and 33 deletions

View file

@ -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

View file

@ -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

View file

@ -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/

View file

@ -185,7 +185,7 @@ If the daemon is not running correctly run, try restarting the daemon, or pullin
Making Updates
----------------
``vim /etc/netclient/netconfig-<network>``
``vim /etc/netclient/config/netconfig-<network>``
Change any of the variables in this file, and changes will be pushed to the server and processed locally on the next checkin.

View file

@ -185,7 +185,7 @@ If the daemon is not running correctly run, try restarting the daemon, or pullin
Making Updates
----------------
``vim /etc/netclient/netconfig-<network>``
``vim /etc/netclient/config/netconfig-<network>``
Change any of the variables in this file, and changes will be pushed to the server and processed locally on the next checkin.

View file

@ -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()

View file

@ -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",

View file

@ -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[:])

View file

@ -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))

View file

@ -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
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

View file

@ -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