diff --git a/.goreleaser-snapshot.yml b/.goreleaser-snapshot.yml index 742110852..a514c952d 100644 --- a/.goreleaser-snapshot.yml +++ b/.goreleaser-snapshot.yml @@ -27,12 +27,12 @@ builds: - -trimpath ldflags: - -extldflags "-static" - - -X github.com/kolide/kit/version.appName={{ .ArtifactName }} - - -X github.com/kolide/kit/version.version={{ .Version }} - - -X github.com/kolide/kit/version.branch={{ .Branch }} - - -X github.com/kolide/kit/version.revision={{ .FullCommit }} - - -X github.com/kolide/kit/version.buildDate={{ time "2006-01-02" }} - - -X github.com/kolide/kit/version.buildUser={{ .Env.USER }} + - -X github.com/fleetdm/fleet/v4/server/version.appName={{ .ArtifactName }} + - -X github.com/fleetdm/fleet/v4/server/version.version={{ .Version }} + - -X github.com/fleetdm/fleet/v4/server/version.branch={{ .Branch }} + - -X github.com/fleetdm/fleet/v4/server/version.revision={{ .FullCommit }} + - -X github.com/fleetdm/fleet/v4/server/version.buildDate={{ time "2006-01-02" }} + - -X github.com/fleetdm/fleet/v4/server/version.buildUser={{ .Env.USER }} - id: fleetctl dir: ./cmd/fleetctl/ @@ -46,12 +46,12 @@ builds: flags: - -trimpath ldflags: - - -X github.com/kolide/kit/version.appName={{ .ArtifactName }} - - -X github.com/kolide/kit/version.version={{ .Version }} - - -X github.com/kolide/kit/version.branch={{ .Branch }} - - -X github.com/kolide/kit/version.revision={{ .FullCommit }} - - -X github.com/kolide/kit/version.buildDate={{ time "2006-01-02" }} - - -X github.com/kolide/kit/version.buildUser={{ .Env.USER }} + - -X github.com/fleetdm/fleet/v4/server/version.appName={{ .ArtifactName }} + - -X github.com/fleetdm/fleet/v4/server/version.version={{ .Version }} + - -X github.com/fleetdm/fleet/v4/server/version.branch={{ .Branch }} + - -X github.com/fleetdm/fleet/v4/server/version.revision={{ .FullCommit }} + - -X github.com/fleetdm/fleet/v4/server/version.buildDate={{ time "2006-01-02" }} + - -X github.com/fleetdm/fleet/v4/server/version.buildUser={{ .Env.USER }} dockers: diff --git a/.goreleaser.yml b/.goreleaser.yml index e7cc4a6e4..e36fcc39c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -27,12 +27,12 @@ builds: - -trimpath ldflags: - -extldflags "-static" - - -X github.com/kolide/kit/version.appName={{ .ArtifactName }} - - -X github.com/kolide/kit/version.version={{ .Version }} - - -X github.com/kolide/kit/version.branch={{ .Branch }} - - -X github.com/kolide/kit/version.revision={{ .FullCommit }} - - -X github.com/kolide/kit/version.buildDate={{ time "2006-01-02" }} - - -X github.com/kolide/kit/version.buildUser={{ .Env.USER }} + - -X github.com/fleetdm/fleet/v4/server/version.appName={{ .ArtifactName }} + - -X github.com/fleetdm/fleet/v4/server/version.version={{ .Version }} + - -X github.com/fleetdm/fleet/v4/server/version.branch={{ .Branch }} + - -X github.com/fleetdm/fleet/v4/server/version.revision={{ .FullCommit }} + - -X github.com/fleetdm/fleet/v4/server/version.buildDate={{ time "2006-01-02" }} + - -X github.com/fleetdm/fleet/v4/server/version.buildUser={{ .Env.USER }} - id: fleetctl dir: ./cmd/fleetctl/ @@ -48,12 +48,12 @@ builds: flags: - -trimpath ldflags: - - -X github.com/kolide/kit/version.appName={{ .ArtifactName }} - - -X github.com/kolide/kit/version.version={{ .Version }} - - -X github.com/kolide/kit/version.branch={{ .Branch }} - - -X github.com/kolide/kit/version.revision={{ .FullCommit }} - - -X github.com/kolide/kit/version.buildDate={{ time "2006-01-02" }} - - -X github.com/kolide/kit/version.buildUser={{ .Env.USER }} + - -X github.com/fleetdm/fleet/v4/server/version.appName={{ .ArtifactName }} + - -X github.com/fleetdm/fleet/v4/server/version.version={{ .Version }} + - -X github.com/fleetdm/fleet/v4/server/version.branch={{ .Branch }} + - -X github.com/fleetdm/fleet/v4/server/version.revision={{ .FullCommit }} + - -X github.com/fleetdm/fleet/v4/server/version.buildDate={{ time "2006-01-02" }} + - -X github.com/fleetdm/fleet/v4/server/version.buildUser={{ .Env.USER }} archives: - id: fleet diff --git a/Makefile b/Makefile index 02a5d921b..49b343b44 100644 --- a/Makefile +++ b/Makefile @@ -54,14 +54,14 @@ ifdef CIRCLE_TAG DOCKER_IMAGE_TAG = ${CIRCLE_TAG} endif -KIT_VERSION = "\ - -X github.com/kolide/kit/version.appName=${APP_NAME} \ - -X github.com/kolide/kit/version.version=${VERSION} \ - -X github.com/kolide/kit/version.branch=${BRANCH} \ - -X github.com/kolide/kit/version.revision=${REVISION} \ - -X github.com/kolide/kit/version.buildDate=${NOW} \ - -X github.com/kolide/kit/version.buildUser=${USER} \ - -X github.com/kolide/kit/version.goVersion=${GOVERSION}" +LDFLAGS_VERSION = "\ + -X github.com/fleetdm/fleet/v4/server/version.appName=${APP_NAME} \ + -X github.com/fleetdm/fleet/v4/server/version.version=${VERSION} \ + -X github.com/fleetdm/fleet/v4/server/version.branch=${BRANCH} \ + -X github.com/fleetdm/fleet/v4/server/version.revision=${REVISION} \ + -X github.com/fleetdm/fleet/v4/server/version.buildDate=${NOW} \ + -X github.com/fleetdm/fleet/v4/server/version.buildUser=${USER} \ + -X github.com/fleetdm/fleet/v4/server/version.goVersion=${GOVERSION}" all: build @@ -113,7 +113,7 @@ help: build: fleet fleetctl fleet: .prefix .pre-build .pre-fleet - CGO_ENABLED=1 go build -race=${GO_BUILD_RACE_ENABLED_VAR} -tags full,fts5,netgo -o build/${OUTPUT} -ldflags ${KIT_VERSION} ./cmd/fleet + CGO_ENABLED=1 go build -race=${GO_BUILD_RACE_ENABLED_VAR} -tags full,fts5,netgo -o build/${OUTPUT} -ldflags ${LDFLAGS_VERSION} ./cmd/fleet fleet-dev: GO_BUILD_RACE_ENABLED_VAR=true fleet-dev: fleet @@ -121,7 +121,7 @@ fleet-dev: fleet fleetctl: .prefix .pre-build .pre-fleetctl # Race requires cgo $(eval CGO_ENABLED := $(shell [[ "${GO_BUILD_RACE_ENABLED_VAR}" = "true" ]] && echo 1 || echo 0)) - CGO_ENABLED=${CGO_ENABLED} go build -race=${GO_BUILD_RACE_ENABLED_VAR} -o build/fleetctl -ldflags ${KIT_VERSION} ./cmd/fleetctl + CGO_ENABLED=${CGO_ENABLED} go build -race=${GO_BUILD_RACE_ENABLED_VAR} -o build/fleetctl -ldflags ${LDFLAGS_VERSION} ./cmd/fleetctl fleetctl-dev: GO_BUILD_RACE_ENABLED_VAR=true fleetctl-dev: fleetctl @@ -228,14 +228,14 @@ fleetctl-docker: xp-fleetctl mkdir -p build/binary-bundle/darwin xp-fleet: .pre-binary-bundle .pre-fleet generate - CGO_ENABLED=1 GOOS=linux go build -tags full,fts5,netgo -trimpath -o build/binary-bundle/linux/fleet -ldflags ${KIT_VERSION} ./cmd/fleet - CGO_ENABLED=1 GOOS=darwin go build -tags full,fts5,netgo -trimpath -o build/binary-bundle/darwin/fleet -ldflags ${KIT_VERSION} ./cmd/fleet - CGO_ENABLED=1 GOOS=windows go build -tags full,fts5,netgo -trimpath -o build/binary-bundle/windows/fleet.exe -ldflags ${KIT_VERSION} ./cmd/fleet + CGO_ENABLED=1 GOOS=linux go build -tags full,fts5,netgo -trimpath -o build/binary-bundle/linux/fleet -ldflags ${LDFLAGS_VERSION} ./cmd/fleet + CGO_ENABLED=1 GOOS=darwin go build -tags full,fts5,netgo -trimpath -o build/binary-bundle/darwin/fleet -ldflags ${LDFLAGS_VERSION} ./cmd/fleet + CGO_ENABLED=1 GOOS=windows go build -tags full,fts5,netgo -trimpath -o build/binary-bundle/windows/fleet.exe -ldflags ${LDFLAGS_VERSION} ./cmd/fleet xp-fleetctl: .pre-binary-bundle .pre-fleetctl generate-go - CGO_ENABLED=0 GOOS=linux go build -trimpath -o build/binary-bundle/linux/fleetctl -ldflags ${KIT_VERSION} ./cmd/fleetctl - CGO_ENABLED=0 GOOS=darwin go build -trimpath -o build/binary-bundle/darwin/fleetctl -ldflags ${KIT_VERSION} ./cmd/fleetctl - CGO_ENABLED=0 GOOS=windows go build -trimpath -o build/binary-bundle/windows/fleetctl.exe -ldflags ${KIT_VERSION} ./cmd/fleetctl + CGO_ENABLED=0 GOOS=linux go build -trimpath -o build/binary-bundle/linux/fleetctl -ldflags ${LDFLAGS_VERSION} ./cmd/fleetctl + CGO_ENABLED=0 GOOS=darwin go build -trimpath -o build/binary-bundle/darwin/fleetctl -ldflags ${LDFLAGS_VERSION} ./cmd/fleetctl + CGO_ENABLED=0 GOOS=windows go build -trimpath -o build/binary-bundle/windows/fleetctl.exe -ldflags ${LDFLAGS_VERSION} ./cmd/fleetctl binary-bundle: xp-fleet xp-fleetctl cd build/binary-bundle && zip -r fleet.zip darwin/ linux/ windows/ @@ -273,8 +273,8 @@ endif binary-arch: .pre-binary-arch .pre-binary-bundle .pre-fleet mkdir -p build/binary-bundle/${GOARCH}-${GOOS} - CGO_ENABLED=1 GOARCH=${GOARCH} GOOS=${GOOS} go build -tags full,fts5,netgo -o build/binary-bundle/${GOARCH}-${GOOS}/fleet -ldflags ${KIT_VERSION} ./cmd/fleet - CGO_ENABLED=0 GOARCH=${GOARCH} GOOS=${GOOS} go build -tags full,fts5,netgo -o build/binary-bundle/${GOARCH}-${GOOS}/fleetctl -ldflags ${KIT_VERSION} ./cmd/fleetctl + CGO_ENABLED=1 GOARCH=${GOARCH} GOOS=${GOOS} go build -tags full,fts5,netgo -o build/binary-bundle/${GOARCH}-${GOOS}/fleet -ldflags ${LDFLAGS_VERSION} ./cmd/fleet + CGO_ENABLED=0 GOARCH=${GOARCH} GOOS=${GOOS} go build -tags full,fts5,netgo -o build/binary-bundle/${GOARCH}-${GOOS}/fleetctl -ldflags ${LDFLAGS_VERSION} ./cmd/fleetctl cd build/binary-bundle/${GOARCH}-${GOOS} && tar -czf fleetctl-${GOARCH}-${GOOS}.tar.gz fleetctl fleet diff --git a/cmd/fleet/serve.go b/cmd/fleet/serve.go index 4d547a1ab..f179fc6ad 100644 --- a/cmd/fleet/serve.go +++ b/cmd/fleet/serve.go @@ -46,12 +46,12 @@ import ( "github.com/fleetdm/fleet/v4/server/service/async" "github.com/fleetdm/fleet/v4/server/service/redis_policy_set" "github.com/fleetdm/fleet/v4/server/sso" + "github.com/fleetdm/fleet/v4/server/version" "github.com/getsentry/sentry-go" kitlog "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" kitprometheus "github.com/go-kit/kit/metrics/prometheus" "github.com/go-kit/log" - "github.com/kolide/kit/version" "github.com/micromdm/nanomdm/cryptoutil" "github.com/micromdm/nanomdm/push" "github.com/micromdm/nanomdm/push/buford" diff --git a/cmd/fleet/version.go b/cmd/fleet/version.go index 68829a201..6dad27385 100644 --- a/cmd/fleet/version.go +++ b/cmd/fleet/version.go @@ -2,7 +2,7 @@ package main import ( "github.com/fleetdm/fleet/v4/server/config" - "github.com/kolide/kit/version" + "github.com/fleetdm/fleet/v4/server/version" "github.com/spf13/cobra" ) @@ -11,7 +11,7 @@ func createVersionCmd(configManager config.Manager) *cobra.Command { var ( fFull bool ) - var versionCmd = &cobra.Command{ + versionCmd := &cobra.Command{ Use: "version", Short: "Print Fleet version", Long: ` diff --git a/cmd/fleetctl/api.go b/cmd/fleetctl/api.go index 7449855c1..a72275539 100644 --- a/cmd/fleetctl/api.go +++ b/cmd/fleetctl/api.go @@ -15,8 +15,8 @@ import ( "github.com/fleetdm/fleet/v4/pkg/fleethttp" "github.com/fleetdm/fleet/v4/server/fleet" "github.com/fleetdm/fleet/v4/server/service" + "github.com/fleetdm/fleet/v4/server/version" kithttp "github.com/go-kit/kit/transport/http" - "github.com/kolide/kit/version" "github.com/urfave/cli/v2" ) diff --git a/cmd/fleetctl/fleetctl.go b/cmd/fleetctl/fleetctl.go index 7599ed13f..6bfa82820 100644 --- a/cmd/fleetctl/fleetctl.go +++ b/cmd/fleetctl/fleetctl.go @@ -12,7 +12,7 @@ import ( "time" eefleetctl "github.com/fleetdm/fleet/v4/ee/fleetctl" - "github.com/kolide/kit/version" + "github.com/fleetdm/fleet/v4/server/version" "github.com/urfave/cli/v2" ) diff --git a/go.mod b/go.mod index dd036cddd..4ad514186 100644 --- a/go.mod +++ b/go.mod @@ -56,7 +56,6 @@ require ( github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5 github.com/josephspurrier/goversioninfo v1.4.0 github.com/kevinburke/go-bindata v3.24.0+incompatible - github.com/kolide/kit v0.0.0-20221107170827-fb85e3d59eab github.com/kolide/launcher v1.0.12 github.com/lib/pq v1.10.9 github.com/macadmins/osquery-extension v0.0.15 @@ -251,6 +250,7 @@ require ( github.com/jonboulle/clockwork v0.2.2 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/klauspost/compress v1.16.5 // indirect + github.com/kolide/kit v0.0.0-20221107170827-fb85e3d59eab // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.5 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -325,8 +325,6 @@ require ( gotest.tools/v3 v3.0.3 // indirect ) -replace github.com/kolide/kit => github.com/fleetdm/kolide-kit v0.0.0-20230519160117-86cc9441f9c1 - replace github.com/micromdm/nanomdm => github.com/fleetdm/nanomdm v0.3.1-0.20230710170238-fd0813187f24 replace github.com/micromdm/nanodep => github.com/fleetdm/nanodep v0.1.1-0.20221221202251-71b67ab1da24 diff --git a/go.sum b/go.sum index 0d8e270c1..a8ce610c1 100644 --- a/go.sum +++ b/go.sum @@ -445,8 +445,6 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fleetdm/kolide-kit v0.0.0-20230519160117-86cc9441f9c1 h1:9JGbRO6QKpHr5HO5t6g3/5EspV5eDWaLKbRH7xKqL/c= -github.com/fleetdm/kolide-kit v0.0.0-20230519160117-86cc9441f9c1/go.mod h1:HHtqF91JHl66L+Ms8aswzqVb2eEU5O3DRNiFmUzOf60= github.com/fleetdm/nanodep v0.1.1-0.20221221202251-71b67ab1da24 h1:XhczaxKV3J4NjztroidSnYKyq5xtxF+amBYdBWeik58= github.com/fleetdm/nanodep v0.1.1-0.20221221202251-71b67ab1da24/go.mod h1:QzQrCUTmSr9HotzKZAcfmy+czbEGK8Mq26hA+0DN4ag= github.com/fleetdm/nanomdm v0.3.1-0.20230710170238-fd0813187f24 h1:oP0kOAFDzu646/TXDCcvOGdDgSHJgk+X0Pfr60kp7Jg= @@ -494,6 +492,7 @@ github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.4.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.7.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= @@ -523,10 +522,12 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.6.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.7.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU= github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM= @@ -665,6 +666,7 @@ github.com/google/rpmpack v0.0.0-20210518075352-dc539ef4f2ea/go.mod h1:+y9lKiqDh github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -798,6 +800,7 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/jmoiron/sqlx v0.0.0-20180406164412-2aeb6a910c2b/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU= github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5 h1:lrdPtrORjGv1HbbEvKWDUAy97mPpFm4B8hp77tcCUJY= github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4= @@ -834,6 +837,8 @@ github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47e github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/kolide/kit v0.0.0-20221107170827-fb85e3d59eab h1:KVR7cs+oPyy85i+8t1ZaNSy1bymCy5FuWyt51pdrXu4= +github.com/kolide/kit v0.0.0-20221107170827-fb85e3d59eab/go.mod h1:OYYulo9tUqRadRLwB0+LE914sa1ui2yL7OrcU3Q/1XY= github.com/kolide/launcher v1.0.12 h1:f2uT1kKYGIbj/WVsHDc10f7MIiwu8MpmgwaGaT7D09k= github.com/kolide/launcher v1.0.12/go.mod h1:j854Q4LqMXi3DQ+fnDy8Ij4uuKRG707ulWOcIz7BCz4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -896,6 +901,7 @@ github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.13 h1:1tj15ngiFfcZzii7yd82foL+ks+ouQcj8j/TPq3fk1I= github.com/mattn/go-sqlite3 v1.14.13/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= @@ -960,6 +966,7 @@ github.com/nukosuke/go-zendesk v0.13.1 h1:EdYpn+FxROLguADEJK5reOHcpysM8wyWPOWO96 github.com/nukosuke/go-zendesk v0.13.1/go.mod h1:86Cg7RhSvPfOqZOtQXteJEV9yIQVQsy2HVDk++Yf3jA= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/oklog/ulid v0.3.0/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= @@ -971,6 +978,7 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/open-policy-agent/opa v0.44.0 h1:sEZthsrWBqIN+ShTMJ0Hcz6a3GkYsY4FaB2S/ou2hZk= github.com/open-policy-agent/opa v0.44.0/go.mod h1:YpJaFIk5pq89n/k72c1lVvfvR5uopdJft2tMg1CW/yU= +github.com/opencensus-integrations/ocsql v0.1.1/go.mod h1:ozPYpNVBHZsX33jfoQPO5TlI5lqh0/3R36kirEqJKAM= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= @@ -1142,6 +1150,7 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -1250,6 +1259,7 @@ go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352/go.mod h1:SNgMg+EgDFwmvS go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -1389,6 +1399,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1497,6 +1508,7 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1738,6 +1750,7 @@ google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= diff --git a/server/datastore/mysql/statistics.go b/server/datastore/mysql/statistics.go index 85af770b1..4277ff73c 100644 --- a/server/datastore/mysql/statistics.go +++ b/server/datastore/mysql/statistics.go @@ -10,9 +10,9 @@ import ( "github.com/fleetdm/fleet/v4/server/contexts/ctxerr" "github.com/fleetdm/fleet/v4/server/contexts/license" "github.com/fleetdm/fleet/v4/server/fleet" + "github.com/fleetdm/fleet/v4/server/version" "github.com/go-kit/kit/log/level" "github.com/jmoiron/sqlx" - "github.com/kolide/kit/version" ) type statistics struct { diff --git a/server/fleet/service.go b/server/fleet/service.go index 76b174f92..c8f314a86 100644 --- a/server/fleet/service.go +++ b/server/fleet/service.go @@ -7,8 +7,8 @@ import ( "io" "time" + "github.com/fleetdm/fleet/v4/server/version" "github.com/fleetdm/fleet/v4/server/websocket" - "github.com/kolide/kit/version" ) // EnterpriseOverrides contains the methods that can be overriden by the diff --git a/server/service/appconfig.go b/server/service/appconfig.go index 98a6ab9f7..c33890a21 100644 --- a/server/service/appconfig.go +++ b/server/service/appconfig.go @@ -23,8 +23,8 @@ import ( "github.com/fleetdm/fleet/v4/server/contexts/license" "github.com/fleetdm/fleet/v4/server/contexts/viewer" "github.com/fleetdm/fleet/v4/server/fleet" + "github.com/fleetdm/fleet/v4/server/version" "github.com/go-kit/kit/log/level" - "github.com/kolide/kit/version" ) //////////////////////////////////////////////////////////////////////////////// diff --git a/server/service/client_appconfig.go b/server/service/client_appconfig.go index 5e53717fa..597aa7595 100644 --- a/server/service/client_appconfig.go +++ b/server/service/client_appconfig.go @@ -2,7 +2,7 @@ package service import ( "github.com/fleetdm/fleet/v4/server/fleet" - "github.com/kolide/kit/version" + "github.com/fleetdm/fleet/v4/server/version" ) // ApplyAppConfig sends the application config to be applied to the Fleet instance. diff --git a/server/version/version.go b/server/version/version.go new file mode 100644 index 000000000..21d6ae36d --- /dev/null +++ b/server/version/version.go @@ -0,0 +1,91 @@ +/* +Package version provides utilities for displaying version information about a Go application. + +To use this package, a program would set the package variables at build time, using the +-ldflags go build flag. + +Example: + + go build -ldflags "-X github.com/fleetdm/fleet/v4/server/version.version=1.0.0" + +Available values and defaults to use with ldflags: + + version = "unknown" + branch = "unknown" + revision = "unknown" + goVersion = "unknown" + buildDate = "unknown" + buildUser = "unknown" + appName = "unknown" + +This file was copied (on December 2023) from https://github.com/fleetdm/kolide-kit, which is a fork of https://github.com/kolide/kit. +*/ +package version + +import ( + "encoding/json" + "fmt" + "net/http" + "runtime" +) + +// These values are private which ensures they can only be set with the build flags. +var ( + version = "unknown" + branch = "unknown" + revision = "unknown" + goVersion = runtime.Version() + buildDate = "unknown" + buildUser = "unknown" + appName = "unknown" +) + +// Info is a structure with version build information about the current application. +type Info struct { + Version string `json:"version"` + Branch string `json:"branch"` + Revision string `json:"revision"` + GoVersion string `json:"go_version"` + BuildDate string `json:"build_date"` + BuildUser string `json:"build_user"` +} + +// Version returns a structure with the current version information. +func Version() Info { + return Info{ + Version: version, + Branch: branch, + Revision: revision, + GoVersion: goVersion, + BuildDate: buildDate, + BuildUser: buildUser, + } +} + +// Print outputs the application name and version string. +func Print() { + v := Version() + fmt.Printf("%s version %s\n", appName, v.Version) +} + +// PrintFull prints the application name and detailed version information. +func PrintFull() { + v := Version() + fmt.Printf("%s - version %s\n", appName, v.Version) + fmt.Printf(" branch: \t%s\n", v.Branch) + fmt.Printf(" revision: \t%s\n", v.Revision) + fmt.Printf(" build date: \t%s\n", v.BuildDate) + fmt.Printf(" build user: \t%s\n", v.BuildUser) + fmt.Printf(" go version: \t%s\n", v.GoVersion) +} + +// Handler returns an HTTP Handler which returns JSON formatted version information. +func Handler() http.Handler { + v := Version() + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + enc := json.NewEncoder(w) + enc.SetIndent("", " ") + enc.Encode(v) //nolint:errcheck + }) +} diff --git a/tools/desktop/desktop.go b/tools/desktop/desktop.go index fdddc257b..e88d6bd36 100644 --- a/tools/desktop/desktop.go +++ b/tools/desktop/desktop.go @@ -16,7 +16,7 @@ import ( "github.com/fleetdm/fleet/v4/orbit/pkg/packaging" "github.com/fleetdm/fleet/v4/pkg/buildpkg" "github.com/fleetdm/fleet/v4/pkg/secure" - "github.com/kolide/kit/version" + "github.com/fleetdm/fleet/v4/server/version" "github.com/mitchellh/gon/package/zip" "github.com/rs/zerolog" zlog "github.com/rs/zerolog/log"