build: use build workflow id instead of build number. (#13965)

* build: use build workflow id instead of build number.

The workflow id is unique across the whole workflow
while the build number is unique to every job in the
workflow. This change means that jobs that build
artifacts for the same commit but in different jobs
will now have the same id.

* build: fixes pkgver generation.
This commit is contained in:
Leonard Gram
2018-11-05 15:05:12 +01:00
committed by GitHub
parent 0df14f3fa8
commit a1dca2117d
4 changed files with 24 additions and 26 deletions

View File

@@ -22,10 +22,10 @@ echo "current dir: $(pwd)"
if [ "$CIRCLE_TAG" != "" ]; then
echo "Building releases from tag $CIRCLE_TAG"
OPT="-includeBuildNumber=false ${EXTRA_OPTS}"
OPT="-includeBuildId=false ${EXTRA_OPTS}"
else
echo "Building incremental build for $CIRCLE_BRANCH"
OPT="-buildNumber=${CIRCLE_BUILD_NUM} ${EXTRA_OPTS}"
OPT="-buildId=${CIRCLE_WORKFLOW_ID} ${EXTRA_OPTS}"
fi
echo "Build arguments: $OPT"

View File

@@ -18,10 +18,10 @@ echo "current dir: $(pwd)"
if [ "$CIRCLE_TAG" != "" ]; then
echo "Building releases from tag $CIRCLE_TAG"
OPT="-includeBuildNumber=false ${EXTRA_OPTS}"
OPT="-includeBuildId=false ${EXTRA_OPTS}"
else
echo "Building incremental build for $CIRCLE_BRANCH"
OPT="-buildNumber=${CIRCLE_BUILD_NUM} ${EXTRA_OPTS}"
OPT="-buildId=${CIRCLE_WORKFLOW_ID} ${EXTRA_OPTS}"
fi
echo "Build arguments: $OPT"

View File

@@ -1,14 +0,0 @@
#!/bin/bash
mkdir -p dist
echo "Circle branch: ${CIRCLE_BRANCH}"
echo "Circle tag: ${CIRCLE_TAG}"
docker run -i -t --name gfbuild \
-v $(pwd):/go/src/github.com/grafana/grafana \
-e "CIRCLE_BRANCH=${CIRCLE_BRANCH}" \
-e "CIRCLE_TAG=${CIRCLE_TAG}" \
-e "CIRCLE_BUILD_NUM=${CIRCLE_BUILD_NUM}" \
grafana/buildcontainer
sudo chown -R ${USER:=$(/usr/bin/id -run)}:$USER dist