From 98b94d3824dfa084c2f728fdbc7558c0cd058776 Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Wed, 7 Oct 2020 16:22:41 +0200 Subject: [PATCH] Drone: Fix release pipelines (#28084) Signed-off-by: Arve Knudsen --- .drone.yml | 10 +++++----- scripts/lib.star | 24 +++++++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5f85ee16fa3..6a51d0d7fd4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1057,7 +1057,7 @@ steps: commands: - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise - - git checkout ${DRONE_COMMIT} + - git checkout ${DRONE_TAG} environment: GITHUB_TOKEN: from_secret: github_token @@ -1069,7 +1069,7 @@ steps: - chmod +x grabpl - mv grabpl /tmp - mv grafana-enterprise /tmp/ - - /tmp/grabpl init-enterprise /tmp/grafana-enterprise + - /tmp/grabpl init-enterprise /tmp/grafana-enterprise ${DRONE_TAG} - mkdir bin - mv /tmp/grabpl bin/ - ./bin/grabpl verify-version ${DRONE_TAG} @@ -1336,7 +1336,7 @@ steps: commands: - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise - - git checkout $$env:DRONE_COMMIT + - git checkout ${DRONE_TAG} environment: GITHUB_TOKEN: from_secret: github_token @@ -1812,7 +1812,7 @@ steps: commands: - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise - - git checkout ${DRONE_COMMIT} + - git checkout master environment: GITHUB_TOKEN: from_secret: github_token @@ -2085,7 +2085,7 @@ steps: commands: - git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git" - cd grafana-enterprise - - git checkout $$env:DRONE_COMMIT + - git checkout master environment: GITHUB_TOKEN: from_secret: github_token diff --git a/scripts/lib.star b/scripts/lib.star index 2a7cad7f029..c1877815cf4 100644 --- a/scripts/lib.star +++ b/scripts/lib.star @@ -111,10 +111,18 @@ def init_steps(edition, platform, ver_mode, is_downstream=False, install_deps=Tr 'yarn install --frozen-lockfile --no-progress', ]) if edition == 'enterprise': - if is_downstream: - source_commit = ' $${SOURCE_COMMIT}' - else: + if ver_mode == 'release': + committish = '${DRONE_TAG}' + source_commit = ' ${DRONE_TAG}' + elif ver_mode == 'test-release': + committish = 'master' source_commit = '' + else: + if is_downstream: + source_commit = ' $${SOURCE_COMMIT}' + else: + source_commit = '' + committish = '${DRONE_COMMIT}' steps = [ identify_runner_step, { @@ -128,7 +136,7 @@ def init_steps(edition, platform, ver_mode, is_downstream=False, install_deps=Tr 'commands': [ 'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"', 'cd grafana-enterprise', - 'git checkout ${DRONE_COMMIT}', + 'git checkout {}'.format(committish), ], }, { @@ -863,6 +871,12 @@ def get_windows_steps(edition, ver_mode, is_downstream=False): }) if edition == 'enterprise': + if ver_mode == 'release': + committish = '${DRONE_TAG}' + elif ver_mode == 'test-release': + committish = 'master' + else: + committish = '$$env:DRONE_COMMIT' # For enterprise, we have to clone both OSS and enterprise and merge the latter into the former clone_commands = [ 'git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"', @@ -870,7 +884,7 @@ def get_windows_steps(edition, ver_mode, is_downstream=False): if not is_downstream: clone_commands.extend([ 'cd grafana-enterprise', - 'git checkout $$env:DRONE_COMMIT', + 'git checkout {}'.format(committish), ]) steps.insert(0, { 'name': 'clone',