git.iko.soy/typeable/oauth2-proxy
on master help sign in
Rewrite dist script (#302)
f40dab8Dan Bond
CHANGELOG.md+1
@@ -9,6 +9,7 @@
9- [#258](https://github.com/pusher/oauth2_proxy/pull/258) Add IDToken for Azure provider
9- [#258](https://github.com/pusher/oauth2_proxy/pull/258) Add IDToken for Azure provider
10 - This PR adds the IDToken into the session for the Azure provider allowing requests to a backend to be identified as a specific user. As a consequence, if you are using a cookie to store the session the cookie will now exceed the 4kb size limit and be split into multiple cookies. This can cause problems when using nginx as a proxy, resulting in no cookie being passed at all. Either increase the proxy_buffer_size in nginx or implement the redis session storage (see https://pusher.github.io/oauth2_proxy/configuration#redis-storage)
10 - This PR adds the IDToken into the session for the Azure provider allowing requests to a backend to be identified as a specific user. As a consequence, if you are using a cookie to store the session the cookie will now exceed the 4kb size limit and be split into multiple cookies. This can cause problems when using nginx as a proxy, resulting in no cookie being passed at all. Either increase the proxy_buffer_size in nginx or implement the redis session storage (see https://pusher.github.io/oauth2_proxy/configuration#redis-storage)
11- [#286](https://github.com/pusher/oauth2_proxy/pull/286) Requests.go updated with useful error messages (@biotom)
11- [#286](https://github.com/pusher/oauth2_proxy/pull/286) Requests.go updated with useful error messages (@biotom)
12+- [#302](https://github.com/pusher/oauth2_proxy/pull/302) Rewrite dist script (@syscll)
12
13
13# v4.0.0
14# v4.0.0
14
15
Makefile+1−26
@@ -61,29 +61,4 @@ test: lint
61
61
62.PHONY: release
62.PHONY: release
63release: lint test
63release: lint test
64− mkdir release
64+ BINARY=${BINARY} VERSION=${VERSION} ./dist.sh
65− mkdir release/$(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION)
66− mkdir release/$(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION)
67− mkdir release/$(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION)
68− mkdir release/$(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION)
69− mkdir release/$(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION)
70− GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -ldflags="-X main.VERSION=${VERSION}" \
71− -o release/$(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
72− GO111MODULE=on GOOS=linux GOARCH=amd64 go build -ldflags="-X main.VERSION=${VERSION}" \
73− -o release/$(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
74− GO111MODULE=on GOOS=linux GOARCH=arm64 go build -ldflags="-X main.VERSION=${VERSION}" \
75− -o release/$(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
76− GO111MODULE=on GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X main.VERSION=${VERSION}" \
77− -o release/$(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
78− GO111MODULE=on GOOS=windows GOARCH=amd64 go build -ldflags="-X main.VERSION=${VERSION}" \
79− -o release/$(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
80− shasum -a 256 release/$(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).darwin-amd64-sha256sum.txt
81− shasum -a 256 release/$(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).linux-amd64-sha256sum.txt
82− shasum -a 256 release/$(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).linux-arm64-sha256sum.txt
83− shasum -a 256 release/$(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).linux-armv6-sha256sum.txt
84− shasum -a 256 release/$(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).windows-amd64-sha256sum.txt
85− tar -C release -czvf release/$(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION)
86− tar -C release -czvf release/$(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION)
87− tar -C release -czvf release/$(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION)
88− tar -C release -czvf release/$(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION)
89− tar -C release -czvf release/$(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION)
dist.sh+43−42
@@ -1,45 +1,46 @@
1−#!/bin/bash
1+#!/usr/bin/env bash
2−# build binary distributions for linux/amd64 and darwin/amd64
2+
3−set -e
3+set -o errexit
4−
4+
5−DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+if [[ -z ${BINARY} ]] || [[ -z ${VERSION} ]]; then
6−echo "working dir $DIR"
6+ echo "Missing required env var: BINARY=X VERSION=X $(basename $0)"
7−mkdir -p $DIR/dist
7+ exit 1
8−dep ensure || exit 1
9−
10−os=$(go env GOOS)
11−arch=$(go env GOARCH)
12−version=$(cat $DIR/version.go | grep "const VERSION" | awk '{print $NF}' | sed 's/"//g')
13−goversion=$(go version | awk '{print $3}')
14−sha256sum=()
15−
16−echo "... running tests"
17−./test.sh
18−
19−for os in windows linux darwin; do
20− echo "... building v$version for $os/$arch"
21− EXT=
22− if [ $os = windows ]; then
23− EXT=".exe"
24− fi
8+fi
25− BUILD=$(mktemp -d ${TMPDIR:-/tmp}/oauth2_proxy.XXXXXX)
26− TARGET="oauth2_proxy-$version.$os-$arch.$goversion"
27− FILENAME="oauth2_proxy-$version.$os-$arch$EXT"
28− GOOS=$os GOARCH=$arch CGO_ENABLED=0 \
29− go build -ldflags="-s -w" -o $BUILD/$TARGET/$FILENAME || exit 1
30− pushd $BUILD/$TARGET
31− sha256sum+=("$(shasum -a 256 $FILENAME || exit 1)")
32− cd .. && tar czvf $TARGET.tar.gz $TARGET
33− mv $TARGET.tar.gz $DIR/dist
34− popd
35−done
36
9
37−checksum_file="sha256sum.txt"
10+# Check for Go version 1.13.*
38−cd $DIR/dist
11+GO_VERSION=$(go version | awk '{print $3}')
39−if [ -f $checksum_file ]; then
12+if [[ ! "${GO_VERSION}" =~ ^go1.13.* ]]; then
40− rm $checksum_file
13+ echo "Go version must be >= go1.13"
14+ exit 1
41fi
15fi
42−touch $checksum_file
16+
43−for checksum in "${sha256sum[@]}"; do
17+ARCHS=(darwin-amd64 linux-amd64 linux-arm64 linux-armv6 windows-amd64)
44− echo "$checksum" >> $checksum_file
18+
19+mkdir -p release
20+
21+# Create architecture specific release dirs
22+for ARCH in "${ARCHS[@]}"; do
23+ mkdir -p release/${BINARY}-${VERSION}.${ARCH}.${GO_VERSION}
24+
25+ GO_OS=$(echo $ARCH | awk -F- '{print $1}')
26+ GO_ARCH=$(echo $ARCH | awk -F- '{print $2}')
27+
28+ # Create architecture specific binaries
29+ if [[ ${GO_ARCH} == "armv6" ]]; then
30+ GO111MODULE=on GOOS=${GO_OS} GOARCH=arm GOARM=6 go build -ldflags="-X main.VERSION=${VERSION}" \
31+ -o release/${BINARY}-${VERSION}.${ARCH}.${GO_VERSION}/${BINARY} github.com/pusher/oauth2_proxy
32+ else
33+ GO111MODULE=on GOOS=${GO_OS} GOARCH=${GO_ARCH} go build -ldflags="-X main.VERSION=${VERSION}" \
34+ -o release/${BINARY}-${VERSION}.${ARCH}.${GO_VERSION}/${BINARY} github.com/pusher/oauth2_proxy
35+ fi
36+
37+ cd release
38+
39+ # Create sha256sum for architecture specific binary
40+ shasum -a 256 ${BINARY}-${VERSION}.${ARCH}.${GO_VERSION}/${BINARY} > ${BINARY}-${VERSION}.${ARCH}-sha256sum.txt
41+
42+ # Create tar file for architecture specific binary
43+ tar -czvf ${BINARY}-${VERSION}.${ARCH}.${GO_VERSION}.tar.gz ${BINARY}-${VERSION}.${ARCH}.${GO_VERSION}
44+
45+ cd ..
45done
46done
docs/1_installation.md+3−3
@@ -9,7 +9,7 @@ nav_order: 1
9
9
101. Choose how to deploy:
101. Choose how to deploy:
11
11
12− a. Download [Prebuilt Binary](https://github.com/pusher/oauth2_proxy/releases) (current release is `v3.2.0`)
12+ a. Download [Prebuilt Binary](https://github.com/pusher/oauth2_proxy/releases) (current release is `v4.0.0`)
13
13
14 b. Build with `$ go get github.com/pusher/oauth2_proxy` which will put the binary in `$GOROOT/bin`
14 b. Build with `$ go get github.com/pusher/oauth2_proxy` which will put the binary in `$GOROOT/bin`
15
15
@@ -18,8 +18,8 @@ nav_order: 1
18Prebuilt binaries can be validated by extracting the file and verifying it against the `sha256sum.txt` checksum file provided for each release starting with version `v3.0.0`.
18Prebuilt binaries can be validated by extracting the file and verifying it against the `sha256sum.txt` checksum file provided for each release starting with version `v3.0.0`.
19
19
20```
20```
21−sha256sum -c sha256sum.txt 2>&1 | grep OK
21+$ sha256sum -c sha256sum.txt 2>&1 | grep OK
22−oauth2_proxy-3.2.0.linux-amd64: OK
22+oauth2_proxy-4.0.0.linux-amd64: OK
23```
23```
24
24
252. [Select a Provider and Register an OAuth Application with a Provider](auth-configuration)
252. [Select a Provider and Register an OAuth Application with a Provider](auth-configuration)