git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #503 from talam/add_checksum_for_binary_releases

distribution: create sha256sum.txt file when creating version releases

commit085c6cf79b58c2f80f5d599323531fefdd9ff1a6 authorJehiah Czebotar <jehiah@gmail.com> dateMon 4 Dec 2017, 10:39 (9 years ago) parentb0c1c85842a45b
2 files changed+22−6
README.md+5 dist.sh+17−6
README.md+5
@@ -16,6 +16,11 @@ to validate accounts by email, domain or group.
1616## Installation
1717
18181. Download [Prebuilt Binary](https://github.com/bitly/oauth2_proxy/releases) (current release is `v2.2`) or build with `$ go get github.com/bitly/oauth2_proxy` which will put the binary in `$GOROOT/bin`
19+Prebuilt binaries can be validated by extracting the file and verifying it against the `sha256sum.txt` checksum file provided for each release starting with version `v2.3`.
20+```
21+sha256sum -c sha256sum.txt 2>&1 | grep OK
22+oauth2_proxy-2.3.linux-amd64: OK
23+```
19242. Select a Provider and Register an OAuth Application with a Provider
20253. Configure OAuth2 Proxy using config file, command line options, or environment variables
21264. Configure SSL or Deploy behind a SSL endpoint (example provided for Nginx)
dist.sh+17−6
@@ -5,14 +5,13 @@ set -e
55DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
66echo "working dir $DIR"
77mkdir -p $DIR/dist
8−mkdir -p $DIR/.godeps
9−export GOPATH=$DIR/.godeps:$GOPATH
10−GOPATH=$DIR/.godeps gpm install
8+dep ensure || exit 1
119
1210os=$(go env GOOS)
1311arch=$(go env GOARCH)
1412version=$(cat $DIR/version.go | grep "const VERSION" | awk '{print $NF}' | sed 's/"//g')
1513goversion=$(go version | awk '{print $3}')
14+sha256sum=()
1615
1716echo "... running tests"
1817./test.sh
@@ -25,10 +24,22 @@ for os in windows linux darwin; do
2524 fi
2625 BUILD=$(mktemp -d ${TMPDIR:-/tmp}/oauth2_proxy.XXXXXX)
2726 TARGET="oauth2_proxy-$version.$os-$arch.$goversion"
27+ FILENAME="oauth2_proxy-$version.$os-$arch$EXT"
2828 GOOS=$os GOARCH=$arch CGO_ENABLED=0 \
29− go build -ldflags="-s -w" -o $BUILD/$TARGET/oauth2_proxy$EXT || exit 1
30− pushd $BUILD
31− tar czvf $TARGET.tar.gz $TARGET
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
3233 mv $TARGET.tar.gz $DIR/dist
3334 popd
3435done
36+
37+checksum_file="sha256sum.txt"
38+cd $DIR/dist
39+if [ -f $checksum_file ]; then
40+ rm $checksum_file
41+fi
42+touch $checksum_file
43+for checksum in "${sha256sum[@]}"; do
44+ echo "$checksum" >> $checksum_file
45+done