Merge branch 'master' into bump-webpack

# Conflicts:
#	package.json
#	yarn.lock
This commit is contained in:
Johannes Schill
2019-03-20 09:43:33 +01:00
216 changed files with 7282 additions and 2841 deletions
+114
View File
@@ -0,0 +1,114 @@
FROM ubuntu:14.04 as toolchain
ENV OSX_SDK_URL=https://s3.dockerproject.org/darwin/v2/ \
OSX_SDK=MacOSX10.10.sdk \
OSX_MIN=10.10 \
CTNG=1.23.0
# FIRST PART
# build osx64 toolchain (stripped of man documentation)
# the toolchain produced is not self contained, it needs clang at runtime
#
# SECOND PART
# build gcc (no g++) centos6-x64 toolchain
# doc: https://crosstool-ng.github.io/docs/
# apt-get should be all dep to build toolchain
# sed and 1st echo are for convenience to get the toolchain in /tmp/x86_64-centos6-linux-gnu
# other echo are to enable build by root (crosstool-NG refuse to do that by default)
# the last 2 rm are just to save some time and space writing docker layers
#
# THIRD PART
# build fpm and creates a set of deb from gem
# ruby2.0 depends on ruby1.9.3 which is install as default ruby
# rm/ln are here to change that
# created deb depends on rubygem-json but json gem is not build
# so do by hand
# might wanna make sure osx cross and the other tarball as well as the packages ends up somewhere other than tmp
# might also wanna put them as their own layer to not have to unpack them every time?
RUN apt-get update && \
apt-get install -y \
clang-3.8 patch libxml2-dev \
ca-certificates \
curl \
git \
make \
xz-utils && \
git clone https://github.com/tpoechtrager/osxcross.git /tmp/osxcross && \
curl -L ${OSX_SDK_URL}/${OSX_SDK}.tar.xz -o /tmp/osxcross/tarballs/${OSX_SDK}.tar.xz && \
ln -s /usr/bin/clang-3.8 /usr/bin/clang && \
ln -s /usr/bin/clang++-3.8 /usr/bin/clang++ && \
ln -s /usr/bin/llvm-dsymutil-3.8 /usr/bin/dsymutil && \
UNATTENDED=yes OSX_VERSION_MIN=${OSX_MIN} /tmp/osxcross/build.sh && \
rm -rf /tmp/osxcross/target/SDK/${OSX_SDK}/usr/share && \
cd /tmp && \
tar cfJ osxcross.tar.xz osxcross/target && \
rm -rf /tmp/osxcross && \
apt-get install -y \
bison curl flex gawk gcc g++ gperf help2man libncurses5-dev make patch python-dev texinfo xz-utils && \
curl -L http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-${CTNG}.tar.xz \
| tar -xJ -C /tmp/ && \
cd /tmp/crosstool-ng-${CTNG} && \
./configure --enable-local && \
make && \
./ct-ng x86_64-centos6-linux-gnu && \
sed -i '/CT_PREFIX_DIR=/d' .config && \
echo 'CT_PREFIX_DIR="/tmp/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"' >> .config && \
echo 'CT_EXPERIMENTAL=y' >> .config && \
echo 'CT_ALLOW_BUILD_AS_ROOT=y' >> .config && \
echo 'CT_ALLOW_BUILD_AS_ROOT_SURE=y' >> .config && \
./ct-ng build && \
cd /tmp && \
rm /tmp/x86_64-centos6-linux-gnu/build.log.bz2 && \
tar cfJ x86_64-centos6-linux-gnu.tar.xz x86_64-centos6-linux-gnu/ && \
rm -rf /tmp/x86_64-centos6-linux-gnu/ && \
rm -rf /tmp/crosstool-ng-${CTNG}
# base image to crossbuild grafana
FROM ubuntu:14.04
ENV GOVERSION=1.11.5 \
PATH=/usr/local/go/bin:$PATH \
GOPATH=/go \
NODEVERSION=10.14.2
COPY --from=toolchain /tmp/x86_64-centos6-linux-gnu.tar.xz /tmp/
COPY --from=toolchain /tmp/osxcross.tar.xz /tmp/
RUN apt-get update && \
apt-get install -y \
clang-3.8 gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-mingw-w64-x86-64 \
apt-transport-https \
ca-certificates \
curl \
libfontconfig1 \
gcc \
g++ \
git \
make \
rpm \
xz-utils \
expect \
gnupg2 \
unzip && \
ln -s /usr/bin/clang-3.8 /usr/bin/clang && \
ln -s /usr/bin/clang++-3.8 /usr/bin/clang++ && \
ln -s /usr/bin/llvm-dsymutil-3.8 /usr/bin/dsymutil && \
curl -L https://nodejs.org/dist/v${NODEVERSION}/node-v${NODEVERSION}-linux-x64.tar.xz \
| tar -xJ --strip-components=1 -C /usr/local && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb [arch=amd64] https://dl.yarnpkg.com/debian/ stable main" \
| tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install --no-install-recommends yarn && \
curl -L https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz \
| tar -xz -C /usr/local
RUN apt-get install -y \
gcc libc-dev make && \
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
curl -sSL https://get.rvm.io | bash -s stable && \
/bin/bash -l -c "rvm requirements && rvm install 2.2 && gem install -N fpm"
ADD ./bootstrap.sh /tmp/bootstrap.sh
+54
View File
@@ -0,0 +1,54 @@
VERSION="dev"
TAG="grafana/build-container"
USER_ID=$(shell id -u)
GROUP_ID=$(shell id -g)
all: build deploy
build:
docker build -t "${TAG}:${VERSION}" .
deploy:
docker push "${TAG}:${VERSION}"
run:
docker run -ti \
-e "CIRCLE_BRANCH=local" \
-e "CIRCLE_BUILD_NUM=472" \
${TAG}:${VERSION} \
bash
run-with-local-source-live:
docker run -d \
-e "CIRCLE_BRANCH=local" \
-e "CIRCLE_BUILD_NUM=472" \
-w "/go/src/github.com/grafana/grafana" \
--name grafana-build \
-v "${GOPATH}/src/github.com/grafana/grafana:/go/src/github.com/grafana/grafana" \
${TAG}:${VERSION} \
bash -c "/tmp/bootstrap.sh; mkdir /.cache; chown "${USER_ID}:${GROUP_ID}" /.cache; tail -f /dev/null"
docker exec -ti --user "${USER_ID}:${GROUP_ID}" grafana-build bash
run-with-local-source-copy:
docker run -d \
-e "CIRCLE_BRANCH=local" \
-e "CIRCLE_BUILD_NUM=472" \
-w "/go/src/github.com/grafana/grafana" \
--name grafana-build \
${TAG}:${VERSION} \
bash -c "/tmp/bootstrap.sh; tail -f /dev/null"
docker cp "${GOPATH}/src/github.com/grafana/grafana" grafana-build:/go/src/github.com/grafana/
docker exec -ti grafana-build bash
update-source:
docker cp "${GOPATH}/src/github.com/grafana/grafana" grafana-build:/go/src/github.com/grafana/
attach:
docker exec -ti grafana-build bash
attach-live:
docker exec -ti --user "${USER_ID}:${GROUP_ID}" grafana-build bash
stop:
docker kill grafana-build
docker rm grafana-build
+20
View File
@@ -0,0 +1,20 @@
# grafana-build-container
Grafana build container
## Description
This is a container for cross-platform builds of Grafana. You can run it locally using the Makefile.
## Makefile targets
* `make run-with-local-source-copy`
- Starts the container locally and copies your local sources into the container
* `make run-with-local-source-live`
- Starts the container (as your user) locally and maps your Grafana project dir into the container
* `make update-source`
- Updates the sources in the container from your local sources
* `make stop`
- Kills the container
* `make attach`
- Opens bash within the running container
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
cd /tmp
tar xfJ x86_64-centos6-linux-gnu.tar.xz
tar xfJ osxcross.tar.xz
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
_version="1.2.3"
_tag="grafana/build-container:${_version}"
docker build -t $_tag .
docker push $_tag
+1 -1
View File
@@ -10,7 +10,7 @@ FROM circleci/python:2.7-stretch
USER root
RUN pip install awscli && \
RUN pip install -U awscli crcmod && \
curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-222.0.0-linux-x86_64.tar.gz | \
tar xvzf - -C /opt && \
apt update && \
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
_version="1.2.0"
_version="1.2.1"
_tag="grafana/grafana-ci-deploy:${_version}"
docker build -t $_tag .
+16
View File
@@ -0,0 +1,16 @@
#!/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
}
echo "running redis and memcache tests"
time exit_if_fail go test -tags=redis ./pkg/infra/remotecache/...
time exit_if_fail go test -tags=memcached ./pkg/infra/remotecache/...
+1 -1
View File
@@ -14,7 +14,7 @@ function exit_if_fail {
start=$(date +%s)
exit_if_fail npm run prettier:check
# exit_if_fail npm run test
exit_if_fail npm run test
end=$(date +%s)
seconds=$((end - start))
+1 -2
View File
@@ -10,8 +10,7 @@ export const useSpinner = <T>(spinnerLabel: string, fn: FnToSpin<T>, killProcess
await fn(options);
spinner.succeed();
} catch (e) {
spinner.fail();
console.log(e);
spinner.fail(e);
if (killProcess) {
process.exit(1);
}
+5 -2
View File
@@ -34,14 +34,17 @@ module.exports = function (grunt) {
]);
grunt.registerTask('no-only-tests', function () {
var files = grunt.file.expand('public/**/*_specs\.ts', 'public/**/*_specs\.js');
var files = grunt.file.expand(
'public/**/*@(_specs|\.test)\.@(ts|js|tsx|jsx)',
'packages/grafana-ui/**/*@(_specs|\.test)\.@(ts|js|tsx|jsx)'
);
files.forEach(function (spec) {
var rows = grunt.file.read(spec).split('\n');
rows.forEach(function (row) {
if (row.indexOf('.only(') > 0) {
grunt.log.errorlns(row);
grunt.fail.warn('found only statement in test: ' + spec)
grunt.fail.warn('found only statement in test: ' + spec);
}
});
});