2017-01-23 08:09:18 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# This script is executed from within the container.
|
|
|
|
#
|
|
|
|
|
2018-10-22 07:33:19 -05:00
|
|
|
set -e
|
|
|
|
|
|
|
|
EXTRA_OPTS="$@"
|
|
|
|
|
2018-05-08 02:42:20 -05:00
|
|
|
CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
|
|
|
|
|
2017-01-23 08:09:18 -06:00
|
|
|
GOPATH=/go
|
|
|
|
REPO_PATH=$GOPATH/src/github.com/grafana/grafana
|
|
|
|
|
2017-02-24 02:22:57 -06:00
|
|
|
cd /go/src/github.com/grafana/grafana
|
2017-01-30 10:27:12 -06:00
|
|
|
echo "current dir: $(pwd)"
|
|
|
|
|
|
|
|
if [ "$CIRCLE_TAG" != "" ]; then
|
2018-05-08 02:42:20 -05:00
|
|
|
echo "Building releases from tag $CIRCLE_TAG"
|
2018-11-05 08:05:12 -06:00
|
|
|
OPT="-includeBuildId=false ${EXTRA_OPTS}"
|
2017-01-31 03:10:25 -06:00
|
|
|
else
|
|
|
|
echo "Building incremental build for $CIRCLE_BRANCH"
|
2018-11-05 08:05:12 -06:00
|
|
|
OPT="-buildId=${CIRCLE_WORKFLOW_ID} ${EXTRA_OPTS}"
|
2017-01-24 04:24:45 -06:00
|
|
|
fi
|
2017-01-23 08:09:18 -06:00
|
|
|
|
2018-10-22 07:33:19 -05:00
|
|
|
echo "Build arguments: $OPT"
|
|
|
|
|
2018-07-26 09:46:36 -05:00
|
|
|
CC=${CCX64} go run build.go ${OPT} build
|
|
|
|
|
2017-02-13 08:26:10 -06:00
|
|
|
yarn install --pure-lockfile --no-progress
|
2017-01-23 08:09:18 -06:00
|
|
|
|
2017-01-30 10:27:12 -06:00
|
|
|
echo "current dir: $(pwd)"
|
|
|
|
|
2018-05-08 02:42:20 -05:00
|
|
|
if [ -d "dist" ]; then
|
|
|
|
rm -rf dist
|
|
|
|
fi
|
|
|
|
|
2018-07-26 09:46:36 -05:00
|
|
|
echo "Building frontend"
|
|
|
|
go run build.go ${OPT} build-frontend
|
|
|
|
|
2018-09-05 04:55:28 -05:00
|
|
|
# Load ruby, needed for packing with fpm
|
|
|
|
source /etc/profile.d/rvm.sh
|
|
|
|
|
2018-07-26 09:46:36 -05:00
|
|
|
echo "Packaging"
|
|
|
|
go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only latest
|