mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Build: Introduce shellcheck (#18081)
* Build: introduce shellcheck Fixes #16198
This commit is contained in:
parent
87a794fe0a
commit
4b16cd6cc8
@ -127,6 +127,15 @@ jobs:
|
||||
name: Lint Go
|
||||
command: 'make lint-go'
|
||||
|
||||
shellcheck:
|
||||
machine: true
|
||||
working_directory: ~/go/src/github.com/grafana/grafana
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: ShellCheck
|
||||
command: 'make shellcheck'
|
||||
|
||||
test-frontend:
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
@ -650,6 +659,8 @@ workflows:
|
||||
filters: *filter-only-master
|
||||
- lint-go:
|
||||
filters: *filter-only-master
|
||||
- shellcheck:
|
||||
filters: *filter-only-master
|
||||
- test-frontend:
|
||||
filters: *filter-only-master
|
||||
- test-backend:
|
||||
@ -665,6 +676,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
- build-oss-msi
|
||||
@ -677,6 +689,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
filters: *filter-only-master
|
||||
@ -687,6 +700,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
- build-all-enterprise
|
||||
@ -698,6 +712,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
filters: *filter-only-master
|
||||
@ -724,6 +739,8 @@ workflows:
|
||||
filters: *filter-only-release
|
||||
- lint-go:
|
||||
filters: *filter-only-release
|
||||
- shellcheck:
|
||||
filters: *filter-only-release
|
||||
- test-frontend:
|
||||
filters: *filter-only-release
|
||||
- test-backend:
|
||||
@ -739,6 +756,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
- build-oss-msi
|
||||
@ -751,6 +769,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
filters: *filter-only-release
|
||||
@ -762,6 +781,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
filters: *filter-only-release
|
||||
@ -772,6 +792,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
filters: *filter-only-release
|
||||
@ -791,6 +812,10 @@ workflows:
|
||||
filters: *filter-not-release-or-master
|
||||
- lint-go:
|
||||
filters: *filter-not-release-or-master
|
||||
- lint-go:
|
||||
filters: *filter-not-release-or-master
|
||||
- shellcheck:
|
||||
filters: *filter-not-release-or-master
|
||||
- test-frontend:
|
||||
filters: *filter-not-release-or-master
|
||||
- test-backend:
|
||||
@ -808,6 +833,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
- cache-server-test
|
||||
@ -819,6 +845,7 @@ workflows:
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
- cache-server-test
|
||||
|
6
Makefile
6
Makefile
@ -4,6 +4,7 @@
|
||||
|
||||
GO = GO111MODULE=on go
|
||||
GO_FILES ?= ./pkg/...
|
||||
SH_FILES ?= $(shell find ./scripts -name *.sh)
|
||||
|
||||
all: deps build
|
||||
|
||||
@ -111,6 +112,11 @@ go-vet:
|
||||
|
||||
lint-go: go-vet golangci-lint revive revive-alerting gosec
|
||||
|
||||
# with disabled SC1071 we are ignored some TCL,Expect `/usr/bin/env expect` scripts
|
||||
shellcheck: $(SH_FILES)
|
||||
@docker run --rm -v "$$PWD:/mnt" koalaman/shellcheck:stable \
|
||||
$(SH_FILES) -e SC1071
|
||||
|
||||
run: scripts/go/bin/bra
|
||||
@scripts/go/bin/bra run
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
# shellcheck disable=SC2124
|
||||
EXTRA_OPTS="$@"
|
||||
|
||||
CCARMV6=/opt/rpi-tools/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
|
||||
@ -15,9 +16,6 @@ CCOSX64=/tmp/osxcross/target/bin/o64-clang
|
||||
CCWIN64=x86_64-w64-mingw32-gcc
|
||||
CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
|
||||
|
||||
GOPATH=/go
|
||||
REPO_PATH=$GOPATH/src/github.com/grafana/grafana
|
||||
|
||||
cd /go/src/github.com/grafana/grafana
|
||||
echo "current dir: $(pwd)"
|
||||
|
||||
@ -34,16 +32,16 @@ echo "current dir: $(pwd)"
|
||||
|
||||
# build only amd64 for enterprise
|
||||
if echo "$EXTRA_OPTS" | grep -vq enterprise ; then
|
||||
go run build.go -goarch armv6 -cc ${CCARMV6} ${OPT} build
|
||||
go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
|
||||
go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
|
||||
go run build.go -goos darwin -cc ${CCOSX64} ${OPT} build
|
||||
go run build.go -goarch armv6 -cc "${CCARMV6}" "${OPT}" build
|
||||
go run build.go -goarch armv7 -cc "${CCARMV7}" "${OPT}" build
|
||||
go run build.go -goarch arm64 -cc "${CCARM64}" "${OPT}" build
|
||||
go run build.go -goos darwin -cc "${CCOSX64}" "${OPT}" build
|
||||
fi
|
||||
|
||||
go run build.go -goos windows -cc ${CCWIN64} ${OPT} build
|
||||
go run build.go -goos windows -cc "${CCWIN64}" "${OPT}" build
|
||||
|
||||
# Do not remove CC from the linux build, its there for compatibility with Centos6
|
||||
CC=${CCX64} go run build.go ${OPT} build
|
||||
CC=${CCX64} go run build.go "${OPT}" build
|
||||
|
||||
yarn install --pure-lockfile --no-progress
|
||||
|
||||
@ -53,35 +51,36 @@ else
|
||||
echo "Building frontend and packaging incremental build for $CIRCLE_BRANCH"
|
||||
fi
|
||||
echo "Building frontend"
|
||||
go run build.go ${OPT} build-frontend
|
||||
go run build.go "${OPT}" build-frontend
|
||||
|
||||
if [ -d "dist" ]; then
|
||||
rm -rf dist
|
||||
fi
|
||||
|
||||
mkdir dist
|
||||
go run build.go -gen-version ${OPT} > dist/grafana.version
|
||||
go run build.go -gen-version "${OPT}" > dist/grafana.version
|
||||
|
||||
# Load ruby, needed for packing with fpm
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/profile.d/rvm.sh
|
||||
|
||||
echo "Packaging"
|
||||
go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only
|
||||
go run build.go -goos linux -pkg-arch amd64 "${OPT}" package-only
|
||||
#removing amd64 phantomjs bin for armv7/arm64 packages
|
||||
rm tools/phantomjs/phantomjs
|
||||
|
||||
# build only amd64 for enterprise
|
||||
if echo "$EXTRA_OPTS" | grep -vq enterprise ; then
|
||||
go run build.go -goos linux -pkg-arch armv6 ${OPT} -skipRpm package-only
|
||||
go run build.go -goos linux -pkg-arch armv7 ${OPT} package-only
|
||||
go run build.go -goos linux -pkg-arch arm64 ${OPT} package-only
|
||||
go run build.go -goos linux -pkg-arch armv6 "${OPT}" -skipRpm package-only
|
||||
go run build.go -goos linux -pkg-arch armv7 "${OPT}" package-only
|
||||
go run build.go -goos linux -pkg-arch arm64 "${OPT}" package-only
|
||||
|
||||
if [ -d '/tmp/phantomjs/darwin' ]; then
|
||||
cp /tmp/phantomjs/darwin/phantomjs tools/phantomjs/phantomjs
|
||||
else
|
||||
echo 'PhantomJS binaries for darwin missing!'
|
||||
fi
|
||||
go run build.go -goos darwin -pkg-arch amd64 ${OPT} package-only
|
||||
go run build.go -goos darwin -pkg-arch amd64 "${OPT}" package-only
|
||||
fi
|
||||
|
||||
if [ -d '/tmp/phantomjs/windows' ]; then
|
||||
@ -90,6 +89,6 @@ if [ -d '/tmp/phantomjs/windows' ]; then
|
||||
else
|
||||
echo 'PhantomJS binaries for Windows missing!'
|
||||
fi
|
||||
go run build.go -goos windows -pkg-arch amd64 ${OPT} package-only
|
||||
go run build.go -goos windows -pkg-arch amd64 "${OPT}" package-only
|
||||
|
||||
go run build.go latest
|
||||
|
@ -9,10 +9,6 @@ CCARMV6=/opt/rpi-tools/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g
|
||||
CCARMV7=arm-linux-gnueabihf-gcc
|
||||
CCARM64=aarch64-linux-gnu-gcc
|
||||
CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
|
||||
##########
|
||||
GOPATH=/go
|
||||
REPO_PATH=$GOPATH/src/github.com/grafana/grafana
|
||||
##########
|
||||
|
||||
BUILD_FAST=0
|
||||
BUILD_BACKEND=1
|
||||
@ -51,9 +47,9 @@ while [ "$1" != "" ]; do
|
||||
esac
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2124
|
||||
EXTRA_OPTS="$@"
|
||||
|
||||
|
||||
cd /go/src/github.com/grafana/grafana
|
||||
echo "current dir: $(pwd)"
|
||||
|
||||
@ -73,7 +69,7 @@ function build_backend_linux_amd64() {
|
||||
if [ ! -d "dist" ]; then
|
||||
mkdir dist
|
||||
fi
|
||||
CC=${CCX64} go run build.go ${OPT} build
|
||||
CC=${CCX64} go run build.go "${OPT}" build
|
||||
}
|
||||
|
||||
function build_backend() {
|
||||
@ -81,9 +77,9 @@ function build_backend() {
|
||||
mkdir dist
|
||||
fi
|
||||
|
||||
go run build.go -goarch armv6 -cc ${CCARMV6} ${OPT} build
|
||||
go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
|
||||
go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
|
||||
go run build.go -goarch armv6 -cc ${CCARMV6} "${OPT}" build
|
||||
go run build.go -goarch armv7 -cc ${CCARMV7} "${OPT}" build
|
||||
go run build.go -goarch arm64 -cc ${CCARM64} "${OPT}" build
|
||||
build_backend_linux_amd64
|
||||
}
|
||||
|
||||
@ -93,22 +89,22 @@ function build_frontend() {
|
||||
fi
|
||||
yarn install --pure-lockfile --no-progress
|
||||
echo "Building frontend"
|
||||
go run build.go ${OPT} build-frontend
|
||||
go run build.go "${OPT}" build-frontend
|
||||
echo "FRONTEND: finished"
|
||||
}
|
||||
|
||||
function package_linux_amd64() {
|
||||
echo "Packaging Linux AMD64"
|
||||
go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only
|
||||
go run build.go -goos linux -pkg-arch amd64 "${OPT}" package-only
|
||||
go run build.go latest
|
||||
echo "PACKAGE LINUX AMD64: finished"
|
||||
}
|
||||
|
||||
function package_all() {
|
||||
echo "Packaging ALL"
|
||||
go run build.go -goos linux -pkg-arch armv6 ${OPT} -skipRpm package-only
|
||||
go run build.go -goos linux -pkg-arch armv7 ${OPT} package-only
|
||||
go run build.go -goos linux -pkg-arch arm64 ${OPT} package-only
|
||||
go run build.go -goos linux -pkg-arch armv6 "${OPT}" -skipRpm package-only
|
||||
go run build.go -goos linux -pkg-arch armv7 "${OPT}" package-only
|
||||
go run build.go -goos linux -pkg-arch arm64 "${OPT}" package-only
|
||||
package_linux_amd64
|
||||
echo "PACKAGE ALL: finished"
|
||||
}
|
||||
@ -119,8 +115,9 @@ function package_setup() {
|
||||
rm -rf dist
|
||||
fi
|
||||
mkdir dist
|
||||
go run build.go -gen-version ${OPT} > dist/grafana.version
|
||||
go run build.go -gen-version "${OPT}" > dist/grafana.version
|
||||
# Load ruby, needed for packing with fpm
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/profile.d/rvm.sh
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /tmp
|
||||
cd /tmp || exit 1
|
||||
tar xfJ x86_64-centos6-linux-gnu.tar.xz
|
||||
tar xfJ osxcross.tar.xz
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
WORKING_DIRECTORY=`pwd`
|
||||
WORKING_DIRECTORY=$(pwd)
|
||||
# copy zip file to /tmp/dist
|
||||
mkdir -p /tmp/dist
|
||||
cp ./dist/*.zip /tmp/dist
|
||||
@ -23,12 +23,12 @@ echo "Building MSI"
|
||||
python3 generator/build.py "$@"
|
||||
chmod a+x /tmp/scratch/*.msi
|
||||
echo "MSI: Copy to $WORKING_DIRECTORY/dist"
|
||||
cp /tmp/scratch/*.msi $WORKING_DIRECTORY/dist
|
||||
cp /tmp/scratch/*.msi "$WORKING_DIRECTORY/dist"
|
||||
echo "MSI: Generate SHA256"
|
||||
MSI_FILE=`ls $WORKING_DIRECTORY/dist/*.msi`
|
||||
SHA256SUM=`sha256sum $MSI_FILE | cut -f1 -d' '`
|
||||
echo $SHA256SUM > $MSI_FILE.sha256
|
||||
MSI_FILE=$(ls "$WORKING_DIRECTORY/dist/*.msi")
|
||||
SHA256SUM=$(sha256sum "$MSI_FILE" | cut -f1 -d' ')
|
||||
echo "$SHA256SUM" > "$MSI_FILE.sha256"
|
||||
echo "MSI: SHA256 file content:"
|
||||
cat $MSI_FILE.sha256
|
||||
cat "$MSI_FILE.sha256"
|
||||
echo "MSI: contents of $WORKING_DIRECTORY/dist"
|
||||
ls -al $WORKING_DIRECTORY/dist
|
||||
ls -al "$WORKING_DIRECTORY/dist"
|
||||
|
@ -21,7 +21,7 @@ ls -al /home/xclient/wix/light.exe.config
|
||||
cat /home/xclient/wix/light.exe.config
|
||||
cp /master/light.exe.config /home/xclient/wix/light.exe.config
|
||||
cat /home/xclient/wix/light.exe.config
|
||||
cd /master
|
||||
cd /master || exit 1
|
||||
echo "Building MSI"
|
||||
python3 generator/build.py "$@"
|
||||
#
|
||||
|
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
cd /oss
|
||||
cd /oss || exit 1
|
||||
make
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
cd ..
|
||||
|
||||
|
||||
if [ -z "$CIRCLE_TAG" ]; then
|
||||
_target="master"
|
||||
else
|
||||
@ -11,5 +10,5 @@ fi
|
||||
|
||||
git clone -b "$_target" --single-branch git@github.com:grafana/grafana-enterprise.git --depth 1
|
||||
|
||||
cd grafana-enterprise
|
||||
cd grafana-enterprise || exit
|
||||
./build.sh
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
# no relation to publish.go
|
||||
|
||||
# shellcheck disable=SC2124
|
||||
|
||||
EXTRA_OPTS="$@"
|
||||
|
||||
# Right now we hack this in into the publish script.
|
||||
@ -10,7 +12,7 @@ _releaseNoteUrl="https://community.grafana.com/t/release-notes-v6-0-x/14010"
|
||||
_whatsNewUrl="http://docs.grafana.org/guides/whats-new-in-v6-0/"
|
||||
|
||||
./scripts/build/release_publisher/release_publisher \
|
||||
--wn ${_whatsNewUrl} \
|
||||
--rn ${_releaseNoteUrl} \
|
||||
--version ${CIRCLE_TAG} \
|
||||
--apikey ${GRAFANA_COM_API_KEY} ${EXTRA_OPTS}
|
||||
--wn "${_whatsNewUrl}" \
|
||||
--rn "${_releaseNoteUrl}" \
|
||||
--version "${CIRCLE_TAG}" \
|
||||
--apikey "${GRAFANA_COM_API_KEY}" "${EXTRA_OPTS}"
|
||||
|
@ -8,5 +8,5 @@ cp ./scripts/build/rpmmacros ~/.rpmmacros
|
||||
|
||||
for package in dist/*.rpm; do
|
||||
[ -e "$package" ] || continue
|
||||
./scripts/build/sign_expect $GPG_KEY_PASSWORD $package
|
||||
./scripts/build/sign_expect "$GPG_KEY_PASSWORD" "$package"
|
||||
done
|
||||
|
@ -9,7 +9,7 @@ GCP_REPO_BUCKET="${6:-grafana-repo}"
|
||||
|
||||
REPO="grafana"
|
||||
|
||||
if [ -z "$RELEASE_TYPE" -o -z "$GPG_PASS" -o -z "$DIST_PATH" ]; then
|
||||
if [ -z "$RELEASE_TYPE" ] || [ -z "$GPG_PASS" ] || [ -z "$DIST_PATH" ]; then
|
||||
echo "Both RELEASE_TYPE (arg 1), GPG_PASS (arg 2) and DIST_PATH (arg 4) has to be set"
|
||||
exit 1
|
||||
fi
|
||||
@ -36,7 +36,7 @@ mkdir -p /deb-repo/db \
|
||||
gsutil -m rsync -r -d "gs://$GCP_DB_BUCKET/$RELEASE_TYPE" /deb-repo/db
|
||||
|
||||
# Add the new release to the repo
|
||||
cp $DIST_PATH/*.deb /deb-repo/tmp
|
||||
cp "$DIST_PATH/*.deb" /deb-repo/tmp
|
||||
rm /deb-repo/tmp/grafana_latest*.deb || true
|
||||
aptly repo add "$REPO" /deb-repo/tmp #adds too many packages in enterprise
|
||||
|
||||
@ -64,5 +64,5 @@ gsutil -m rsync -r /deb-repo/repo/grafana/pool "gs://$GCP_REPO_BUCKET/$RELEASE_T
|
||||
gsutil -m rsync -r -d /deb-repo/repo/grafana "gs://$GCP_REPO_BUCKET/$RELEASE_TYPE/deb"
|
||||
|
||||
# usage:
|
||||
#
|
||||
#
|
||||
# deb https://packages.grafana.com/oss/deb stable main
|
||||
|
@ -8,7 +8,7 @@ GCP_REPO_BUCKET="${5:-grafana-repo}"
|
||||
|
||||
REPO="rpm"
|
||||
|
||||
if [ -z "$RELEASE_TYPE" -o -z "$GPG_PASS" -o -z "$DIST_PATH" ]; then
|
||||
if [ -z "$RELEASE_TYPE" ] || [ -z "$GPG_PASS" ] || [ -z "$DIST_PATH" ]; then
|
||||
echo "Both RELEASE_TYPE (arg 1), GPG_PASS (arg 2) and DIST_PATH (arg 4) has to be set"
|
||||
exit 1
|
||||
fi
|
||||
@ -33,7 +33,7 @@ mkdir -p /rpm-repo
|
||||
gsutil -m rsync -r "$BUCKET" /rpm-repo
|
||||
|
||||
# Add the new release to the repo
|
||||
cp $DIST_PATH/*.rpm /rpm-repo # adds to many files for enterprise
|
||||
cp "$DIST_PATH/*.rpm" /rpm-repo # adds to many files for enterprise
|
||||
rm /rpm-repo/grafana-latest-1*.rpm || true
|
||||
createrepo /rpm-repo
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
_files=$*
|
||||
|
||||
ALL_SIGNED=0
|
||||
|
||||
for file in $_files; do
|
||||
rpm -K "$file" | grep "pgp.*OK" -q
|
||||
if [[ $? != 0 ]]; then
|
||||
if rpm -K "$file" | grep "pgp.*OK" -q; then
|
||||
ALL_SIGNED=1
|
||||
echo $file NOT SIGNED
|
||||
echo "$file" NOT SIGNED
|
||||
else
|
||||
echo $file OK
|
||||
echo "$file" OK
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -11,19 +11,19 @@ ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --noImpl
|
||||
DIRECTIVES="$(grep -r -o directive public/app/**/* | wc -l)"
|
||||
CONTROLLERS="$(grep -r -oP 'class .*Ctrl' public/app/**/* | wc -l)"
|
||||
|
||||
if [ $ERROR_COUNT -gt $ERROR_COUNT_LIMIT ]; then
|
||||
if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then
|
||||
echo -e "Typescript errors $ERROR_COUNT exceeded $ERROR_COUNT_LIMIT so failing build"
|
||||
exit -1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $DIRECTIVES -gt $DIRECTIVES_LIMIT ]; then
|
||||
if [ "$DIRECTIVES" -gt $DIRECTIVES_LIMIT ]; then
|
||||
echo -e "Directive count $DIRECTIVES exceeded $DIRECTIVES_LIMIT so failing build"
|
||||
exit -1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $CONTROLLERS -gt $CONTROLLERS_LIMIT ]; then
|
||||
if [ "$CONTROLLERS" -gt $CONTROLLERS_LIMIT ]; then
|
||||
echo -e "Controllers count $CONTROLLERS exceeded $CONTROLLERS_LIMIT so failing build"
|
||||
exit -1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "Typescript errors: $ERROR_COUNT"
|
||||
@ -32,7 +32,7 @@ echo -e "Controllers: $CONTROLLERS"
|
||||
|
||||
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
||||
./scripts/ci-metrics-publisher.sh \
|
||||
grafana.ci-code.noImplicitAny=$ERROR_COUNT \
|
||||
grafana.ci-code.directives=$DIRECTIVES \
|
||||
grafana.ci-code.controllers=$CONTROLLERS
|
||||
grafana.ci-code.noImplicitAny="$ERROR_COUNT" \
|
||||
grafana.ci-code.directives="$DIRECTIVES" \
|
||||
grafana.ci-code.controllers="$CONTROLLERS"
|
||||
fi
|
||||
|
@ -13,6 +13,6 @@ for ((i = 1; i <= $#; i++ )); do
|
||||
data=''$data'{"name": "'${first}'", "value": '${remainder}', "interval": 60, "mtype": "gauge", "time": '$(date +%s)'}'
|
||||
done
|
||||
|
||||
curl https://6371:$GRAFANA_MISC_STATS_API_KEY@graphite-us-central1.grafana.net/metrics \
|
||||
curl "https://6371:$GRAFANA_MISC_STATS_API_KEY@graphite-us-central1.grafana.net/metrics" \
|
||||
-H 'Content-type: application/json' \
|
||||
-d "[$data]"
|
||||
|
@ -12,7 +12,7 @@ function prapare_version_commit () {
|
||||
}
|
||||
|
||||
#Get current version from lerna.json
|
||||
PACKAGE_VERSION=`grep '"version"' lerna.json | cut -d '"' -f 4`
|
||||
PACKAGE_VERSION=$(grep '"version"' lerna.json | cut -d '"' -f 4)
|
||||
# Get short current commit's has
|
||||
GIT_SHA=$(parse_git_hash)
|
||||
|
||||
@ -20,16 +20,14 @@ echo "Commit: ${GIT_SHA}"
|
||||
echo "Current lerna.json version: ${PACKAGE_VERSION}"
|
||||
|
||||
# check if there were any changes to packages between current and previous commit
|
||||
count=`git diff HEAD~1..HEAD --name-only -- packages | awk '{c++} END {print c}'`
|
||||
count=$(git diff HEAD~1..HEAD --name-only -- packages | awk '{c++} END {print c}')
|
||||
|
||||
|
||||
|
||||
if [ -z $count ]; then
|
||||
if [ -z "$count" ]; then
|
||||
echo "No changes in packages, skipping packages publishing"
|
||||
else
|
||||
echo "Changes detected in ${count} packages"
|
||||
echo "Releasing packages under ${PACKAGE_VERSION}-${GIT_SHA}"
|
||||
npx lerna version ${PACKAGE_VERSION}-${GIT_SHA} --no-git-tag-version --no-push --force-publish -y
|
||||
npx lerna version "${PACKAGE_VERSION}-${GIT_SHA}" --no-git-tag-version --no-push --force-publish -y
|
||||
echo $'\nGit status:'
|
||||
git status -s
|
||||
|
||||
|
@ -1,14 +1,7 @@
|
||||
#!/bin/bash
|
||||
function exit_if_fail {
|
||||
command=$@
|
||||
echo "Executing '$command'"
|
||||
eval $command
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "'$command' returned $rc."
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck source=./scripts/helpers/exit-if-fail.sh
|
||||
source "$(dirname "$0")/helpers/exit-if-fail.sh"
|
||||
|
||||
echo "building backend with install to cache pkgs"
|
||||
exit_if_fail time go install ./pkg/cmd/grafana-server
|
||||
@ -16,5 +9,5 @@ exit_if_fail time go install ./pkg/cmd/grafana-server
|
||||
echo "running go test"
|
||||
set -e
|
||||
time for d in $(go list ./pkg/...); do
|
||||
exit_if_fail go test -tags=integration -covermode=atomic $d
|
||||
exit_if_fail go test -tags=integration -covermode=atomic "$d"
|
||||
done
|
||||
|
@ -1,14 +1,7 @@
|
||||
#!/bin/bash
|
||||
function exit_if_fail {
|
||||
command=$@
|
||||
echo "Executing '$command'"
|
||||
eval $command
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "'$command' returned $rc."
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck source=./scripts/helpers/exit-if-fail.sh
|
||||
source "$(dirname "$0")/helpers/exit-if-fail.sh"
|
||||
|
||||
echo "running redis and memcache tests"
|
||||
|
||||
|
@ -1,15 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
function exit_if_fail {
|
||||
command=$@
|
||||
echo "Executing '$command'"
|
||||
eval $command
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "'$command' returned $rc."
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
# shellcheck source=./scripts/helpers/exit-if-fail.sh
|
||||
source "$(dirname "$0")/helpers/exit-if-fail.sh"
|
||||
|
||||
start=$(date +%s)
|
||||
|
||||
|
@ -1,17 +1,10 @@
|
||||
#!/bin/bash
|
||||
function exit_if_fail {
|
||||
command=$@
|
||||
echo "Executing '$command'"
|
||||
eval $command
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "'$command' returned $rc."
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck source=./scripts/helpers/exit-if-fail.sh
|
||||
source "$(dirname "$0")/helpers/exit-if-fail.sh"
|
||||
|
||||
export GRAFANA_TEST_DB=mysql
|
||||
|
||||
time for d in $(go list ./pkg/...); do
|
||||
exit_if_fail go test -tags=integration $d
|
||||
done
|
||||
exit_if_fail go test -tags=integration "$d"
|
||||
done
|
||||
|
@ -1,17 +1,10 @@
|
||||
#!/bin/bash
|
||||
function exit_if_fail {
|
||||
command=$@
|
||||
echo "Executing '$command'"
|
||||
eval $command
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "'$command' returned $rc."
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
# shellcheck source=./scripts/helpers/exit-if-fail.sh
|
||||
source "$(dirname "$0")/helpers/exit-if-fail.sh"
|
||||
|
||||
export GRAFANA_TEST_DB=postgres
|
||||
|
||||
time for d in $(go list ./pkg/...); do
|
||||
exit_if_fail go test -tags=integration $d
|
||||
done
|
||||
exit_if_fail go test -tags=integration "$d"
|
||||
done
|
||||
|
13
scripts/helpers/exit-if-fail.sh
Normal file
13
scripts/helpers/exit-if-fail.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
function exit_if_fail {
|
||||
# shellcheck disable=SC2124
|
||||
command=$@
|
||||
echo "Executing '$command'"
|
||||
eval "$command"
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "'$command' returned $rc."
|
||||
exit $rc
|
||||
fi
|
||||
}
|
@ -6,12 +6,12 @@ set -e
|
||||
_tag=$1
|
||||
_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
|
||||
if [ "${_tag}" == "" ]; then
|
||||
if [ "${_tag}" == "" ]; then
|
||||
echo "Missing version param. ex './scripts/tag_release.sh v5.1.1'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${_branch}" == "master" ]; then
|
||||
if [ "${_branch}" == "master" ]; then
|
||||
echo "you cannot tag releases from the master branch"
|
||||
echo "please checkout the release branch"
|
||||
echo "ex 'git checkout v5.1.x'"
|
||||
@ -20,9 +20,9 @@ fi
|
||||
|
||||
# always make sure to pull latest changes from origin
|
||||
echo "pulling latest changes from ${_branch}"
|
||||
git pull origin ${_branch}
|
||||
git pull origin "${_branch}"
|
||||
|
||||
# create signed tag for latest commit
|
||||
# create signed tag for latest commit
|
||||
git tag -s "${_tag}" -m "release ${_tag}"
|
||||
|
||||
# verify the signed tag
|
||||
@ -31,7 +31,7 @@ git tag -v "${_tag}"
|
||||
echo "Make sure the tag is signed as expected"
|
||||
echo "press [y] to push the tags"
|
||||
|
||||
read -n 1 confirm
|
||||
read -n -r 1 confirm
|
||||
|
||||
if [ "${confirm}" == "y" ]; then
|
||||
git push origin "${_branch}" --tags
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
_circle_token=$1
|
||||
_grafana_version=$2
|
||||
|
||||
trigger_build_url=https://circleci.com/api/v1/project/grafana/grafana-docker/tree/master?circle-token=${_circle_token}
|
||||
trigger_build_url="https://circleci.com/api/v1/project/grafana/grafana-docker/tree/master?circle-token=${_circle_token}"
|
||||
|
||||
post_data=$(cat <<EOF
|
||||
{
|
||||
@ -14,10 +14,10 @@ post_data=$(cat <<EOF
|
||||
EOF
|
||||
)
|
||||
|
||||
echo ${post_data}
|
||||
echo "${post_data}"
|
||||
|
||||
curl \
|
||||
--header "Accept: application/json" \
|
||||
--header "Content-Type: application/json" \
|
||||
--data "${post_data}" \
|
||||
--request POST ${trigger_build_url}
|
||||
--request POST "${trigger_build_url}"
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
_circle_token=$1
|
||||
|
||||
trigger_build_url=https://circleci.com/api/v1/project/grafana/grafana-packer/tree/master?circle-token=${_circle_token}
|
||||
trigger_build_url="https://circleci.com/api/v1/project/grafana/grafana-packer/tree/master?circle-token=${_circle_token}"
|
||||
|
||||
curl \
|
||||
--header "Accept: application/json" \
|
||||
--header "Content-Type: application/json" \
|
||||
--request POST ${trigger_build_url}
|
||||
--request POST "${trigger_build_url}"
|
||||
|
@ -17,7 +17,7 @@ post_data=$(cat <<EOF
|
||||
EOF
|
||||
)
|
||||
|
||||
echo ${post_data}
|
||||
echo "${post_data}"
|
||||
|
||||
curl \
|
||||
--header "Accept: application/json" \
|
||||
|
@ -6,49 +6,49 @@ docker_build () {
|
||||
package=$3
|
||||
tag=$4
|
||||
|
||||
docker build -f $dockerfile \
|
||||
docker build -f "$dockerfile" \
|
||||
--build-arg "REPO_CONFIG=$repo_file" \
|
||||
--build-arg "PACKAGE=$package" \
|
||||
--tag $tag \
|
||||
--tag "$tag" \
|
||||
--no-cache \
|
||||
.
|
||||
|
||||
retval=$(docker run --rm $tag cat /usr/share/grafana/VERSION)
|
||||
retval=$(docker run --rm "$tag" cat /usr/share/grafana/VERSION)
|
||||
}
|
||||
|
||||
CHECK_BETA=$1
|
||||
if [[ $CHECK_BETA == "beta" ]]; then
|
||||
# Testing deb repos
|
||||
docker_build "Dockerfile.deb" "deb-oss-beta.list" "grafana" "gf-oss-deb-repo-test"
|
||||
_oss_deb_v=$retval
|
||||
_oss_deb_v="$retval"
|
||||
|
||||
docker_build "Dockerfile.deb" "deb-ee-beta.list" "grafana-enterprise" "gf-ee-deb-repo-test"
|
||||
_ee_deb_v=$retval
|
||||
_ee_deb_v="$retval"
|
||||
|
||||
# Testing rpm repos
|
||||
docker_build "Dockerfile.rpm" "rpm-oss-beta.list" "grafana" "gf-oss-rpm-repo-test"
|
||||
_oss_rpm_v=$retval
|
||||
_oss_rpm_v="$retval"
|
||||
|
||||
docker_build "Dockerfile.rpm" "rpm-ee-beta.list" "grafana-enterprise" "gf-ee-rpm-repo-test"
|
||||
_ee_rpm_v=$retval
|
||||
_ee_rpm_v="$retval"
|
||||
else
|
||||
# Testing deb repos
|
||||
docker_build "Dockerfile.deb" "deb-oss-stable.list" "grafana" "gf-oss-deb-repo-test"
|
||||
_oss_deb_v=$retval
|
||||
_oss_deb_v="$retval"
|
||||
|
||||
docker_build "Dockerfile.deb" "deb-ee-stable.list" "grafana-enterprise" "gf-ee-deb-repo-test"
|
||||
_ee_deb_v=$retval
|
||||
_ee_deb_v="$retval"
|
||||
|
||||
# Testing rpm repos
|
||||
docker_build "Dockerfile.rpm" "rpm-oss-stable.list" "grafana" "gf-oss-rpm-repo-test"
|
||||
_oss_rpm_v=$retval
|
||||
_oss_rpm_v="$retval"
|
||||
|
||||
docker_build "Dockerfile.rpm" "rpm-ee-stable.list" "grafana-enterprise" "gf-ee-rpm-repo-test"
|
||||
_ee_rpm_v=$retval
|
||||
_ee_rpm_v="$retval"
|
||||
fi
|
||||
|
||||
echo Versions:
|
||||
echo OSS deb = ${_oss_deb_v}
|
||||
echo OSS rpm = ${_oss_rpm_v}
|
||||
echo EE deb = ${_ee_deb_v}
|
||||
echo EE rpm = ${_ee_rpm_v}
|
||||
echo OSS deb = "${_oss_deb_v}"
|
||||
echo OSS rpm = "${_oss_rpm_v}"
|
||||
echo EE deb = "${_ee_deb_v}"
|
||||
echo EE rpm = "${_ee_rpm_v}"
|
||||
|
Loading…
Reference in New Issue
Block a user