From 85edf78a464180887acc4e84c3bb2150b6d8fe19 Mon Sep 17 00:00:00 2001 From: malcolmholmes <42545407+malcolmholmes@users.noreply.github.com> Date: Fri, 11 Feb 2022 16:25:31 +0000 Subject: [PATCH] Build: only specify github-token when needed (#45326) (#45329) (cherry picked from commit 9a7438c720fd0b83cd42d628f9ff27ed318238e7) --- .drone.yml | 8 ++++---- scripts/drone/steps/lib.star | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 62cffbb7204..565a6455db3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3217,7 +3217,7 @@ steps: - mv bin/grabpl /tmp/ - rmdir bin - mv grafana-enterprise /tmp/ - - /tmp/grabpl init-enterprise --github-token $${GITHUB_TOKEN} /tmp/grafana-enterprise + - /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/ @@ -3522,7 +3522,7 @@ steps: - mv bin/grabpl /tmp/ - rmdir bin - mv grafana-enterprise /tmp/ - - /tmp/grabpl init-enterprise --github-token $${GITHUB_TOKEN} /tmp/grafana-enterprise + - /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/ @@ -3684,7 +3684,7 @@ steps: - mv bin/grabpl /tmp/ - rmdir bin - mv grafana-enterprise /tmp/ - - /tmp/grabpl init-enterprise --github-token $${GITHUB_TOKEN} /tmp/grafana-enterprise + - /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/ @@ -3893,6 +3893,6 @@ kind: secret name: prerelease_bucket --- kind: signature -hmac: 65c858e5a684c7ea29c5787f1bc81294d74b0e7f6783a05322bb34dbe4bae5c0 +hmac: ccccf712cc34ebea0b3aaab48914f8019624b1838af29ec712e47b1f7bd9a104 ... diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index 72bdd9274d0..ba4865b622e 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -67,13 +67,17 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de environment = { 'GITHUB_TOKEN': from_secret(github_token), } + token = "--github-token $${GITHUB_TOKEN}" elif ver_mode == 'release-branch': committish = '${DRONE_BRANCH}' environment = {} + token = "" else: + environment = {} if is_downstream: source_commit = ' $${SOURCE_COMMIT}' committish = '${DRONE_COMMIT}' + token = "" steps = [ identify_runner, clone_enterprise(committish), @@ -88,7 +92,7 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de 'mv bin/grabpl /tmp/', 'rmdir bin', 'mv grafana-enterprise /tmp/', - '/tmp/grabpl init-enterprise --github-token $${{GITHUB_TOKEN}} /tmp/grafana-enterprise{}'.format(source_commit), + '/tmp/grabpl init-enterprise {} /tmp/grafana-enterprise{}'.format(token, source_commit), 'mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json', 'mkdir bin', 'mv /tmp/grabpl bin/'