mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-08 22:03:29 +02:00
cli: add version command (#1726)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
ea4e9fa3aa
commit
e56e7e4b9e
4 changed files with 32 additions and 11 deletions
18
Makefile
18
Makefile
|
@ -2,7 +2,7 @@
|
||||||
PREFIX?=$(shell pwd)
|
PREFIX?=$(shell pwd)
|
||||||
|
|
||||||
NAME := pomerium
|
NAME := pomerium
|
||||||
PKG := github.com/pomerium/$(NAME)
|
PKG := github.com/pomerium/pomerium
|
||||||
|
|
||||||
BUILDDIR := ${PREFIX}/dist
|
BUILDDIR := ${PREFIX}/dist
|
||||||
BINDIR := ${PREFIX}/bin
|
BINDIR := ${PREFIX}/bin
|
||||||
|
@ -13,7 +13,7 @@ BUILDTAGS :=
|
||||||
|
|
||||||
# Populate version variables
|
# Populate version variables
|
||||||
# Add to compile time flags
|
# Add to compile time flags
|
||||||
VERSION := $(shell cat VERSION)
|
VERSION := $(shell git describe --abbrev=0 --tags)
|
||||||
GITCOMMIT := $(shell git rev-parse --short HEAD)
|
GITCOMMIT := $(shell git rev-parse --short HEAD)
|
||||||
BUILDMETA:=
|
BUILDMETA:=
|
||||||
GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
|
GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
|
||||||
|
@ -33,9 +33,9 @@ GOOS = $(shell $(GO) env GOOS)
|
||||||
GOARCH= $(shell $(GO) env GOARCH)
|
GOARCH= $(shell $(GO) env GOARCH)
|
||||||
MISSPELL_VERSION = v0.3.4
|
MISSPELL_VERSION = v0.3.4
|
||||||
GOLANGCI_VERSION = v1.21.0
|
GOLANGCI_VERSION = v1.21.0
|
||||||
OPA_VERSION = v0.21.0
|
OPA_VERSION = v0.25.2
|
||||||
GETENVOY_VERSION = v0.1.8
|
GETENVOY_VERSION = v0.2.0
|
||||||
|
GORELEASER_VERSION = v0.150.0
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: clean build-deps test lint spellcheck build ## Runs a clean, build, fmt, lint, test, and vet.
|
all: clean build-deps test lint spellcheck build ## Runs a clean, build, fmt, lint, test, and vet.
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ build-deps: ## Install build dependencies
|
||||||
@cd /tmp; GO111MODULE=on $(GO) get github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_VERSION}
|
@cd /tmp; GO111MODULE=on $(GO) get github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_VERSION}
|
||||||
@cd /tmp; GO111MODULE=on $(GO) get github.com/open-policy-agent/opa@${OPA_VERSION}
|
@cd /tmp; GO111MODULE=on $(GO) get github.com/open-policy-agent/opa@${OPA_VERSION}
|
||||||
@cd /tmp; GO111MODULE=on $(GO) get github.com/tetratelabs/getenvoy/cmd/getenvoy@${GETENVOY_VERSION}
|
@cd /tmp; GO111MODULE=on $(GO) get github.com/tetratelabs/getenvoy/cmd/getenvoy@${GETENVOY_VERSION}
|
||||||
|
@cd /tmp; GO111MODULE=on $(GO) get github.com/goreleaser/goreleaser@${GORELEASER_VERSION}
|
||||||
|
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
docs: ## Start the vuepress docs development server
|
docs: ## Start the vuepress docs development server
|
||||||
|
@ -115,11 +116,10 @@ clean: ## Cleanup any build binaries or packages.
|
||||||
$(RM) -r $(BINDIR)
|
$(RM) -r $(BINDIR)
|
||||||
$(RM) -r $(BUILDDIR)
|
$(RM) -r $(BUILDDIR)
|
||||||
|
|
||||||
.PHONY: release
|
.PHONY: snapshot
|
||||||
snapshot: ## Builds the cross-compiled binaries, naming them in such a way for release (eg. binary-GOOS-GOARCH)
|
snapshot: ## Builds the cross-compiled binaries, naming them in such a way for release (eg. binary-GOOS-GOARCH)
|
||||||
@echo "+ $@"
|
@echo "==> $@"
|
||||||
@cd /tmp; GO111MODULE=on $(GO) get github.com/goreleaser/goreleaser
|
@goreleaser release --rm-dist -f .github/goreleaser.yaml --snapshot
|
||||||
goreleaser release --rm-dist -f .github/goreleaser.yaml --snapshot
|
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
|
|
1
VERSION
1
VERSION
|
@ -1 +0,0 @@
|
||||||
v0.10.0
|
|
22
cmd/pomerium-cli/version.go
Normal file
22
cmd/pomerium-cli/version.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/pomerium/pomerium/internal/version"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(versionCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
var versionCmd = &cobra.Command{
|
||||||
|
Use: "version",
|
||||||
|
Short: "version",
|
||||||
|
Long: `Print the cli version.`,
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
fmt.Println(version.FullVersion())
|
||||||
|
},
|
||||||
|
}
|
|
@ -124,7 +124,7 @@ brew install pomerium-cli
|
||||||
```shell
|
```shell
|
||||||
git clone git@github.com:pomerium/pomerium.git
|
git clone git@github.com:pomerium/pomerium.git
|
||||||
cd pomerium
|
cd pomerium
|
||||||
make
|
make build NAME=pomerium-cli
|
||||||
./bin/pomerium-cli --help
|
./bin/pomerium-cli --help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue