Commit 3e62b1b2 by bergquist

tech(build): use build number as iteration number

parent a580113d
......@@ -38,6 +38,7 @@ var (
phjsToRelease string
workingDir string
includeBuildNumber bool = true
buildNumber int = 0
binaries []string = []string{"grafana-server", "grafana-cli"}
)
......@@ -58,6 +59,7 @@ func main() {
flag.StringVar(&phjsToRelease, "phjs", "", "PhantomJS binary")
flag.BoolVar(&race, "race", race, "Use race detector")
flag.BoolVar(&includeBuildNumber, "includeBuildNumber", includeBuildNumber, "IncludeBuildNumber in package name")
flag.IntVar(&buildNumber, "buildNumber", 0, "Build number from CI system")
flag.Parse()
readVersionFromPackageJson()
......@@ -157,7 +159,11 @@ func readVersionFromPackageJson() {
// add timestamp to iteration
if includeBuildNumber {
linuxPackageIteration = fmt.Sprintf("%d%s", time.Now().Unix(), linuxPackageIteration)
if buildNumber != 0 {
linuxPackageIteration = fmt.Sprintf("%d%s", buildNumber, linuxPackageIteration)
} else {
linuxPackageIteration = fmt.Sprintf("%d%s", time.Now().Unix(), linuxPackageIteration)
}
}
}
......
......@@ -25,10 +25,10 @@ echo "current dir: $(pwd)"
if [ "$CIRCLE_TAG" != "" ]; then
echo "Building a release from tag $CIRCLE_TAG"
go run build.go -includeBuildNumber=false build
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} -includeBuildNumber=false build
else
echo "Building incremental build for $CIRCLE_BRANCH"
go run build.go build
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} build
fi
yarn install --pure-lockfile
......@@ -42,10 +42,10 @@ echo "current dir: $(pwd)"
if [ "$CIRCLE_TAG" != "" ]; then
echo "Packaging a release from tag $CIRCLE_TAG"
go run build.go -includeBuildNumber=false package latest
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} -includeBuildNumber=false package latest
else
echo "Packaging incremental build for $CIRCLE_BRANCH"
go run build.go package latest
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} package latest
fi
cp dist/* /tmp/dist/
......
......@@ -8,4 +8,5 @@ docker run -i -t --name gfbuild \
-v $(pwd)/dist:/tmp/dist \
-e "CIRCLE_BRANCH=${CIRCLE_BRANCH}" \
-e "CIRCLE_TAG=${CIRCLE_TAG}" \
-e "CIRCLE_BUILD_NUM=${CIRCLE_BUILD_NUM}"
grafana/buildcontainer
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment