diff --git a/.circleci/config.yml b/.circleci/config.yml index 49e9a8a1c81..06d09c9f706 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,7 +139,7 @@ jobs: cd $GOPATH/src/github.com/loadimpact/k6 echo "Building k6..." - CGO_ENABLED=0 GOARCH=$ARCH go build -a -ldflags '-s -w' -o /tmp/k6 + CGO_ENABLED=0 GOARCH=$ARCH go build -a -trimpath -ldflags '-s -w' -o /tmp/k6 echo "Done!" VERSION=${CIRCLE_TAG:1} ./packaging/gen-packages.sh diff --git a/Dockerfile b/Dockerfile index 7ed9cc237b4..852b7e59786 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 -trimpath -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/appveyor.yml b/appveyor.yml index ee9835cc72d..5b1700e4718 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,7 +52,7 @@ build_script: - cd %APPVEYOR_BUILD_FOLDER% - pandoc -s -f markdown -t rtf -o packaging\LICENSE.rtf LICENSE.md - go version - - go build -a -ldflags "-s -w" -o packaging\k6.exe + - go build -a -trimpath -ldflags "-s -w" -o packaging\k6.exe - cd %APPVEYOR_BUILD_FOLDER%\packaging - candle.exe -arch x64 -dVERSION=%VERSION% k6.wxs - light.exe -ext WixUIExtension k6.wixobj diff --git a/build-release.sh b/build-release.sh index 40e91c87efb..57f76a70340 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" @@ -28,7 +28,7 @@ build_dist() { local DIR="k6-${VERSION}-${ALIAS}" local BUILD_ENV=("${@:4}") - local BUILD_ARGS=(-o "dist/$DIR/k6${SUFFIX}") + local BUILD_ARGS=(-o "dist/$DIR/k6${SUFFIX}" -trimpath) if [ -n "$VERSION_DETAILS" ]; then BUILD_ARGS+=(-ldflags "-X github.com/loadimpact/k6/lib/consts.VersionDetails=$VERSION_DETAILS") @@ -60,16 +60,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 [ -f "$x" ] && "${CHECKSUM_CMD[@]}" -- "$x" >> "$CHECKSUM_FILE"; done ) } echo "--- Building Release: ${VERSION}"