From 811f6054c81eda6725309b5fe2db4548b9b2e065 Mon Sep 17 00:00:00 2001 From: Dimitris Sotirakis Date: Tue, 11 Oct 2022 10:05:13 +0300 Subject: [PATCH] Add dependencies (#56666) --- .drone.yml | 63 ++++++++++++++++++++-- scripts/drone/pipelines/test_backend.star | 2 +- scripts/drone/pipelines/test_frontend.star | 11 ++-- scripts/drone/steps/lib.star | 22 ++++---- 4 files changed, 80 insertions(+), 18 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0c16b49b91d..4293eca710e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2893,6 +2893,31 @@ platform: os: linux services: [] steps: +- commands: + - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - cd grafana-enterprise + - git checkout ${DRONE_TAG} + environment: + GITHUB_TOKEN: + from_secret: github_token + image: grafana/build-container:1.6.3 + name: clone-enterprise +- commands: + - mv bin/grabpl /tmp/ + - rmdir bin + - mv grafana-enterprise /tmp/ + - /tmp/grabpl init-enterprise --github-token $${GITHUB_TOKEN} /tmp/grafana-enterprise + ${DRONE_TAG} + - mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json + - mkdir bin + - mv /tmp/grabpl bin/ + depends_on: + - clone-enterprise + environment: + GITHUB_TOKEN: + from_secret: github_token + image: grafana/build-container:1.6.3 + name: init-enterprise - commands: - echo $DRONE_RUNNER_NAME image: alpine:3.15.6 @@ -2912,6 +2937,7 @@ steps: - commands: - yarn betterer ci depends_on: + - init-enterprise - yarn-install failure: ignore image: grafana/build-container:1.6.3 @@ -2998,7 +3024,8 @@ steps: - '# The following command will fail if running code generators produces any diff in output.' - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] + depends_on: + - init-enterprise image: grafana/build-container:1.6.3 name: verify-gen-cue - commands: @@ -3081,7 +3108,8 @@ steps: name: identify-runner - commands: - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] + depends_on: + - init-enterprise environment: CGO_ENABLED: 0 image: golang:1.19.2 @@ -4885,6 +4913,28 @@ platform: os: linux services: [] steps: +- commands: + - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - cd grafana-enterprise + - git checkout ${DRONE_BRANCH} + environment: + GITHUB_TOKEN: + from_secret: github_token + image: grafana/build-container:1.6.3 + name: clone-enterprise +- commands: + - mv bin/grabpl /tmp/ + - rmdir bin + - mv grafana-enterprise /tmp/ + - /tmp/grabpl init-enterprise /tmp/grafana-enterprise + - mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json + - mkdir bin + - mv /tmp/grabpl bin/ + depends_on: + - clone-enterprise + environment: {} + image: grafana/build-container:1.6.3 + name: init-enterprise - commands: - echo $DRONE_RUNNER_NAME image: alpine:3.15.6 @@ -4904,6 +4954,7 @@ steps: - commands: - yarn betterer ci depends_on: + - init-enterprise - yarn-install failure: ignore image: grafana/build-container:1.6.3 @@ -4981,7 +5032,8 @@ steps: - '# The following command will fail if running code generators produces any diff in output.' - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] + depends_on: + - init-enterprise image: grafana/build-container:1.6.3 name: verify-gen-cue - commands: @@ -5055,7 +5107,8 @@ steps: name: identify-runner - commands: - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] + depends_on: + - init-enterprise environment: CGO_ENABLED: 0 image: golang:1.19.2 @@ -5548,6 +5601,6 @@ kind: secret name: packages_secret_access_key --- kind: signature -hmac: 82dedf98f127a4d16c71b668d9a2df17502c109cc6ff0ab01e770547250135e7 +hmac: 5c4b0f30f0ddd8e8ad797c10c4aecb29eb04f842450b2ad3feffa91ffb2e8a2b ... diff --git a/scripts/drone/pipelines/test_backend.star b/scripts/drone/pipelines/test_backend.star index f513fd30524..72e90bea740 100644 --- a/scripts/drone/pipelines/test_backend.star +++ b/scripts/drone/pipelines/test_backend.star @@ -23,7 +23,7 @@ def test_backend(trigger, ver_mode, edition="oss"): init_steps.extend([ identify_runner_step(), compile_build_cmd(edition), - verify_gen_cue_step(edition="oss"), + verify_gen_cue_step(edition), wire_install_step(), ]) test_steps = [ diff --git a/scripts/drone/pipelines/test_frontend.star b/scripts/drone/pipelines/test_frontend.star index eb922739458..976baa1c9d4 100644 --- a/scripts/drone/pipelines/test_frontend.star +++ b/scripts/drone/pipelines/test_frontend.star @@ -1,6 +1,8 @@ load( 'scripts/drone/steps/lib.star', 'identify_runner_step', + 'clone_enterprise_step', + 'init_enterprise_step', 'download_grabpl_step', 'yarn_install_step', 'betterer_frontend_step', @@ -14,13 +16,16 @@ load( def test_frontend(trigger, ver_mode, edition="oss"): environment = {'EDITION': edition} - init_steps = [ + init_steps = [] + if edition != 'oss': + init_steps.extend([clone_enterprise_step(ver_mode), init_enterprise_step(ver_mode),]) + init_steps.extend([ identify_runner_step(), download_grabpl_step(), yarn_install_step(), - ] + ]) test_steps = [ - betterer_frontend_step(), + betterer_frontend_step(edition), test_frontend_step(), ] pipeline_name = '{}-test-frontend'.format(ver_mode) diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index 69ae82646b3..d5a4ef5ab25 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -514,13 +514,15 @@ def test_backend_integration_step(edition): ], } -def betterer_frontend_step(): +def betterer_frontend_step(edition="oss"): + deps = [] + if edition == "enterprise": + deps.extend(['init-enterprise']) + deps.extend(['yarn-install']) return { 'name': 'betterer-frontend', 'image': build_image, - 'depends_on': [ - 'yarn-install', - ], + 'depends_on': deps, 'commands': [ 'yarn betterer ci', ], @@ -529,16 +531,18 @@ def betterer_frontend_step(): -def test_frontend_step(): +def test_frontend_step(edition="oss"): + deps = [] + if edition == "enterprise": + deps.extend(['init-enterprise']) + deps.extend(['yarn-install']) return { 'name': 'test-frontend', 'image': build_image, 'environment': { 'TEST_MAX_WORKERS': '50%', }, - 'depends_on': [ - 'yarn-install', - ], + 'depends_on': deps, 'commands': [ 'yarn run ci:test-frontend', ], @@ -1253,7 +1257,7 @@ def end_to_end_tests_deps(edition): def compile_build_cmd(edition='oss'): dependencies = [] - if edition == 'enterprise': + if edition in ('enterprise', 'enterprise2'): dependencies = ['init-enterprise',] return { 'name': 'compile-build-cmd',