Skip to content

Commit

Permalink
Merge remote-tracking branch 'grafana/master' into min-max-field
Browse files Browse the repository at this point in the history
* grafana/master:
  FormLabel: allow any rather than just a string for tooltip (grafana#16841)
  prometheus: fix regression after adding support for tracing headers (grafana#16829)
  area/circleci: Speed up circleci build process for branches and pr (grafana#16778)
  • Loading branch information
ryantxu committed May 1, 2019
2 parents fb13a30 + 2e326d1 commit cc2f6f2
Show file tree
Hide file tree
Showing 6 changed files with 278 additions and 42 deletions.
126 changes: 122 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,117 @@ jobs:
paths:
- dist/*

build-fast-backend:
docker:
- image: grafana/build-container:1.2.6
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- run:
name: build grafana backend
command: './scripts/build/build.sh --fast --backend-only'
- persist_to_workspace:
root: .
paths:
- bin/*

build-fast-frontend:
docker:
- image: grafana/build-container:1.2.6
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- restore_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: build grafana frontend
command: './scripts/build/build.sh --fast --frontend-only'
- save_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- persist_to_workspace:
root: .
paths:
- public/build/*
- tools/phantomjs/*

build-fast-package:
docker:
- image: grafana/build-container:1.2.6
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- run:
name: package grafana
command: './scripts/build/build.sh --fast --package-only'
- run:
name: sha-sum packages
command: 'go run build.go sha-dist'
- run:
name: Test Grafana.com release publisher
command: 'cd scripts/build/release_publisher && go test .'
- persist_to_workspace:
root: /go/src/github.com/grafana/grafana
paths:
- dist/*

build-fast-save:
docker:
- image: grafana/build-container:1.2.6
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: debug cache
command: 'ls -al /go/src/github.com/grafana/grafana/node_modules'
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- run:
name: build grafana backend
command: './scripts/build/build.sh --fast --backend-only'
- run:
name: build grafana frontend
command: './scripts/build/build.sh --fast --frontend-only'
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- /go/src/github.com/grafana/grafana/node_modules
- run:
name: package grafana
command: './scripts/build/build.sh --fast --package-only'
- run:
name: sign packages
command: './scripts/build/sign_packages.sh'
- run:
name: sha-sum packages
command: 'go run build.go sha-dist'
- run:
name: Test Grafana.com release publisher
command: 'cd scripts/build/release_publisher && go test .'
- persist_to_workspace:
root: .
paths:
- dist/*

grafana-docker-master:
machine:
image: circleci/classic:201808-01
Expand All @@ -224,7 +335,7 @@ jobs:
- run: docker info
- run: docker run --privileged linuxkit/binfmt:v0.6
- run: cp dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cd packaging/docker && ./build.sh "${CIRCLE_SHA1}"
- run: cd packaging/docker && ./build.sh --fast "${CIRCLE_SHA1}"

grafana-docker-release:
machine:
Expand Down Expand Up @@ -556,8 +667,15 @@ workflows:

build-branches-and-prs:
jobs:
- build:
- build-fast-backend:
filters: *filter-not-release-or-master
- build-fast-frontend:
filters: *filter-not-release-or-master
- build-fast-package:
filters: *filter-not-release-or-master
requires:
- build-fast-backend
- build-fast-frontend
- codespell:
filters: *filter-not-release-or-master
- backend-lint:
Expand All @@ -574,7 +692,7 @@ workflows:
filters: *filter-not-release-or-master
- grafana-docker-pr:
requires:
- build
- build-fast-package
- test-backend
- test-frontend
- codespell
Expand All @@ -585,7 +703,7 @@ workflows:
filters: *filter-not-release-or-master
- store-build-artifacts:
requires:
- build
- build-fast-package
- test-backend
- test-frontend
- codespell
Expand Down
1 change: 1 addition & 0 deletions packaging/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ FROM ${BASE_IMAGE}

ARG GF_UID="472"
ARG GF_GID="472"
ARG DEBIAN_FRONTEND=noninteractive

ENV PATH=/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
GF_PATHS_CONFIG="/etc/grafana/grafana.ini" \
Expand Down
36 changes: 30 additions & 6 deletions packaging/docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
BUILD_FAST=0

while [ "$1" != "" ]; do
case "$1" in
"--fast")
BUILD_FAST=1
echo "Fast build enabled"
shift
;;
* )
# unknown param causes args to be passed through to $@
break
;;
esac
done

_grafana_tag=${1:-}
_docker_repo=${2:-grafana/grafana}
Expand Down Expand Up @@ -27,19 +42,28 @@ docker_build () {
--no-cache=true .
}

docker_tag_linux_amd64 () {
repo=$1
tag=$2
docker tag "${_docker_repo}:${_grafana_version}" "${repo}:${tag}"
}

# Tag docker images of all architectures
docker_tag_all () {
repo=$1
tag=$2
docker tag "${_docker_repo}:${_grafana_version}" "${repo}:${tag}"
docker tag "${_docker_repo}-arm32v7-linux:${_grafana_version}" "${repo}-arm32v7-linux:${tag}"
docker tag "${_docker_repo}-arm64v8-linux:${_grafana_version}" "${repo}-arm64v8-linux:${tag}"
docker_tag_linux_amd64 $1 $2
if [ $BUILD_FAST = "0" ]; then
docker tag "${_docker_repo}-arm32v7-linux:${_grafana_version}" "${repo}-arm32v7-linux:${tag}"
docker tag "${_docker_repo}-arm64v8-linux:${_grafana_version}" "${repo}-arm64v8-linux:${tag}"
fi
}

docker_build "debian:stretch-slim" "grafana-latest.linux-x64.tar.gz" "${_docker_repo}:${_grafana_version}"
docker_build "arm32v7/debian:stretch-slim" "grafana-latest.linux-armv7.tar.gz" "${_docker_repo}-arm32v7-linux:${_grafana_version}"
docker_build "arm64v8/debian:stretch-slim" "grafana-latest.linux-arm64.tar.gz" "${_docker_repo}-arm64v8-linux:${_grafana_version}"

if [ $BUILD_FAST = "0" ]; then
docker_build "arm32v7/debian:stretch-slim" "grafana-latest.linux-armv7.tar.gz" "${_docker_repo}-arm32v7-linux:${_grafana_version}"
docker_build "arm64v8/debian:stretch-slim" "grafana-latest.linux-arm64.tar.gz" "${_docker_repo}-arm64v8-linux:${_grafana_version}"
fi
# Tag as 'latest' for official release; otherwise tag as grafana/grafana:master
if echo "$_grafana_tag" | grep -q "^v"; then
docker_tag_all "${_docker_repo}" "latest"
Expand Down
1 change: 1 addition & 0 deletions public/app/plugins/datasource/prometheus/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class PrometheusDatasource implements DataSourceApi<PromQuery> {
options = _.defaults(options || {}, {
url: this.url + url,
method: this.httpMethod,
headers: {},
});

if (options.method === 'GET') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ describe('PrometheusMetricFindQuery', () => {
method: 'GET',
url: 'proxied/api/v1/labels',
silent: true,
headers: {},
});
});

Expand All @@ -75,6 +76,7 @@ describe('PrometheusMetricFindQuery', () => {
method: 'GET',
url: 'proxied/api/v1/label/resource/values',
silent: true,
headers: {},
});
});

Expand All @@ -97,6 +99,7 @@ describe('PrometheusMetricFindQuery', () => {
method: 'GET',
url: `proxied/api/v1/series?match[]=metric&start=${raw.from.unix()}&end=${raw.to.unix()}`,
silent: true,
headers: {},
});
});

Expand All @@ -121,6 +124,7 @@ describe('PrometheusMetricFindQuery', () => {
'metric{label1="foo", label2="bar", label3="baz"}'
)}&start=${raw.from.unix()}&end=${raw.to.unix()}`,
silent: true,
headers: {},
});
});

Expand All @@ -145,6 +149,7 @@ describe('PrometheusMetricFindQuery', () => {
method: 'GET',
url: `proxied/api/v1/series?match[]=metric&start=${raw.from.unix()}&end=${raw.to.unix()}`,
silent: true,
headers: {},
});
});

Expand All @@ -163,6 +168,7 @@ describe('PrometheusMetricFindQuery', () => {
method: 'GET',
url: 'proxied/api/v1/label/__name__/values',
silent: true,
headers: {},
});
});

Expand Down Expand Up @@ -190,6 +196,7 @@ describe('PrometheusMetricFindQuery', () => {
method: 'GET',
url: `proxied/api/v1/query?query=metric&time=${raw.to.unix()}`,
requestId: undefined,
headers: {},
});
});

Expand Down Expand Up @@ -217,6 +224,7 @@ describe('PrometheusMetricFindQuery', () => {
'up{job="job1"}'
)}&start=${raw.from.unix()}&end=${raw.to.unix()}`,
silent: true,
headers: {},
});
});
});
Expand Down
Loading

0 comments on commit cc2f6f2

Please sign in to comment.