Skip to content

Commit

Permalink
Drop configure script in favour of native Makefile env and checks (oa…
Browse files Browse the repository at this point in the history
…uth2-proxy#515)

Co-authored-by: Henry Jenkins <[email protected]>
  • Loading branch information
JoelSpeed and steakunderscore authored May 9, 2020
1 parent 9ed5a43 commit 07df29d
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.24.0
- GO111MODULE=on go mod download
script:
- ./configure && make test
- make test
sudo: false
notifications:
email: false
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

## Changes since v5.1.1

- [#515](https://github.com/oauth2-proxy/oauth2-proxy/pull/515) Drop configure script in favour of native Makefile env and checks (@JoelSpeed)
- [#487](https://github.com/oauth2-proxy/oauth2-proxy/pull/487) Switch flags to PFlag to remove StringArray (@JoelSpeed)
- [#484](https://github.com/oauth2-proxy/oauth2-proxy/pull/484) Replace configuration loading with Viper (@JoelSpeed)
- [#499](https://github.com/oauth2-proxy/oauth2-proxy/pull/499) Add `-user-id-claim` to support generic claims in addition to email (@holyjak)
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Download the dependencies using `go mod download`.
cd $GOPATH/src/github.com # Create this directory if it doesn't exist
git clone [email protected]:<YOUR_FORK>/oauth2-proxy oauth2-proxy/oauth2-proxy
cd oauth2-proxy/oauth2-proxy
./configure # Setup your environment variables
go mod download
```

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ COPY . .
# build the key into the container and then tell it where it is
# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
# in app.yaml instead.
RUN ./configure && make build && touch jwt_signing_key.pem
RUN make build && touch jwt_signing_key.pem

# Copy binary to alpine
FROM alpine:3.11
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ COPY . .
# build the key into the container and then tell it where it is
# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
# in app.yaml instead.
RUN ./configure && GOARCH=arm64 make build && touch jwt_signing_key.pem
RUN GOARCH=arm64 make build && touch jwt_signing_key.pem

# Copy binary to alpine
FROM arm64v8/alpine:3.11
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.armv6
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ COPY . .
# build the key into the container and then tell it where it is
# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
# in app.yaml instead.
RUN ./configure && GOARCH=arm GOARM=6 make build && touch jwt_signing_key.pem
RUN GOARCH=arm GOARM=6 make build && touch jwt_signing_key.pem

# Copy binary to alpine
FROM arm32v6/alpine:3.11
Expand Down
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
include .env
GO ?= go
GOLANGCILINT ?= golangci-lint

BINARY := oauth2-proxy
VERSION := $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
# Allow to override image registry.
REGISTRY ?= quay.io/oauth2-proxy
.NOTPARALLEL:

GO_MAJOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1
MINIMUM_SUPPORTED_GO_MINOR_VERSION = 14
GO_VERSION_VALIDATION_ERR_MSG = Golang version is not supported, please update to at least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION)

.PHONY: all
all: lint $(BINARY)

Expand All @@ -18,11 +26,11 @@ distclean: clean
rm -rf vendor

.PHONY: lint
lint:
lint: validate-go-version
GO111MODULE=on $(GOLANGCILINT) run

.PHONY: build
build: clean $(BINARY)
build: validate-go-version clean $(BINARY)

$(BINARY):
GO111MODULE=on CGO_ENABLED=0 $(GO) build -a -installsuffix cgo -ldflags="-X main.VERSION=${VERSION}" -o $@ github.com/oauth2-proxy/oauth2-proxy
Expand Down Expand Up @@ -62,3 +70,15 @@ test: lint
.PHONY: release
release: lint test
BINARY=${BINARY} VERSION=${VERSION} ./dist.sh

.PHONY: validate-go-version
validate-go-version: ## Validates the installed version of go against Mattermost's minimum requirement.
@if [ $(GO_MAJOR_VERSION) -gt $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION) ]; then \
exit 0 ;\
elif [ $(GO_MAJOR_VERSION) -lt $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION) ]; then \
echo '$(GO_VERSION_VALIDATION_ERR_MSG)';\
exit 1; \
elif [ $(GO_MINOR_VERSION) -lt $(MINIMUM_SUPPORTED_GO_MINOR_VERSION) ] ; then \
echo '$(GO_VERSION_VALIDATION_ERR_MSG)';\
exit 1; \
fi
139 changes: 0 additions & 139 deletions configure

This file was deleted.

0 comments on commit 07df29d

Please sign in to comment.