From efe1287be90b926a1ef9381fac7db86f391ff2cb Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Wed, 9 Sep 2020 10:21:16 +0200 Subject: [PATCH] Drone: Make parallel step for publishing front-end metrics (#27457) Signed-off-by: Arve Knudsen --- .drone.yml | 8 ++++++++ scripts/lib.star | 34 +++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7a7625f499e..dd52b9788ff 100644 --- a/.drone.yml +++ b/.drone.yml @@ -298,6 +298,14 @@ steps: image: grafana/build-container:1.2.26 commands: - yarn run ci:test-frontend + environment: + TEST_MAX_WORKERS: 50% + depends_on: + - initialize + +- name: frontend-metrics + image: grafana/build-container:1.2.26 + commands: - ./scripts/ci-frontend-metrics.sh | ./bin/grabpl publish-metrics $${GRAFANA_MISC_STATS_API_KEY} environment: GRAFANA_MISC_STATS_API_KEY: diff --git a/scripts/lib.star b/scripts/lib.star index ede39a35ad6..fad6e73c875 100644 --- a/scripts/lib.star +++ b/scripts/lib.star @@ -82,7 +82,8 @@ def master_pipelines(edition): codespell_step(), shellcheck_step(), test_backend_step(), - test_frontend_step(publish_metrics=True), + test_frontend_step(), + frontend_metrics_step(), build_backend_step(edition=edition), build_frontend_step(edition=edition), build_plugins_step(edition=edition), @@ -353,13 +354,8 @@ def test_backend_step(): ], } -def test_frontend_step(publish_metrics=False): - cmds = [ - 'yarn run ci:test-frontend', - ] - if publish_metrics: - cmds.append('./scripts/ci-frontend-metrics.sh | ./bin/grabpl publish-metrics $${GRAFANA_MISC_STATS_API_KEY}') - dct = { +def test_frontend_step(): + return { 'name': 'test-frontend', 'image': build_image, 'depends_on': [ @@ -368,16 +364,28 @@ def test_frontend_step(publish_metrics=False): 'environment': { 'TEST_MAX_WORKERS': '50%', }, - 'commands': cmds, + 'commands': [ + 'yarn run ci:test-frontend', + ], } - if publish_metrics: - dct['environment'] = { + +def frontend_metrics_step(): + return { + 'name': 'frontend-metrics', + 'image': build_image, + 'depends_on': [ + 'initialize', + ], + 'environment': { 'GRAFANA_MISC_STATS_API_KEY': { 'from_secret': 'grafana_misc_stats_api_key', }, - } + }, + 'commands': [ + './scripts/ci-frontend-metrics.sh | ./bin/grabpl publish-metrics $${GRAFANA_MISC_STATS_API_KEY}', + ], + } - return dct def codespell_step(): return {