diff --git a/Dockerfile b/Dockerfile index 7ed9cc237b4..a6220f8cf72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/build-release.sh b/build-release.sh index 40e91c87efb..e7589165762 100755 --- a/build-release.sh +++ b/build-release.sh @@ -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" @@ -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 ( @@ -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}"