New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: Enable PR testing in Drone #26189
Merged
Merged
Changes from all commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
e70a9c2
Add Drone configuration
aknuds1 7ab70b5
Add more steps
aknuds1 b8395db
Add more steps
aknuds1 bf835f4
Build front-end before testing it
aknuds1 a782548
Upgrade grafana/build-container
aknuds1 d073ed4
Add packaging step
aknuds1 61269a2
Trigger on push
aknuds1 bd91311
Remove some steps
aknuds1 d6e4f80
Enable steps
aknuds1 471c43e
Install Dockerize
aknuds1 57a2513
Use node image for test-frontend
aknuds1 9f316db
Increase number of test workers
aknuds1 1821e58
Make plugin installation depend on frontend tests
aknuds1 3c8a652
Make integration tests depend on frontend tests
aknuds1 4f32fa1
Use grafana/build-container also for front-end tests
aknuds1 ef9853e
Upgrade dependencies in order to fix front-end tests
aknuds1 98160b0
Depend on es-check
aknuds1 8568a8e
Dont' depend on tests before building front-end
aknuds1 35f8d7f
Add more steps
aknuds1 63a8cae
Fix packaging
aknuds1 8e3d5e0
Simplify
aknuds1 3b834ef
Try to build images
aknuds1 f810bbc
Fix e2e tests
aknuds1 960152e
Remove steps
aknuds1 0ec1efc
Install netcat
aknuds1 3033d4a
Include golangci-lint with grafana/build-container
aknuds1 4175c0c
Build storybook and docs website
aknuds1 ed46e3d
Fix e2e tests
aknuds1 257ab88
Use build image with root user
aknuds1 f84edf3
Drop CircleCI dependencies
aknuds1 753c951
Fix e2e tests
aknuds1 0b48c5f
Fix e2e under Drone
aknuds1 9b1755c
Execute e2e server separately
aknuds1 9fe3d07
Use own plugin for building Docker images
aknuds1 50c2b10
Use Starlark to configure Drone
aknuds1 511959e
Add enterprise steps to pipeline
aknuds1 a37a58a
Add more enterprise steps to pipeline
aknuds1 d09835a
Maintain Yarn cache
aknuds1 8f3f581
Build enterprise Docker images
aknuds1 2e53dc0
Build Ubuntu Docker images
aknuds1 f19cd91
Refactor
aknuds1 0eee57a
Add Postgres integration test
aknuds1 abb5862
Add MySQL integration test
aknuds1 be20d90
Fix integration tests
aknuds1 8639721
Parameterize integration test DB connections
aknuds1 068913f
Categorize integration tests
aknuds1 de0666f
Use grabpl integration-tests
aknuds1 943977c
Remove unintended change
aknuds1 aa313d6
Drone: Disable Ubuntu Docker images for PR pipeline
aknuds1 d9cea25
Regenerate yarn.lock
aknuds1 9aa3de9
Upgrade grabpl
aknuds1 9207d81
Restore Yarn cache before installing in grafana-enterprise
aknuds1 090789d
Use separate pipelines for OSS and enterprise
aknuds1 6f17f95
Let OSS builds depend on tests
aknuds1 932d551
Restore Go cache before building back-end
aknuds1 9e63ccd
Reduce number of variants built for PRs
aknuds1 c2109ad
Fix building of Docker images
aknuds1 55a09a7
Merge remote-tracking branch 'grafana/master' into chore/drone-ci
aknuds1 444fa69
Drone: Simplify logic
aknuds1 80aa507
Drone: Use Starlark
aknuds1 567cc2b
Merge branch 'master' into chore/drone-ci
aknuds1 c757f26
Merge remote-tracking branch 'grafana/master' into chore/drone-ci
aknuds1 1b5f956
Drone: Fix syntax error
aknuds1 ef887af
Merge remote-tracking branch 'grafana/master' into chore/drone-ci
aknuds1 5fab713
Merge remote-tracking branch 'grafana/master' into chore/drone-ci
aknuds1 494eed2
Convert .drone.star to YAML
aknuds1 3c5a23a
Upgrade AWS Go SDK
aknuds1 c13ed85
Drone: Fix Go linting
aknuds1 bdfb282
Merge remote-tracking branch 'grafana/master' into chore/drone-ci
aknuds1 5152f65
Undo irrelevant changes
aknuds1 a017c55
Revert "Undo irrelevant changes"
aknuds1 f530dc0
Undo irrelevant changes
aknuds1 c1eb0e3
e2e: Support Circle
aknuds1 b46d46e
Remove unused script
aknuds1 379dddf
TypeScript fixes
aknuds1 83c17d8
TypeScript fixes
aknuds1 c113363
Remove unused script
aknuds1 8eddd42
More Drone support
aknuds1 b2aaf2d
Remove unused script
aknuds1 9baa156
Fix build on Circle
aknuds1 8fbbd24
Merge remote-tracking branch 'grafana/master' into chore/drone-ci
aknuds1 6db6f3c
Remove TODO comment
aknuds1 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,351 @@ | ||
--- | ||
kind: pipeline | ||
type: docker | ||
name: test-pr-oss | ||
|
||
platform: | ||
os: linux | ||
arch: amd64 | ||
|
||
steps: | ||
- name: install-deps | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v$${GRABPL_VERSION}/grabpl | ||
- chmod +x grabpl | ||
- mkdir -p bin | ||
- mv grabpl bin | ||
- curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz | ||
- tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz | ||
- rm dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz | ||
- yarn install --frozen-lockfile --no-progress | ||
- cp -r $(yarn cache dir) yarn-cache | ||
environment: | ||
DOCKERIZE_VERSION: 0.6.1 | ||
GRABPL_VERSION: 0.4.15 | ||
|
||
- name: lint-go | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- make lint-go | ||
environment: | ||
CGO_ENABLED: 1 | ||
depends_on: | ||
- install-deps | ||
|
||
- name: codespell | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- "echo -e \"unknwon\nreferer\nerrorstring\neror\niam\" > words_to_ignore.txt" | ||
- codespell -I words_to_ignore.txt docs/ | ||
depends_on: | ||
- install-deps | ||
|
||
- name: shellcheck | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- curl -fLO http://storage.googleapis.com/grafana-downloads/ci-dependencies/shellcheck-v$${VERSION}.linux.x86_64.tar.xz | ||
- echo $$CHKSUM shellcheck-v$${VERSION}.linux.x86_64.tar.xz | sha512sum --check --strict --status | ||
- tar xf shellcheck-v$${VERSION}.linux.x86_64.tar.xz | ||
- mv shellcheck-v$${VERSION}/shellcheck /usr/local/bin/ | ||
- rm -rf shellcheck-v$${VERSION}* | ||
- ./bin/grabpl shellcheck | ||
environment: | ||
CHKSUM: beca3d7819a6bdcfbd044576df4fc284053b48f468b2f03428fe66f4ceb2c05d9b5411357fa15003cb0311406c255084cf7283a3b8fce644c340c2f6aa910b9f | ||
VERSION: 0.7.1 | ||
depends_on: | ||
- install-deps | ||
|
||
- name: build-backend | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- rm -rf $(go env GOCACHE) && cp -r go-cache $(go env GOCACHE) | ||
- ./bin/grabpl build-backend --github-token "$${GITHUB_TOKEN}" --edition oss --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 | ||
environment: | ||
GITHUB_TOKEN: | ||
from_secret: github_token | ||
depends_on: | ||
- install-deps | ||
- lint-go | ||
- test-backend | ||
|
||
- name: build-frontend | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) | ||
- ./bin/grabpl build-frontend --no-install-deps --github-token "$${GITHUB_TOKEN}" --edition oss --build-id $DRONE_BUILD_NUMBER | ||
environment: | ||
GITHUB_TOKEN: | ||
from_secret: github_token | ||
depends_on: | ||
- install-deps | ||
- test-frontend | ||
|
||
- name: test-backend | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- go test -covermode=atomic ./pkg/... | ||
- ./bin/grabpl integration-tests | ||
- cp -r $(go env GOCACHE) go-cache | ||
depends_on: | ||
- install-deps | ||
- lint-go | ||
|
||
- name: test-frontend | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) | ||
- yarn run prettier:check | ||
- yarn run packages:typecheck | ||
- yarn run typecheck | ||
- yarn run test | ||
depends_on: | ||
- install-deps | ||
|
||
- name: build-plugins | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) | ||
- ./bin/grabpl build-plugins --edition oss --no-install-deps | ||
depends_on: | ||
- install-deps | ||
- lint-go | ||
|
||
- name: package | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- . scripts/build/gpg-test-vars.sh && ./bin/grabpl package --github-token "$${GITHUB_TOKEN}" --edition oss --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 | ||
environment: | ||
GITHUB_TOKEN: | ||
from_secret: github_token | ||
depends_on: | ||
- build-backend | ||
- build-frontend | ||
- build-plugins | ||
- test-backend | ||
- test-frontend | ||
- codespell | ||
- shellcheck | ||
|
||
- name: end-to-end-tests-server | ||
image: grafana/build-container:1.2.21 | ||
detach: true | ||
commands: | ||
- ./e2e/start-server | ||
depends_on: | ||
- package | ||
|
||
- name: end-to-end-tests | ||
image: grafana/ci-e2e:12.18-1 | ||
commands: | ||
- rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) | ||
- ./node_modules/.bin/cypress install | ||
- ./e2e/wait-for-grafana | ||
- ./e2e/run-suite | ||
environment: | ||
HOST: end-to-end-tests-server | ||
depends_on: | ||
- end-to-end-tests-server | ||
|
||
- name: publish-storybook | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) | ||
- yarn storybook:build | ||
depends_on: | ||
- package | ||
|
||
- name: build-docs-website | ||
image: grafana/docs-base:latest | ||
commands: | ||
- mkdir -p /hugo/content/docs/grafana | ||
- cp -r docs/sources /hugo/content/docs/grafana/latest | ||
- cd /hugo && make prod | ||
|
||
- name: copy-packages-for-docker | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- cp dist/*.tar.gz packaging/docker/ | ||
depends_on: | ||
- package | ||
|
||
- name: build-docker-images | ||
image: grafana/drone-grafana-docker:0.2.0 | ||
settings: | ||
archs: amd64 | ||
dry_run: true | ||
edition: oss | ||
depends_on: | ||
- copy-packages-for-docker | ||
|
||
- name: postgres-integration-test | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- apt-get update | ||
- apt-get install -yq postgresql-client | ||
- ./bin/dockerize -wait tcp://postgres:5432 -timeout 120s | ||
- psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql | ||
- rm -rf $(go env GOCACHE) && cp -r go-cache $(go env GOCACHE) | ||
- go clean -testcache | ||
- ./bin/grabpl integration-tests --database postgres | ||
environment: | ||
GRAFANA_TEST_DB: postgres | ||
PGPASSWORD: grafanatest | ||
POSTGRES_HOST: postgres | ||
depends_on: | ||
- test-backend | ||
- test-frontend | ||
|
||
- name: mysql-integration-test | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- apt-get update | ||
- apt-get install -yq default-mysql-client | ||
- ./bin/dockerize -wait tcp://mysql:3306 -timeout 120s | ||
- cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root -prootpass | ||
- rm -rf $(go env GOCACHE) && cp -r go-cache $(go env GOCACHE) | ||
- go clean -testcache | ||
- ./bin/grabpl integration-tests --database mysql | ||
environment: | ||
GRAFANA_TEST_DB: mysql | ||
MYSQL_HOST: mysql | ||
depends_on: | ||
- test-backend | ||
- test-frontend | ||
|
||
services: | ||
- name: postgres | ||
image: postgres:12.3-alpine | ||
environment: | ||
POSTGRES_DB: grafanatest | ||
POSTGRES_PASSWORD: grafanatest | ||
POSTGRES_USER: grafanatest | ||
|
||
- name: mysql | ||
image: mysql:5.6.48 | ||
environment: | ||
MYSQL_DATABASE: grafana_tests | ||
MYSQL_PASSWORD: password | ||
MYSQL_ROOT_PASSWORD: rootpass | ||
MYSQL_USER: grafana | ||
|
||
trigger: | ||
event: | ||
- pull_request | ||
|
||
--- | ||
kind: pipeline | ||
type: docker | ||
name: test-pr-enterprise | ||
|
||
platform: | ||
os: linux | ||
arch: amd64 | ||
|
||
steps: | ||
- name: install-deps | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v$${GRABPL_VERSION}/grabpl | ||
- chmod +x grabpl | ||
- mkdir -p bin | ||
- mv grabpl bin | ||
- curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz | ||
- tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz | ||
- rm dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz | ||
- yarn install --frozen-lockfile --no-progress | ||
- cp -r $(yarn cache dir) yarn-cache | ||
environment: | ||
DOCKERIZE_VERSION: 0.6.1 | ||
GRABPL_VERSION: 0.4.15 | ||
when: | ||
repo: | ||
- grafana/grafana | ||
- aknuds1/grafana | ||
|
||
- name: build-backend | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- ./bin/grabpl build-backend --github-token "$${GITHUB_TOKEN}" --edition enterprise --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 | ||
environment: | ||
GITHUB_TOKEN: | ||
from_secret: github_token | ||
when: | ||
repo: | ||
- grafana/grafana | ||
- aknuds1/grafana | ||
depends_on: | ||
- install-deps | ||
|
||
- name: build-frontend | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) | ||
- ./bin/grabpl build-frontend --no-install-deps --github-token "$${GITHUB_TOKEN}" --edition enterprise --build-id $DRONE_BUILD_NUMBER | ||
environment: | ||
GITHUB_TOKEN: | ||
from_secret: github_token | ||
when: | ||
repo: | ||
- grafana/grafana | ||
- aknuds1/grafana | ||
depends_on: | ||
- install-deps | ||
|
||
- name: build-plugins | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- rm -rf $(yarn cache dir) && cp -r yarn-cache $(yarn cache dir) | ||
- ./bin/grabpl build-plugins --edition enterprise --no-install-deps | ||
when: | ||
repo: | ||
- grafana/grafana | ||
- aknuds1/grafana | ||
depends_on: | ||
- install-deps | ||
|
||
- name: package | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- . scripts/build/gpg-test-vars.sh && ./bin/grabpl package --github-token "$${GITHUB_TOKEN}" --edition enterprise --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 | ||
environment: | ||
GITHUB_TOKEN: | ||
from_secret: github_token | ||
when: | ||
repo: | ||
- grafana/grafana | ||
- aknuds1/grafana | ||
depends_on: | ||
- build-backend | ||
- build-frontend | ||
- build-plugins | ||
|
||
- name: copy-packages-for-docker | ||
image: grafana/build-container:1.2.21 | ||
commands: | ||
- cp dist/*.tar.gz packaging/docker/ | ||
when: | ||
repo: | ||
- grafana/grafana | ||
- aknuds1/grafana | ||
depends_on: | ||
- package | ||
|
||
- name: build-docker-images | ||
image: grafana/drone-grafana-docker:0.2.0 | ||
settings: | ||
archs: amd64 | ||
dry_run: true | ||
edition: enterprise | ||
when: | ||
repo: | ||
- grafana/grafana | ||
- aknuds1/grafana | ||
depends_on: | ||
- copy-packages-for-docker | ||
|
||
trigger: | ||
event: | ||
- pull_request | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,6 @@ trim_trailing_whitespace = false | |
[Makefile] | ||
indent_style = tab | ||
indent_size = 2 | ||
|
||
[*.star] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"jest-ci": "mkdir -p reports/junit && export JEST_JUNIT_OUTPUT_DIR=reports/junit && jest --ci --reporters=default --reporters=jest-junit -w ${TEST_MAX_WORKERS:-100%}",
What does the -100% mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dprokop The bash syntax with
${SOMETHING:-<default>}
means to use the default value if the environment variable isn't set. So it defaults to "100%" for max workers. Basically, 100% parallelization works on Drone, but not on Circle (runs out of memory).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kk, gotcha. Thanks!