Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 085c6cf

Browse files
authored
Merge pull request #503 from talam/add_checksum_for_binary_releases
distribution: create sha256sum.txt file when creating version releases
2 parents b0c1c85 + 842a45b commit 085c6cf

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ to validate accounts by email, domain or group.
1616
## Installation
1717

1818
1. 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+
```
1924
2. Select a Provider and Register an OAuth Application with a Provider
2025
3. Configure OAuth2 Proxy using config file, command line options, or environment variables
2126
4. Configure SSL or Deploy behind a SSL endpoint (example provided for Nginx)

dist.sh

+17-6
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ set -e
55
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
66
echo "working dir $DIR"
77
mkdir -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

1210
os=$(go env GOOS)
1311
arch=$(go env GOARCH)
1412
version=$(cat $DIR/version.go | grep "const VERSION" | awk '{print $NF}' | sed 's/"//g')
1513
goversion=$(go version | awk '{print $3}')
14+
sha256sum=()
1615

1716
echo "... 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
3435
done
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

0 commit comments

Comments
 (0)