Skip to content

Commit

Permalink
make build-release.sh works on Mac OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
cuonglm committed Nov 14, 2019
1 parent 5f12764 commit 1be94e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.13-alpine as builder
WORKDIR $GOPATH/src/github.com/loadimpact/k6
ADD . .
RUN apk --no-cache add git
RUN CGO_ENABLED=0 go install -a -ldflags "-s -w -X github.com/loadimpact/k6/lib/consts.VersionDetails=$(date --utc -Is)/$(git describe --always --long --dirty)"
RUN CGO_ENABLED=0 go install -a -ldflags "-s -w -X github.com/loadimpact/k6/lib/consts.VersionDetails=$(date -u +"%FT%T%z")/$(git describe --always --long --dirty)"

FROM alpine:3.10
RUN apk add --no-cache ca-certificates
Expand Down
9 changes: 5 additions & 4 deletions build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ eval "$(go env)"
VERSION=${1:-$(git describe --tags --always --dirty)}

# To overwrite the version details, pass something as the second arg. Empty string disables it.
VERSION_DETAILS=${2-"$(date --utc --iso-8601=s)/$(git describe --always --long --dirty)"}
VERSION_DETAILS=${2-"$(date -u +"%FT%T%z")/$(git describe --always --long --dirty)"}

make_archive() {
local FMT="$1" DIR="$2"
Expand Down Expand Up @@ -39,6 +39,7 @@ build_dist() {
# Clean out any old remnants of failed builds.
rm -rf "dist/$DIR"
mkdir -p "dist/$DIR"
trap "rm -rf \"dist/$DIR\"" INT TERM

# Subshell to not mess with the current env vars or CWD
(
Expand All @@ -60,16 +61,16 @@ checksum() {
local CHECKSUM_FILE="k6-${VERSION}-checksums.txt"

if command -v sha256sum > /dev/null; then
CHECKSUM_CMD="sha256sum"
CHECKSUM_CMD=("sha256sum")
elif command -v shasum > /dev/null; then
CHECKSUM_CMD="shasum -a 256"
CHECKSUM_CMD=("shasum" "-a" "256")
else
echo "ERROR: unable to find a command to compute sha-256 hash"
return 1
fi

rm -f "dist/$CHECKSUM_FILE"
( cd dist && for x in *; do "$CHECKSUM_CMD" "$x" >> "$CHECKSUM_FILE"; done )
( cd dist && for x in *; do "${CHECKSUM_CMD[@]}" -- "$x" >> "$CHECKSUM_FILE"; done )
}

echo "--- Building Release: ${VERSION}"
Expand Down

0 comments on commit 1be94e3

Please sign in to comment.