CI: Make build, test and integration tests steps run in parallel (#40794)

* Make build and test steps run in parallel

* Make tests and builds run on different pipelines

* Make test-backend depend on initialize

* Rename

* Create standalone integration tests pipeline (#41730)

* Remove unused variables
This commit is contained in:
Dimitris Sotirakis
2021-11-17 11:25:55 +02:00
committed by GitHub
parent 818b8739c0
commit b8dd9fdd4a
6 changed files with 292 additions and 186 deletions
+200 -118
View File
@@ -1,26 +1,13 @@
---
depends_on: []
kind: pipeline
name: test-pr
name: pr-test
node:
type: no-parallel
platform:
arch: amd64
os: linux
services:
- environment:
POSTGRES_DB: grafanatest
POSTGRES_PASSWORD: grafanatest
POSTGRES_USER: grafanatest
image: postgres:12.3-alpine
name: postgres
- environment:
MYSQL_DATABASE: grafana_tests
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_USER: grafana
image: mysql:5.6.48
name: mysql
services: []
steps:
- commands:
- mkdir -p bin
@@ -85,13 +72,13 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend
- commands:
- ./bin/grabpl integration-tests --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration
- commands:
@@ -102,41 +89,42 @@ steps:
TEST_MAX_WORKERS: 50%
image: grafana/build-container:1.4.5
name: test-frontend
trigger:
event:
- pull_request
type: docker
---
depends_on: []
kind: pipeline
name: pr-build-e2e
node:
type: no-parallel
platform:
arch: amd64
os: linux
services: []
steps:
- commands:
- apt-get update
- apt-get install -yq postgresql-client
- dockerize -wait tcp://postgres:5432 -timeout 120s
- psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- initialize
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: postgres
image: grafana/build-container:1.4.5
name: postgres-integration-tests
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.5.5/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- apt-get update
- apt-get install -yq default-mysql-client
- dockerize -wait tcp://mysql:3306 -timeout 120s
- cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root
-prootpass
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- initialize
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
- echo $DRONE_RUNNER_NAME
image: alpine:3.14.2
name: identify-runner
- commands:
- make gen-go
- ./bin/grabpl gen-version --build-id ${DRONE_BUILD_NUMBER}
- yarn install --immutable
image: grafana/build-container:1.4.5
name: mysql-integration-tests
name: initialize
- commands:
- ./bin/grabpl build-backend --jobs 8 --edition oss --build-id ${DRONE_BUILD_NUMBER}
--variants linux-x64,linux-x64-musl,osx64,win64,armv6 --no-pull-enterprise
depends_on:
- test-backend
- initialize
environment: {}
image: grafana/build-container:1.4.5
name: build-backend
@@ -144,13 +132,13 @@ steps:
- ./bin/grabpl build-frontend --jobs 8 --no-install-deps --edition oss --build-id
${DRONE_BUILD_NUMBER} --no-pull-enterprise
depends_on:
- test-frontend
- initialize
image: grafana/build-container:1.4.5
name: build-frontend
- commands:
- ./bin/grabpl build-plugins --jobs 8 --edition oss --no-install-deps
depends_on:
- lint-backend
- initialize
environment: null
image: grafana/build-container:1.4.5
name: build-plugins
@@ -268,6 +256,70 @@ type: docker
---
depends_on: []
kind: pipeline
name: pr-integration-tests
node:
type: no-parallel
platform:
arch: amd64
os: linux
services:
- environment:
POSTGRES_DB: grafanatest
POSTGRES_PASSWORD: grafanatest
POSTGRES_USER: grafanatest
image: postgres:12.3-alpine
name: postgres
- environment:
MYSQL_DATABASE: grafana_tests
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_USER: grafana
image: mysql:5.6.48
name: mysql
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.5.5/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- apt-get update
- apt-get install -yq postgresql-client
- dockerize -wait tcp://postgres:5432 -timeout 120s
- psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- grabpl
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: postgres
image: grafana/build-container:1.4.5
name: postgres-integration-tests
- commands:
- apt-get update
- apt-get install -yq default-mysql-client
- dockerize -wait tcp://mysql:3306 -timeout 120s
- cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root
-prootpass
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- grabpl
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
image: grafana/build-container:1.4.5
name: mysql-integration-tests
trigger:
event:
- pull_request
type: docker
---
depends_on: []
kind: pipeline
name: build-main
node:
type: no-parallel
@@ -363,13 +415,13 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend
- commands:
- ./bin/grabpl integration-tests --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration
- commands:
@@ -388,7 +440,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -404,7 +456,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -414,7 +466,7 @@ steps:
- ./bin/grabpl build-backend --jobs 8 --edition oss --build-id ${DRONE_BUILD_NUMBER}
--no-pull-enterprise
depends_on:
- test-backend
- initialize
environment: {}
image: grafana/build-container:1.4.5
name: build-backend
@@ -422,13 +474,13 @@ steps:
- ./bin/grabpl build-frontend --jobs 8 --no-install-deps --edition oss --build-id
${DRONE_BUILD_NUMBER} --no-pull-enterprise
depends_on:
- test-frontend
- initialize
image: grafana/build-container:1.4.5
name: build-frontend
- commands:
- ./bin/grabpl build-plugins --jobs 8 --edition oss --no-install-deps --sign --signing-admin
depends_on:
- lint-backend
- initialize
environment:
GRAFANA_API_KEY:
from_secret: grafana_api_key
@@ -824,13 +876,13 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend
- commands:
- ./bin/grabpl integration-tests --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration
- commands:
@@ -849,7 +901,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -865,7 +917,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -875,7 +927,7 @@ steps:
- ./bin/grabpl build-backend --jobs 8 --edition oss --github-token $${GITHUB_TOKEN}
--no-pull-enterprise ${DRONE_TAG}
depends_on:
- test-backend
- initialize
environment:
GITHUB_TOKEN:
from_secret: github_token
@@ -885,13 +937,13 @@ steps:
- ./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps
--edition oss --no-pull-enterprise ${DRONE_TAG}
depends_on:
- test-frontend
- initialize
image: grafana/build-container:1.4.5
name: build-frontend
- commands:
- ./bin/grabpl build-plugins --jobs 8 --edition oss --no-install-deps --sign --signing-admin
depends_on:
- lint-backend
- initialize
environment:
GRAFANA_API_KEY:
from_secret: grafana_api_key
@@ -1059,6 +1111,12 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.5.5/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
@@ -1208,13 +1266,13 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition enterprise
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend
- commands:
- ./bin/grabpl integration-tests --edition enterprise
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration
- commands:
@@ -1233,7 +1291,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -1249,7 +1307,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -1259,7 +1317,7 @@ steps:
- ./bin/grabpl build-backend --jobs 8 --edition enterprise --github-token $${GITHUB_TOKEN}
--no-pull-enterprise ${DRONE_TAG}
depends_on:
- test-backend
- initialize
environment:
GITHUB_TOKEN:
from_secret: github_token
@@ -1269,14 +1327,14 @@ steps:
- ./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps
--edition enterprise --no-pull-enterprise ${DRONE_TAG}
depends_on:
- test-frontend
- initialize
image: grafana/build-container:1.4.5
name: build-frontend
- commands:
- ./bin/grabpl build-plugins --jobs 8 --edition enterprise --no-install-deps --sign
--signing-admin
depends_on:
- lint-backend
- initialize
environment:
GRAFANA_API_KEY:
from_secret: grafana_api_key
@@ -1320,20 +1378,20 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition enterprise2
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-enterprise2
- commands:
- ./bin/grabpl integration-tests --edition enterprise2
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration-enterprise2
- commands:
- ./bin/grabpl build-backend --jobs 8 --edition enterprise2 --github-token $${GITHUB_TOKEN}
--no-pull-enterprise ${DRONE_TAG}
depends_on:
- test-backend-enterprise2
- initialize
environment:
GITHUB_TOKEN:
from_secret: github_token
@@ -1416,8 +1474,7 @@ steps:
- dockerize -wait tcp://redis:6379/0 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- test-backend
- test-frontend
- grabpl
environment:
REDIS_URL: redis://redis:6379/0
image: grafana/build-container:1.4.5
@@ -1426,8 +1483,7 @@ steps:
- dockerize -wait tcp://memcached:11211 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- test-backend
- test-frontend
- grabpl
environment:
MEMCACHED_HOSTS: memcached:11211
image: grafana/build-container:1.4.5
@@ -1533,6 +1589,12 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.5.5/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
@@ -1771,13 +1833,13 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend
- commands:
- ./bin/grabpl integration-tests --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration
- commands:
@@ -1796,7 +1858,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -1812,7 +1874,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -1822,7 +1884,7 @@ steps:
- ./bin/grabpl build-backend --jobs 8 --edition oss --github-token $${GITHUB_TOKEN}
--no-pull-enterprise v7.3.0-test
depends_on:
- test-backend
- initialize
environment:
GITHUB_TOKEN:
from_secret: github_token
@@ -1832,13 +1894,13 @@ steps:
- ./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps
--edition oss --no-pull-enterprise v7.3.0-test
depends_on:
- test-frontend
- initialize
image: grafana/build-container:1.4.5
name: build-frontend
- commands:
- ./bin/grabpl build-plugins --jobs 8 --edition oss --no-install-deps --sign --signing-admin
depends_on:
- lint-backend
- initialize
environment:
GRAFANA_API_KEY:
from_secret: grafana_api_key
@@ -1994,6 +2056,12 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.5.5/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
@@ -2144,13 +2212,13 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition enterprise
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend
- commands:
- ./bin/grabpl integration-tests --edition enterprise
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration
- commands:
@@ -2169,7 +2237,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -2185,7 +2253,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -2195,7 +2263,7 @@ steps:
- ./bin/grabpl build-backend --jobs 8 --edition enterprise --github-token $${GITHUB_TOKEN}
--no-pull-enterprise v7.3.0-test
depends_on:
- test-backend
- initialize
environment:
GITHUB_TOKEN:
from_secret: github_token
@@ -2205,14 +2273,14 @@ steps:
- ./bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps
--edition enterprise --no-pull-enterprise v7.3.0-test
depends_on:
- test-frontend
- initialize
image: grafana/build-container:1.4.5
name: build-frontend
- commands:
- ./bin/grabpl build-plugins --jobs 8 --edition enterprise --no-install-deps --sign
--signing-admin
depends_on:
- lint-backend
- initialize
environment:
GRAFANA_API_KEY:
from_secret: grafana_api_key
@@ -2256,20 +2324,20 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition enterprise2
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-enterprise2
- commands:
- ./bin/grabpl integration-tests --edition enterprise2
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration-enterprise2
- commands:
- ./bin/grabpl build-backend --jobs 8 --edition enterprise2 --github-token $${GITHUB_TOKEN}
--no-pull-enterprise v7.3.0-test
depends_on:
- test-backend-enterprise2
- initialize
environment:
GITHUB_TOKEN:
from_secret: github_token
@@ -2344,8 +2412,7 @@ steps:
- dockerize -wait tcp://redis:6379/0 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- test-backend
- test-frontend
- grabpl
environment:
REDIS_URL: redis://redis:6379/0
image: grafana/build-container:1.4.5
@@ -2354,8 +2421,7 @@ steps:
- dockerize -wait tcp://memcached:11211 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- test-backend
- test-frontend
- grabpl
environment:
MEMCACHED_HOSTS: memcached:11211
image: grafana/build-container:1.4.5
@@ -2461,6 +2527,12 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.5.5/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
@@ -2704,13 +2776,13 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend
- commands:
- ./bin/grabpl integration-tests --edition oss
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration
- commands:
@@ -2729,7 +2801,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -2745,7 +2817,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -2755,7 +2827,7 @@ steps:
- ./bin/grabpl build-backend --jobs 8 --edition oss --build-id ${DRONE_BUILD_NUMBER}
--no-pull-enterprise
depends_on:
- test-backend
- initialize
environment: {}
image: grafana/build-container:1.4.5
name: build-backend
@@ -2763,13 +2835,13 @@ steps:
- ./bin/grabpl build-frontend --jobs 8 --no-install-deps --edition oss --build-id
${DRONE_BUILD_NUMBER} --no-pull-enterprise
depends_on:
- test-frontend
- initialize
image: grafana/build-container:1.4.5
name: build-frontend
- commands:
- ./bin/grabpl build-plugins --jobs 8 --edition oss --no-install-deps --sign --signing-admin
depends_on:
- lint-backend
- initialize
environment:
GRAFANA_API_KEY:
from_secret: grafana_api_key
@@ -2905,6 +2977,12 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.5.5/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
@@ -3049,13 +3127,13 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition enterprise
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend
- commands:
- ./bin/grabpl integration-tests --edition enterprise
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration
- commands:
@@ -3074,7 +3152,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
@@ -3090,7 +3168,7 @@ steps:
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
depends_on:
- initialize
- grabpl
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
@@ -3100,7 +3178,7 @@ steps:
- ./bin/grabpl build-backend --jobs 8 --edition enterprise --build-id ${DRONE_BUILD_NUMBER}
--no-pull-enterprise
depends_on:
- test-backend
- initialize
environment: {}
image: grafana/build-container:1.4.5
name: build-backend
@@ -3108,14 +3186,14 @@ steps:
- ./bin/grabpl build-frontend --jobs 8 --no-install-deps --edition enterprise --build-id
${DRONE_BUILD_NUMBER} --no-pull-enterprise
depends_on:
- test-frontend
- initialize
image: grafana/build-container:1.4.5
name: build-frontend
- commands:
- ./bin/grabpl build-plugins --jobs 8 --edition enterprise --no-install-deps --sign
--signing-admin
depends_on:
- lint-backend
- initialize
environment:
GRAFANA_API_KEY:
from_secret: grafana_api_key
@@ -3159,20 +3237,20 @@ steps:
- commands:
- ./bin/grabpl test-backend --edition enterprise2
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-enterprise2
- commands:
- ./bin/grabpl integration-tests --edition enterprise2
depends_on:
- lint-backend
- initialize
image: grafana/build-container:1.4.5
name: test-backend-integration-enterprise2
- commands:
- ./bin/grabpl build-backend --jobs 8 --edition enterprise2 --build-id ${DRONE_BUILD_NUMBER}
--variants linux-x64 --no-pull-enterprise
depends_on:
- test-backend-enterprise2
- initialize
environment: {}
image: grafana/build-container:1.4.5
name: build-backend-enterprise2
@@ -3254,8 +3332,7 @@ steps:
- dockerize -wait tcp://redis:6379/0 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- test-backend
- test-frontend
- grabpl
environment:
REDIS_URL: redis://redis:6379/0
image: grafana/build-container:1.4.5
@@ -3264,8 +3341,7 @@ steps:
- dockerize -wait tcp://memcached:11211 -timeout 120s
- ./bin/grabpl integration-tests
depends_on:
- test-backend
- test-frontend
- grabpl
environment:
MEMCACHED_HOSTS: memcached:11211
image: grafana/build-container:1.4.5
@@ -3371,6 +3447,12 @@ platform:
version: "1809"
services: []
steps:
- commands:
- mkdir -p bin
- curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.5.5/grabpl
- chmod +x bin/grabpl
image: byrnedo/alpine-curl:0.1.8
name: grabpl
- commands:
- echo $env:DRONE_RUNNER_NAME
image: mcr.microsoft.com/windows:1809
@@ -3500,6 +3582,6 @@ kind: secret
name: drone_token
---
kind: signature
hmac: 9f5633098fb9d66f85dd2278290c5886e8863d348bc66f3ebf302c0edb7b5f15
hmac: e731dba815e5a79a90813e0c99dde194ca444a3d254df15a6189f59a8263f5de
...
+18 -13
View File
@@ -1,5 +1,7 @@
load(
'scripts/drone/steps/lib.star',
'download_grabpl_step',
'initialize_step',
'lint_drone_step',
'lint_backend_step',
'lint_frontend_step',
@@ -139,18 +141,20 @@ def main_pipelines(edition):
pipelines = [
pipeline(
name='build-main', edition=edition, trigger=trigger, services=services, steps=steps,
ver_mode=ver_mode,
name='build-main', edition=edition, trigger=trigger, services=services,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + steps,
),
pipeline(
name='windows-main', edition=edition, trigger=trigger, steps=windows_steps, platform='windows',
depends_on=['build-main'], ver_mode=ver_mode,
name='windows-main', edition=edition, trigger=trigger,
steps=initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_steps,
depends_on=['build-main'], platform='windows',
),
]
if edition != 'enterprise':
pipelines.append(pipeline(
name='publish-main', edition=edition, trigger=trigger, steps=publish_steps,
depends_on=['build-main', 'windows-main',], install_deps=False, ver_mode=ver_mode,
name='publish-main', edition=edition, trigger=trigger,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode, install_deps=False) + publish_steps,
depends_on=['build-main', 'windows-main',],
))
pipelines.append(notify_pipeline(
@@ -164,17 +168,18 @@ def main_pipelines(edition):
}
steps, windows_steps, publish_steps = get_steps(edition=edition, is_downstream=True)
pipelines.append(pipeline(
name='build-main-downstream', edition=edition, trigger=trigger, services=services, steps=steps,
is_downstream=True, ver_mode=ver_mode,
name='build-main-downstream', edition=edition, trigger=trigger, services=services,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode, is_downstream=True) + steps,
))
pipelines.append(pipeline(
name='windows-main-downstream', edition=edition, trigger=trigger, steps=windows_steps,
platform='windows', depends_on=['build-main-downstream'], is_downstream=True, ver_mode=ver_mode,
name='windows-main-downstream', edition=edition, trigger=trigger,
steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode, is_downstream=True) + windows_steps,
platform='windows', depends_on=['build-main-downstream'],
))
pipelines.append(pipeline(
name='publish-main-downstream', edition=edition, trigger=trigger, steps=publish_steps,
depends_on=['build-main-downstream', 'windows-main-downstream'], is_downstream=True, install_deps=False,
ver_mode=ver_mode,
name='publish-main-downstream', edition=edition, trigger=trigger,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode, is_downstream=True, install_deps=False) + publish_steps,
depends_on=['build-main-downstream', 'windows-main-downstream'],
))
pipelines.append(notify_pipeline(
+26 -10
View File
@@ -1,5 +1,7 @@
load(
'scripts/drone/steps/lib.star',
'download_grabpl_step',
'initialize_step',
'lint_drone_step',
'lint_backend_step',
'lint_frontend_step',
@@ -46,7 +48,7 @@ def pr_pipelines(edition):
services = integration_test_services(edition)
variants = ['linux-x64', 'linux-x64-musl', 'osx64', 'win64', 'armv6',]
include_enterprise2 = edition == 'enterprise'
steps = [
test_steps = [
lint_drone_step(),
codespell_step(),
shellcheck_step(),
@@ -55,28 +57,34 @@ def pr_pipelines(edition):
test_backend_step(edition=edition),
test_backend_integration_step(edition=edition),
test_frontend_step(),
postgres_integration_tests_step(),
mysql_integration_tests_step(),
]
build_steps = [
build_backend_step(edition=edition, ver_mode=ver_mode, variants=variants),
build_frontend_step(edition=edition, ver_mode=ver_mode),
build_plugins_step(edition=edition),
validate_scuemata_step(),
ensure_cuetsified_step(),
]
integration_test_steps = [
postgres_integration_tests_step(),
mysql_integration_tests_step(),
]
if include_enterprise2:
edition2 = 'enterprise2'
steps.append(benchmark_ldap_step())
build_steps.append(benchmark_ldap_step())
services.append(ldap_service())
steps.extend([
test_steps.extend([
lint_backend_step(edition=edition2),
test_backend_step(edition=edition2),
test_backend_integration_step(edition=edition2),
])
build_steps.extend([
build_backend_step(edition=edition2, ver_mode=ver_mode, variants=['linux-x64']),
])
# Insert remaining steps
steps.extend([
# Insert remaining build_steps
build_steps.extend([
package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=variants),
e2e_tests_server_step(edition=edition),
e2e_tests_step(edition=edition),
@@ -89,9 +97,11 @@ def pr_pipelines(edition):
])
if include_enterprise2:
steps.extend([
integration_test_steps.extend([
redis_integration_tests_step(),
memcached_integration_tests_step(),
])
build_steps.extend([
package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']),
e2e_tests_server_step(edition=edition2, port=3002),
e2e_tests_step(edition=edition2, port=3002),
@@ -100,9 +110,15 @@ def pr_pipelines(edition):
trigger = {
'event': ['pull_request',],
}
return [
pipeline(
name='test-pr', edition=edition, trigger=trigger, services=services, steps=steps,
ver_mode=ver_mode,
name='pr-test', edition=edition, trigger=trigger, services=[], steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode)
+ test_steps,
), pipeline(
name='pr-build-e2e', edition=edition, trigger=trigger, services=[], steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode)
+ build_steps,
), pipeline(
name='pr-integration-tests', edition=edition, trigger=trigger, services=services, steps=[download_grabpl_step()] + integration_test_steps,
),
]
+33 -22
View File
@@ -1,5 +1,7 @@
load(
'scripts/drone/steps/lib.star',
'download_grabpl_step',
'initialize_step',
'lint_drone_step',
'test_release_ver',
'build_image',
@@ -154,30 +156,34 @@ def get_steps(edition, ver_mode):
return steps, windows_steps
def get_oss_pipelines(trigger, ver_mode):
services = integration_test_services(edition='oss')
steps, windows_steps = get_steps(edition='oss', ver_mode=ver_mode)
edition = 'oss'
services = integration_test_services(edition=edition)
steps, windows_steps = get_steps(edition=edition, ver_mode=ver_mode)
return [
pipeline(
name='oss-build-{}'.format(ver_mode), edition='oss', trigger=trigger, services=services, steps=steps,
ver_mode=ver_mode,
name='oss-build-{}'.format(ver_mode), edition=edition, trigger=trigger, services=services,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + steps,
),
pipeline(
name='oss-windows-{}'.format(ver_mode), edition='oss', trigger=trigger, steps=windows_steps,
platform='windows', depends_on=['oss-build-{}'.format(ver_mode)], ver_mode=ver_mode,
name='oss-windows-{}'.format(ver_mode), edition=edition, trigger=trigger,
steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_steps,
platform='windows', depends_on=['oss-build-{}'.format(ver_mode)],
),
]
def get_enterprise_pipelines(trigger, ver_mode):
services = integration_test_services(edition='enterprise')
steps, windows_steps = get_steps(edition='enterprise', ver_mode=ver_mode)
edition = 'enterprise'
services = integration_test_services(edition=edition)
steps, windows_steps = get_steps(edition=edition, ver_mode=ver_mode)
return [
pipeline(
name='enterprise-build-{}'.format(ver_mode), edition='enterprise', trigger=trigger, services=services,
steps=steps, ver_mode=ver_mode,
name='enterprise-build-{}'.format(ver_mode), edition=edition, trigger=trigger, services=services,
steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + steps,
),
pipeline(
name='enterprise-windows-{}'.format(ver_mode), edition='enterprise', trigger=trigger, steps=windows_steps,
platform='windows', depends_on=['enterprise-build-{}'.format(ver_mode)], ver_mode=ver_mode,
name='enterprise-windows-{}'.format(ver_mode), edition=edition, trigger=trigger,
steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_steps,
platform='windows', depends_on=['enterprise-build-{}'.format(ver_mode)],
),
]
@@ -199,12 +205,14 @@ def release_pipelines(ver_mode='release', trigger=None):
pipelines = oss_pipelines + enterprise_pipelines
if should_publish:
steps = [
publish_packages_step(edition='oss', ver_mode=ver_mode),
publish_packages_step(edition='enterprise', ver_mode=ver_mode),
]
publish_pipeline = pipeline(
name='publish-{}'.format(ver_mode), trigger=trigger, edition='oss', steps=[
publish_packages_step(edition='oss', ver_mode=ver_mode),
publish_packages_step(edition='enterprise', ver_mode=ver_mode),
], depends_on=[p['name'] for p in oss_pipelines + enterprise_pipelines], install_deps=False,
ver_mode=ver_mode,
name='publish-{}'.format(ver_mode), trigger=trigger, edition='oss',
steps=[download_grabpl_step()] + initialize_step(edition='oss', platform='linux', ver_mode=ver_mode, install_deps=False) + steps,
depends_on=[p['name'] for p in oss_pipelines + enterprise_pipelines],
)
pipelines.append(publish_pipeline)
@@ -228,12 +236,15 @@ def test_release_pipelines():
publish_cmd = './bin/grabpl publish-packages --edition {{}} --dry-run {}'.format(test_release_ver)
steps = [
publish_packages_step(edition='oss', ver_mode=ver_mode),
publish_packages_step(edition='enterprise', ver_mode=ver_mode),
]
publish_pipeline = pipeline(
name='publish-{}'.format(ver_mode), trigger=trigger, edition='oss', steps=[
publish_packages_step(edition='oss', ver_mode=ver_mode),
publish_packages_step(edition='enterprise', ver_mode=ver_mode),
], depends_on=[p['name'] for p in oss_pipelines + enterprise_pipelines], install_deps=False,
ver_mode=ver_mode,
name='publish-{}'.format(ver_mode), trigger=trigger, edition='oss',
steps=[download_grabpl_step()] + initialize_step(edition='oss', platform='linux', ver_mode=ver_mode, install_deps=False) + steps,
depends_on=[p['name'] for p in oss_pipelines + enterprise_pipelines],
)
pipelines = oss_pipelines + enterprise_pipelines + [publish_pipeline,]
+12 -14
View File
@@ -124,7 +124,7 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de
return steps
def download_grabpl():
def download_grabpl_step():
return {
'name': 'grabpl',
'image': curl_image,
@@ -312,7 +312,7 @@ def build_backend_step(edition, ver_mode, variants=None, is_downstream=False):
'name': 'build-backend' + enterprise2_suffix(edition),
'image': build_image,
'depends_on': [
'test-backend' + enterprise2_suffix(edition),
'initialize',
],
'environment': env,
'commands': cmds,
@@ -345,7 +345,7 @@ def build_frontend_step(edition, ver_mode, is_downstream=False):
'name': 'build-frontend',
'image': build_image,
'depends_on': [
'test-frontend',
'initialize',
],
'commands': cmds,
}
@@ -375,7 +375,7 @@ def build_plugins_step(edition, sign=False):
'name': 'build-plugins',
'image': build_image,
'depends_on': [
'lint-backend',
'initialize',
],
'environment': env,
'commands': [
@@ -389,7 +389,7 @@ def test_backend_step(edition):
'name': 'test-backend' + enterprise2_suffix(edition),
'image': build_image,
'depends_on': [
'lint-backend',
'initialize',
],
'commands': [
'./bin/grabpl test-backend --edition {}'.format(edition),
@@ -401,7 +401,7 @@ def test_backend_integration_step(edition):
'name': 'test-backend-integration' + enterprise2_suffix(edition),
'image': build_image,
'depends_on': [
'lint-backend',
'initialize',
],
'commands': [
'./bin/grabpl integration-tests --edition {}'.format(edition),
@@ -688,7 +688,7 @@ def postgres_integration_tests_step():
'name': 'postgres-integration-tests',
'image': build_image,
'depends_on': [
'initialize',
'grabpl',
],
'environment': {
'PGPASSWORD': 'grafanatest',
@@ -712,7 +712,7 @@ def mysql_integration_tests_step():
'name': 'mysql-integration-tests',
'image': build_image,
'depends_on': [
'initialize',
'grabpl',
],
'environment': {
'GRAFANA_TEST_DB': 'mysql',
@@ -734,8 +734,7 @@ def redis_integration_tests_step():
'name': 'redis-integration-tests',
'image': build_image,
'depends_on': [
'test-backend',
'test-frontend',
'grabpl',
],
'environment': {
'REDIS_URL': 'redis://redis:6379/0',
@@ -751,8 +750,7 @@ def memcached_integration_tests_step():
'name': 'memcached-integration-tests',
'image': build_image,
'depends_on': [
'test-backend',
'test-frontend',
'grabpl',
],
'environment': {
'MEMCACHED_HOSTS': 'memcached:11211',
@@ -939,7 +937,7 @@ def get_windows_steps(edition, ver_mode, is_downstream=False):
else:
committish = '$$env:DRONE_COMMIT'
# For enterprise, we have to clone both OSS and enterprise and merge the latter into the former
download_grabpl_cmds = [
download_grabpl_step_cmds = [
'$$ProgressPreference = "SilentlyContinue"',
'Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v{}/windows/grabpl.exe -OutFile grabpl.exe'.format(grabpl_version),
]
@@ -957,7 +955,7 @@ def get_windows_steps(edition, ver_mode, is_downstream=False):
'environment': {
'GITHUB_TOKEN': from_secret(github_token),
},
'commands': download_grabpl_cmds + clone_cmds,
'commands': download_grabpl_step_cmds + clone_cmds,
})
steps[1]['depends_on'] = [
'clone',
+3 -9
View File
@@ -1,18 +1,15 @@
load(
'scripts/drone/steps/lib.star',
'initialize_step',
'download_grabpl',
'download_grabpl_step',
'slack_step',
)
load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token')
def pipeline(
name, edition, trigger, steps, ver_mode, services=[], platform='linux', depends_on=[],
is_downstream=False, install_deps=True,
name, edition, trigger, steps, services=[], platform='linux', depends_on=[],
):
if platform != 'windows':
grabpl_step = [download_grabpl()]
platform_conf = {
'platform': {
'os': 'linux',
@@ -25,7 +22,6 @@ def pipeline(
}
}
else:
grabpl_step = []
platform_conf = {
'platform': {
'os': 'windows',
@@ -40,9 +36,7 @@ def pipeline(
'name': name,
'trigger': trigger,
'services': services,
'steps': grabpl_step + initialize_step(
edition, platform, is_downstream=is_downstream, install_deps=install_deps, ver_mode=ver_mode,
) + steps,
'steps': steps,
'depends_on': depends_on,
}
pipeline.update(platform_conf)