From eb077db2b0dea3be802a36a602af9da35828e718 Mon Sep 17 00:00:00 2001 From: Dimitris Sotirakis Date: Mon, 10 Oct 2022 22:46:12 +0300 Subject: [PATCH] Add clone-enterprise and init-enterprise steps (#56662) --- .drone.yml | 144 ++++++++++++++------- scripts/drone/pipelines/test_backend.star | 11 +- scripts/drone/pipelines/test_frontend.star | 2 - 3 files changed, 107 insertions(+), 50 deletions(-) diff --git a/.drone.yml b/.drone.yml index 155cd7aa64d..0c16b49b91d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -83,13 +83,6 @@ steps: - grabpl image: grafana/build-container:1.6.3 name: yarn-install -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.19.2 - name: compile-build-cmd - commands: - yarn betterer ci depends_on: @@ -931,13 +924,6 @@ steps: - grabpl image: grafana/build-container:1.6.3 name: yarn-install -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.19.2 - name: compile-build-cmd - commands: - yarn betterer ci depends_on: @@ -2263,13 +2249,6 @@ steps: - grabpl image: grafana/build-container:1.6.3 name: yarn-install -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.19.2 - name: compile-build-cmd - commands: - yarn betterer ci depends_on: @@ -2930,13 +2909,6 @@ steps: - grabpl image: grafana/build-container:1.6.3 name: yarn-install -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.19.2 - name: compile-build-cmd - commands: - yarn betterer ci depends_on: @@ -2983,13 +2955,39 @@ 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 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 @@ -3052,6 +3050,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 @@ -4257,13 +4280,6 @@ steps: - grabpl image: grafana/build-container:1.6.3 name: yarn-install -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.19.2 - name: compile-build-cmd - commands: - yarn betterer ci depends_on: @@ -4885,13 +4901,6 @@ steps: - grabpl image: grafana/build-container:1.6.3 name: yarn-install -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.19.2 - name: compile-build-cmd - commands: - yarn betterer ci depends_on: @@ -4932,13 +4941,36 @@ 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 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 @@ -4995,6 +5027,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 @@ -5494,6 +5548,6 @@ kind: secret name: packages_secret_access_key --- kind: signature -hmac: 0a4cc4cfd81481dbb25b9ccfc22ddd4ad23bbaa1b775e5c64aba2533ccfe1676 +hmac: 82dedf98f127a4d16c71b668d9a2df17502c109cc6ff0ab01e770547250135e7 ... diff --git a/scripts/drone/pipelines/test_backend.star b/scripts/drone/pipelines/test_backend.star index 99bcfce87c2..f513fd30524 100644 --- a/scripts/drone/pipelines/test_backend.star +++ b/scripts/drone/pipelines/test_backend.star @@ -6,6 +6,8 @@ load( 'test_backend_integration_step', 'verify_gen_cue_step', 'compile_build_cmd', + 'clone_enterprise_step', + 'init_enterprise_step', ) load( @@ -15,12 +17,15 @@ load( def test_backend(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(), - compile_build_cmd(), + compile_build_cmd(edition), verify_gen_cue_step(edition="oss"), wire_install_step(), - ] + ]) test_steps = [ test_backend_step(edition), test_backend_integration_step(edition), diff --git a/scripts/drone/pipelines/test_frontend.star b/scripts/drone/pipelines/test_frontend.star index 74bb2121a4b..eb922739458 100644 --- a/scripts/drone/pipelines/test_frontend.star +++ b/scripts/drone/pipelines/test_frontend.star @@ -5,7 +5,6 @@ load( 'yarn_install_step', 'betterer_frontend_step', 'test_frontend_step', - 'compile_build_cmd', ) load( @@ -19,7 +18,6 @@ def test_frontend(trigger, ver_mode, edition="oss"): identify_runner_step(), download_grabpl_step(), yarn_install_step(), - compile_build_cmd(), ] test_steps = [ betterer_frontend_step(),