The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/.circleci/config.yml

1431 lines
44 KiB

version: 2.1
aliases:
# Workflow filters
- &filter-only-release
branches:
only: chore/test-release-pipeline
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
- &filter-not-release-or-master
tags:
ignore: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: master
- &filter-only-master
branches:
only: master
- &filter-master-or-release
branches:
only:
- master
- chore/test-release-pipeline
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
executors:
grafana-build:
docker:
- image: grafana/build-container:1.2.13
grafana-publish:
docker:
- image: grafana/grafana-ci-deploy:1.2.3
docker:
machine:
image: circleci/classic:201808-01
cloud-sdk:
docker:
- image: google/cloud-sdk
windows-installer:
docker:
- image: grafana/wix-toolset-ci:v3
jobs:
install-grabpl:
description: Install the Grafana Build Pipeline tool
executor: grafana-build
steps:
- run:
name: Clone repo
command: |
mkdir -p ~/.ssh
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
git clone git@github.com:grafana/build-pipeline.git
- run:
name: Install Grafana Build Pipeline
command: |
cd build-pipeline
go build -o ../bin/grabpl ./cmd/grabpl
- persist_to_workspace:
root: .
paths:
- bin/grabpl
build-backend:
description: "Build a certain variant of Grafana back-end binaries"
parameters:
edition:
type: string
variant:
type: string
executor: grafana-build
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Build Grafana backend
command: |
if [[ -n $CIRCLE_TAG ]]; then
# A release build
/tmp/workspace/bin/grabpl build-backend --edition << parameters.edition >> \
--variants << parameters.variant >> $CIRCLE_TAG
elif [[ $CIRCLE_BRANCH == "master" ]]; then
# A master build
/tmp/workspace/bin/grabpl build-backend --edition << parameters.edition >> \
--variants << parameters.variant >> --build-id $CIRCLE_WORKFLOW_ID
elif [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then
# We're testing the release pipeline
/tmp/workspace/bin/grabpl build-backend --edition << parameters.edition >> \
--variants << parameters.variant >> v6.7.0-beta1
else
echo "Unknown branch trigger: $CIRCLE_BRANCH"
exit 1
fi
- run:
name: Move artifacts
command: mkdir -p << parameters.edition >> && mv bin << parameters.edition >>/
- persist_to_workspace:
root: .
paths:
- << parameters.edition >>/bin/*
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
build-frontend:
description: "Build Grafana front-end artifacts"
parameters:
edition:
type: string
executor: grafana-build
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: Increase node memory
command: |
export NODE_OPTIONS=--max_old_space_size=4096
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Build Grafana frontend
command: /tmp/workspace/bin/grabpl build-frontend --edition << parameters.edition >>
- run:
name: Move artifacts
command: mkdir << parameters.edition >> && cp -r public << parameters.edition >>/
- persist_to_workspace:
root: .
paths:
- << parameters.edition >>/public/*
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
build-release-publisher:
description: "Build release-publisher"
executor: grafana-build
steps:
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Test and build Grafana.com release publisher
command: |
cd scripts/build/release_publisher
go test .
go build -o release_publisher .
- persist_to_workspace:
root: .
paths:
- scripts/build/release_publisher/release_publisher
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
shellcheck-grabpl:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: ShellCheck
command: /tmp/workspace/bin/grabpl shellcheck
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
build-oss-windows-installer:
executor: windows-installer
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Copy artifacts from workspace
command: cp -r /tmp/workspace/oss/dist .
- run:
name: Build Windows installer
command: ./scripts/build/ci-msi-build/ci-msi-build-oss.sh
- run:
name: Move artifacts
command: mkdir oss && mv dist oss/
- persist_to_workspace:
root: .
paths:
- oss/dist/grafana-*.msi
- oss/dist/grafana-*.msi.sha256
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
build-enterprise-windows-installer:
executor: windows-installer
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: "./scripts/ci-job-started.sh"
- run:
name: Copy artifacts from workspace
command: cp -r /tmp/workspace/enterprise/dist enterprise-dist
- run:
name: Build Windows installer
command: ./scripts/build/ci-msi-build/ci-msi-build-ee.sh
- run:
name: Move artifacts
command: mkdir enterprise && mv enterprise-dist enterprise/dist
- persist_to_workspace:
root: .
paths:
- enterprise/dist/grafana-*.msi
- enterprise/dist/grafana-*.msi.sha256
- run:
name: CI job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: CI job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
release-next-packages:
executor: grafana-build
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Bootstrap lerna
command: npx lerna bootstrap
- run:
name: npm - Prepare auth token
command: "echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc"
- run:
name: Release next packages
command: ./scripts/circle-release-next-packages.sh
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
package-oss:
executor: grafana-build
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Copy artifacts from workspace
command: cp -r /tmp/workspace/oss/* .
- run:
name: Package Grafana
command: |
if [[ -n $CIRCLE_TAG ]]; then
# A release build
/tmp/workspace/bin/grabpl package --edition oss $CIRCLE_TAG
elif [[ $CIRCLE_BRANCH == "master" ]]; then
# A master build
/tmp/workspace/bin/grabpl package --edition oss --build-id $CIRCLE_WORKFLOW_ID
elif [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then
# We're testing the release pipeline
/tmp/workspace/bin/grabpl package --edition oss v6.7.0-beta1
else
echo "Unknown branch trigger: $CIRCLE_BRANCH"
exit 1
fi
- run:
name: Move artifacts
command: |
mkdir -p oss
mv dist oss/
- persist_to_workspace:
root: .
paths:
- oss/dist/*
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
package-enterprise:
executor: grafana-build
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Copy artifacts from workspace
command: cp -r /tmp/workspace/enterprise/* .
- run:
name: Package Grafana
command: |
if [[ -n $CIRCLE_TAG ]]; then
# A release build
/tmp/workspace/bin/grabpl package --edition enterprise $CIRCLE_TAG
elif [[ $CIRCLE_BRANCH == "master" ]]; then
# A master build
/tmp/workspace/bin/grabpl package --edition enterprise --build-id $CIRCLE_WORKFLOW_ID
elif [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then
# We're testing the release pipeline
/tmp/workspace/bin/grabpl package --edition enterprise v6.7.0-beta1
else
echo "Unknown branch trigger: $CIRCLE_BRANCH"
exit 1
fi
- run:
name: Move artifacts
command: |
mkdir -p enterprise
mv dist enterprise/
- persist_to_workspace:
root: .
paths:
- enterprise/dist/*
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
publish-packages:
description: "Publish packages"
parameters:
edition:
type: string
executor: grafana-publish
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Publish packages
command: |
cp -r /tmp/workspace/<< parameters.edition >>/dist .
if [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then
# We're testing the release pipeline
/tmp/workspace/bin/grabpl publish-packages --edition << parameters.edition >> \
--deb-db-bucket grafana-testing-aptly-db --deb-repo-bucket grafana-testing-repo --packages-bucket \
grafana-downloads-test --rpm-repo-bucket grafana-testing-repo --simulate-release
else
/tmp/workspace/bin/grabpl publish-packages --edition << parameters.edition >>
fi
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
build-docker-images:
description: "Build Docker images"
parameters:
edition:
type: string
ubuntu:
type: boolean
executor: docker
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run: docker info
# XXX: Is this necessary?
- run: docker run --privileged linuxkit/binfmt:v0.6
- run:
name: Copy Grafana archives
command: |
cp -r /tmp/workspace/<< parameters.edition >>/dist .
- run:
name: Build Docker images
command: |
/tmp/workspace/bin/grabpl build-docker --edition << parameters.edition >> --ubuntu=<< parameters.ubuntu >> $CIRCLE_WORKFLOW_ID
mkdir -p << parameters.edition >>/docker
mv docker/*.tar << parameters.edition >>/docker/
- persist_to_workspace:
root: .
paths:
- << parameters.edition >>/docker/*.tar
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
publish-docker-images:
description: Publish Docker images
parameters:
edition:
type: string
ubuntu:
type: boolean
executor: docker
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: CI job started
command: ./scripts/ci-job-started.sh
- run:
name: Copy artifacts from workspace
command: |
cp -r /tmp/workspace/<< parameters.edition >>/docker .
cp -r /tmp/workspace/<< parameters.edition >>/dist .
- run:
name: Publish Docker images
command: |
if [[ $CIRCLE_BRANCH == "chore/test-release-pipeline" ]]; then
# We're testing the release pipeline
/tmp/workspace/bin/grabpl publish-docker --edition << parameters.edition >> --ubuntu=<< parameters.ubuntu >> --dry-run
else
/tmp/workspace/bin/grabpl publish-docker --edition << parameters.edition >> --ubuntu=<< parameters.ubuntu >>
fi
- run:
name: CI job failed
command: ./scripts/ci-job-failed.sh
when: on_fail
- run:
name: CI job succeeded
command: ./scripts/ci-job-succeeded.sh
when: on_success
end-to-end-tests:
docker:
- image: circleci/node:12-browsers
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: yarn install
command: yarn install --pure-lockfile --no-progress
no_output_timeout: 5m
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: Start grafana-server
command: ./e2e/start-server
background: true
- run:
name: Run end-to-end tests
command: ./e2e/run-suite
no_output_timeout: 5m
- store_artifacts:
path: e2e/suite1/screenshots/expected
destination: expected-screenshots
- store_artifacts:
path: e2e/suite1/screenshots/received
destination: received-screenshots
- store_artifacts:
path: e2e/suite1/videos
destination: output-videos
- store_artifacts:
path: e2e/tmp/data/log
destination: logs
mysql-integration-test:
docker:
- image: circleci/golang:1.13.4
- image: circleci/mysql:5.6-ram
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: grafana_tests
MYSQL_USER: grafana
MYSQL_PASSWORD: password
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run: sudo apt update
- run: sudo apt install -y default-mysql-client
- run: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
- run: cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h 127.0.0.1 -P 3306 -u root -prootpass
- run:
name: mysql integration tests
command: "./scripts/circle-test-mysql.sh"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
postgres-integration-test:
docker:
- image: circleci/golang:1.13.4
- image: circleci/postgres:9.3-ram
environment:
POSTGRES_USER: grafanatest
POSTGRES_PASSWORD: grafanatest
POSTGRES_DB: grafanatest
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run: sudo apt update
- run: sudo apt install -y postgresql-client
- run: dockerize -wait tcp://127.0.0.1:5432 -timeout 120s
- run: "PGPASSWORD=grafanatest psql -p 5432 -h 127.0.0.1 -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql"
- run:
name: postgres integration tests
command: "./scripts/circle-test-postgres.sh"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
cache-server-test:
docker:
- image: circleci/golang:1.13.4
- image: circleci/redis:4-alpine
- image: memcached
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run: dockerize -wait tcp://127.0.0.1:11211 -timeout 120s
- run: dockerize -wait tcp://127.0.0.1:6379 -timeout 120s
- run:
name: cache server tests
command: "./scripts/circle-test-cache-servers.sh"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
codespell:
docker:
- image: circleci/python
steps:
- checkout
- run:
name: install codespell
command: "sudo pip install codespell"
- run:
# Important: all words have to be in lowercase, and separated by "\n".
name: exclude known exceptions
Docs: adding first version of the auto-generated packages API docs. (#22107) * trying out api-extractor. * works with our setup of build. * wip. * changed the packages so it works better with the api-extractor. * Changes to make the api-extractor to work. * cleaned up the api-extractor config files. * added some more documentation. * added tsdoc-metadata to gitignore. * removed the generated docs (will do that in another PR). * added execute permission to script for generating dosc. * added so we will push generated docs to branch. * will clean packages_api on abort. * Fixed failing tests. * fixed formatting issue with typedoc comment. * temporarily disabled tslint rules about namespace until https://github.com/microsoft/rushstack/issues/1029 is resolved * temporary enabled bable namespaces. * updated build script. * updated script. * updated script with some colors. * changed to camelCase. * removed spacing. * Starting to add documentation guidelines. * added examples headline. * added menu options. * added parameters and return values. * Fixed merge error. * Added first version of auto-generated docs. * changed so we use the eslint ignore syntax. * changed to correct eslint ingnore comment. * fixed some spelling errors reported by codespell. * added script to generate docs in current folder. * updated api docs. * lerna bootstrap. * added eror to the ingore words list. * removed file that should be ignored. * updated locKFILE. * referenced the code comments guidelines. * updated packages. * updated deps. * updated the autogenerated dosc. * adding missing new line.
5 years ago
command: 'echo -e "unknwon\nreferer\nerrorstring\neror" > words_to_ignore.txt'
- run:
name: check documentation spelling errors
command: "codespell -I ./words_to_ignore.txt docs/"
lint-go:
docker:
- image: circleci/golang:1.13.4
environment:
# we need CGO because of go-sqlite3
CGO_ENABLED: 1
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
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:12
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: yarn install
command: "yarn install --frozen-lockfile --no-progress"
no_output_timeout: 15m
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- run:
name: frontend tests
command: "./scripts/circle-test-frontend.sh"
- store_test_results:
path: reports/junit
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
test-backend:
docker:
- image: circleci/golang:1.13.4
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run:
name: build backend and run go tests
command: "./scripts/circle-test-backend.sh"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-fast-backend:
docker:
- image: grafana/build-container:1.2.13
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: prepare build tools
command: "/tmp/bootstrap.sh"
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run:
name: build grafana backend
command: "./scripts/build/build.sh --fast --backend-only"
- persist_to_workspace:
root: .
paths:
- bin/*
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-fast-frontend:
docker:
- image: grafana/build-container:1.2.13
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: Increase node memory
command: |
export NODE_OPTIONS=--max_old_space_size=4096
- run:
name: prepare build tools
command: "/tmp/bootstrap.sh"
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- restore_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: build grafana frontend
command: "./scripts/build/build.sh --fast --frontend-only"
- run:
name: es-check install
command: "yarn global add es-check"
- run:
name: es-check run
command: "es-check es5 ./public/build/*.js"
- save_cache:
key: frontend-dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
- persist_to_workspace:
root: .
paths:
- public/build/*
- public/views/*
- tools/phantomjs/*
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-docs-website:
docker:
- image: grafana/build-container:1.2.13
working_directory: /docs
steps:
- checkout
- setup_remote_docker
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run:
name: install docker
command: |
apt-get update
apt-get install -y docker.io
- run:
name: build grafana docs website
command: |
# https://circleci.com/docs/2.0/building-docker-images/#mounting-folders
# create a dummy container which will hold a volume with config
docker create -v /hugo/content/docs/grafana --name docs-website alpine:3.4 /bin/true
# copy a config file into this volume
docker cp ${PWD}/docs/sources docs-website:/hugo/content/docs/grafana/latest
# start an application container using this volume
docker run --volumes-from docs-website --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make prod'
- run:
name: ci job failed
command: "docker stop docs-website && docker rm docs-website && ./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "docker stop docs-website && docker rm docs-website && ./scripts/ci-job-succeeded.sh"
when: on_success
build-fast-package:
docker:
- image: grafana/build-container:1.2.13
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- 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: Move artifacts
command: mkdir -p oss && mv dist oss
- run:
name: Test Grafana.com release publisher
command: "cd scripts/build/release_publisher && go test ."
- persist_to_workspace:
root: .
paths:
- oss/dist/*
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-fast-save:
docker:
- image: grafana/build-container:1.2.13
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- 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: Prepare GPG private key
command: "./scripts/build/prepare_signing_key.sh"
- run:
name: sign packages
command: "./scripts/build/sign_packages.sh dist/*.rpm"
- 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/*
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
grafana-docker-pr:
machine:
image: circleci/classic:201808-01
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- attach_workspace:
at: .
- run: docker info
- run: docker run --privileged linuxkit/binfmt:v0.6
- run: cp oss/dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cd packaging/docker && ./build.sh --fast "${CIRCLE_SHA1}"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
grafana-docker-ubuntu-pr:
machine:
image: circleci/classic:201808-01
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- attach_workspace:
at: .
- run: docker info
- run: docker run --privileged linuxkit/binfmt:v0.6
- run: cp oss/dist/grafana-latest.linux-*.tar.gz packaging/docker
- run: cd packaging/docker && ./build.sh --fast --ubuntu "${CIRCLE_SHA1}"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
build-grafana-packages:
docker:
- image: circleci/node:12
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run:
name: Boostrap lerna
command: "npx lerna bootstrap"
- run:
name: Build packages
command: yarn packages:build
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
release-packages:
docker:
- image: circleci/node:12
steps:
- checkout
- run:
name: ci job started
command: "./scripts/ci-job-started.sh"
- run:
name: Boostrap lerna
command: "npx lerna bootstrap"
- run:
name: npm - Prepare auth token
command: "echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc"
- run:
name: Release packages
command: ./scripts/build/release-packages.sh "${CIRCLE_TAG}"
- run:
name: ci job failed
command: "./scripts/ci-job-failed.sh"
when: on_fail
- run:
name: ci job succeeded
command: "./scripts/ci-job-succeeded.sh"
when: on_success
scan-docker-master:
docker:
- image: circleci/buildpack-deps:stretch
steps:
- setup_remote_docker
- restore_cache:
key: vulnerability-db
- run:
name: Install trivy
command: |
VERSION=$(
curl --silent "https://api.github.com/repos/aquasecurity/trivy/releases/latest" | \
grep '"tag_name":' | \
sed -E 's/.*"v([^"]+)".*/\1/'
)
wget https://github.com/aquasecurity/trivy/releases/download/v${VERSION}/trivy_${VERSION}_Linux-64bit.tar.gz
tar zxvf trivy_${VERSION}_Linux-64bit.tar.gz
sudo mv trivy /usr/local/bin
- run:
name: Clear trivy cache
command: trivy --clear-cache
- run:
name: Scan the latest grafana master alpine image with trivy
command: trivy --exit-code 1 grafana/grafana:master
- run:
name: Scan the latest grafana master ubuntu image with trivy
command: trivy --exit-code 1 grafana/grafana:master-ubuntu
- save_cache:
key: vulnerability-db
paths:
- $HOME/.cache/trivy
workflows:
build-pipeline:
jobs:
- install-grabpl:
filters: *filter-master-or-release
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: armv6
name: build-oss-backend-armv6
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: armv7
name: build-oss-backend-armv7
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: armv7-musl
name: build-oss-backend-armv7-musl
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: arm64
name: build-oss-backend-arm64
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: arm64-musl
name: build-oss-backend-arm64-musl
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: osx64
name: build-oss-backend-osx64
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: win64
name: build-oss-backend-win64
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: linux-x64
name: build-oss-backend-linux-x64
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
edition: oss
variant: linux-x64-musl
name: build-oss-backend-linux-x64-musl
requires:
- install-grabpl
- build-frontend:
filters: *filter-master-or-release
name: build-oss-frontend
edition: oss
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-armv6
edition: enterprise
variant: armv6
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-armv7
edition: enterprise
variant: armv7
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-armv7-musl
edition: enterprise
variant: armv7-musl
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-arm64
edition: enterprise
variant: arm64
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-arm64-musl
edition: enterprise
variant: arm64-musl
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-osx64
edition: enterprise
variant: osx64
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-win64
edition: enterprise
variant: win64
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-linux-x64
edition: enterprise
variant: linux-x64
requires:
- install-grabpl
- build-backend:
filters: *filter-master-or-release
name: build-enterprise-backend-linux-x64-musl
edition: enterprise
variant: linux-x64-musl
requires:
- install-grabpl
- build-frontend:
filters: *filter-master-or-release
name: build-enterprise-frontend
edition: enterprise
requires:
- install-grabpl
- build-release-publisher:
filters: *filter-master-or-release
- codespell:
filters: *filter-master-or-release
requires:
- install-grabpl
- lint-go:
filters: *filter-master-or-release
requires:
- install-grabpl
- shellcheck-grabpl:
filters: *filter-master-or-release
requires:
- install-grabpl
- test-backend:
filters: *filter-master-or-release
requires:
- install-grabpl
- lint-go
- test-frontend:
filters: *filter-master-or-release
requires:
- install-grabpl
- mysql-integration-test:
filters: *filter-master-or-release
requires:
- install-grabpl
- lint-go
- postgres-integration-test:
filters: *filter-master-or-release
requires:
- install-grabpl
- lint-go
- package-oss:
filters: *filter-master-or-release
requires:
- install-grabpl
- build-oss-backend-armv6
- build-oss-backend-armv7
- build-oss-backend-armv7-musl
- build-oss-backend-arm64
- build-oss-backend-arm64-musl
- build-oss-backend-osx64
- build-oss-backend-win64
- build-oss-backend-linux-x64
- build-oss-backend-linux-x64-musl
- build-oss-frontend
- test-backend
- test-frontend
- codespell
- shellcheck-grabpl
- mysql-integration-test
- postgres-integration-test
- package-enterprise:
filters: *filter-master-or-release
requires:
- install-grabpl
- build-enterprise-backend-armv6
- build-enterprise-backend-armv7
- build-enterprise-backend-armv7-musl
- build-enterprise-backend-arm64
- build-enterprise-backend-arm64-musl
- build-enterprise-backend-osx64
- build-enterprise-backend-win64
- build-enterprise-backend-linux-x64
- build-enterprise-backend-linux-x64-musl
- build-enterprise-frontend
- test-backend
- test-frontend
- codespell
- shellcheck-grabpl
- mysql-integration-test
- postgres-integration-test
- build-oss-windows-installer:
filters: *filter-master-or-release
requires:
- package-oss
- build-enterprise-windows-installer:
filters: *filter-master-or-release
requires:
- package-enterprise
- release-next-packages:
filters: *filter-only-master
requires:
- test-frontend
- release-packages:
filters: *filter-only-release
requires:
- end-to-end-tests
- publish-packages:
filters: *filter-master-or-release
name: publish-oss-packages
edition: oss
requires:
- package-oss
- build-oss-windows-installer
- end-to-end-tests
- build-release-publisher
- publish-packages:
filters: *filter-master-or-release
name: publish-enterprise-packages
edition: enterprise
requires:
- package-enterprise
- build-enterprise-windows-installer
- end-to-end-tests
- build-release-publisher
- build-docker-images:
filters: *filter-master-or-release
name: build-oss-docker-images
edition: oss
ubuntu: false
requires:
- package-oss
- build-oss-windows-installer
- build-docker-images:
filters: *filter-master-or-release
name: build-oss-ubuntu-docker-images
edition: oss
ubuntu: true
requires:
- package-oss
- build-oss-windows-installer
- build-docker-images:
filters: *filter-master-or-release
name: build-enterprise-docker-images
edition: enterprise
ubuntu: false
requires:
- package-enterprise
- build-enterprise-windows-installer
- build-docker-images:
filters: *filter-master-or-release
name: build-enterprise-ubuntu-docker-images
edition: enterprise
ubuntu: true
requires:
- package-enterprise
- build-enterprise-windows-installer
- end-to-end-tests:
filters: *filter-master-or-release
requires:
- package-oss
- publish-docker-images:
filters: *filter-master-or-release
name: publish-oss-docker-images
edition: oss
ubuntu: false
requires:
- build-oss-docker-images
- end-to-end-tests
- publish-docker-images:
filters: *filter-master-or-release
name: publish-oss-ubuntu-docker-images
edition: oss
ubuntu: true
requires:
- build-oss-ubuntu-docker-images
- end-to-end-tests
- publish-docker-images:
filters: *filter-master-or-release
name: publish-enterprise-docker-images
edition: enterprise
ubuntu: false
requires:
- build-enterprise-docker-images
- end-to-end-tests
- publish-docker-images:
filters: *filter-master-or-release
name: publish-enterprise-ubuntu-docker-images
edition: enterprise
ubuntu: true
requires:
- build-enterprise-ubuntu-docker-images
- end-to-end-tests
build-branches-and-prs:
jobs:
- build-fast-backend:
filters: *filter-not-release-or-master
- build-fast-frontend:
filters: *filter-not-release-or-master
- build-grafana-packages:
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
- 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:
filters: *filter-not-release-or-master
- mysql-integration-test:
filters: *filter-not-release-or-master
- postgres-integration-test:
filters: *filter-not-release-or-master
- cache-server-test:
filters: *filter-not-release-or-master
- end-to-end-tests:
filters: *filter-not-release-or-master
requires:
- build-fast-package
- test-backend
- test-frontend
- lint-go
- grafana-docker-pr:
requires:
- build-fast-package
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- grafana-docker-ubuntu-pr:
requires:
- build-fast-package
- test-backend
- test-frontend
- codespell
- lint-go
- shellcheck
- mysql-integration-test
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
- build-docs-website:
filters: *filter-not-release-or-master
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters: *filter-only-master
jobs:
- scan-docker-master