Commit 5cec4095 by Arve Knudsen Committed by GitHub

Drone: Upload artifacts for release branch builds (#29297)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
parent e4f46592
......@@ -2240,7 +2240,7 @@ depends_on:
---
kind: pipeline
type: docker
name: oss-build-version-branch
name: oss-build-release-branch
platform:
os: linux
......@@ -2459,6 +2459,19 @@ steps:
- test-backend
- test-frontend
- name: upload-packages
image: grafana/grafana-ci-deploy:1.2.7
commands:
- ./bin/grabpl upload-packages --edition oss
environment:
GCP_GRAFANA_UPLOAD_KEY:
from_secret: gcp_key
depends_on:
- package
- end-to-end-tests
- mysql-integration-tests
- postgres-integration-tests
services:
- name: postgres
image: postgres:12.3-alpine
......@@ -2482,7 +2495,7 @@ trigger:
---
kind: pipeline
type: docker
name: oss-windows-version-branch
name: oss-windows-release-branch
platform:
os: windows
......@@ -2522,12 +2535,12 @@ trigger:
- refs/heads/v*
depends_on:
- oss-build-version-branch
- oss-build-release-branch
---
kind: pipeline
type: docker
name: enterprise-build-version-branch
name: enterprise-build-release-branch
platform:
os: linux
......@@ -2767,6 +2780,19 @@ steps:
- test-backend
- test-frontend
- name: upload-packages
image: grafana/grafana-ci-deploy:1.2.7
commands:
- ./bin/grabpl upload-packages --edition enterprise
environment:
GCP_GRAFANA_UPLOAD_KEY:
from_secret: gcp_key
depends_on:
- package
- end-to-end-tests
- mysql-integration-tests
- postgres-integration-tests
services:
- name: postgres
image: postgres:12.3-alpine
......@@ -2790,7 +2816,7 @@ trigger:
---
kind: pipeline
type: docker
name: enterprise-windows-version-branch
name: enterprise-windows-release-branch
platform:
os: windows
......@@ -2851,12 +2877,12 @@ trigger:
- refs/heads/v*
depends_on:
- enterprise-build-version-branch
- enterprise-build-release-branch
---
kind: pipeline
type: docker
name: notify-version-branch
name: notify-release-branch
platform:
os: linux
......@@ -2878,9 +2904,9 @@ trigger:
- failure
depends_on:
- oss-build-version-branch
- oss-windows-version-branch
- enterprise-build-version-branch
- enterprise-windows-version-branch
- oss-build-release-branch
- oss-windows-release-branch
- enterprise-build-release-branch
- enterprise-windows-release-branch
...
......@@ -125,7 +125,7 @@ def init_steps(edition, platform, ver_mode, is_downstream=False, install_deps=Tr
source_commit = ' ${DRONE_TAG}'
elif ver_mode == 'test-release':
committish = 'master'
elif ver_mode == 'version-branch':
elif ver_mode == 'release-branch':
committish = '${DRONE_BRANCH}'
else:
if is_downstream:
......@@ -532,7 +532,7 @@ def package_step(edition, ver_mode, variants=None, is_downstream=False):
variants_str = ' --variants {}'.format(','.join(variants))
else:
variants_str = ''
if ver_mode in ('master', 'release', 'test-release', 'version-branch'):
if ver_mode in ('master', 'release', 'test-release', 'release-branch'):
sign_args = ' --sign'
env = {
'GRAFANA_API_KEY': {
......@@ -870,7 +870,7 @@ def get_windows_steps(edition, ver_mode, is_downstream=False):
},
]
if (ver_mode == 'master' and (edition != 'enterprise' or is_downstream)) or ver_mode in (
'release', 'test-release', 'version-branch',
'release', 'test-release', 'release-branch',
):
bucket_part = ''
bucket = 'grafana-downloads'
......@@ -926,7 +926,7 @@ def get_windows_steps(edition, ver_mode, is_downstream=False):
committish = '${DRONE_TAG}'
elif ver_mode == 'test-release':
committish = 'master'
elif ver_mode == 'version-branch':
elif ver_mode == 'release-branch':
committish = '$$env:DRONE_BRANCH'
else:
committish = '$$env:DRONE_COMMIT'
......
......@@ -57,7 +57,10 @@ def release_npm_packages_step(edition, ver_mode):
'commands': commands,
}
def get_steps(edition, ver_mode, publish):
def get_steps(edition, ver_mode):
should_publish = ver_mode in ('release', 'test-release',)
should_upload = should_publish or ver_mode in ('release-branch',)
steps = [
lint_backend_step(edition),
codespell_step(),
......@@ -73,14 +76,15 @@ def get_steps(edition, ver_mode, publish):
e2e_tests_step(),
build_storybook_step(edition=edition, ver_mode=ver_mode),
copy_packages_for_docker_step(),
build_docker_images_step(edition=edition, ver_mode=ver_mode, publish=publish),
build_docker_images_step(edition=edition, ver_mode=ver_mode, ubuntu=True, publish=publish),
build_docker_images_step(edition=edition, ver_mode=ver_mode, publish=should_publish),
build_docker_images_step(edition=edition, ver_mode=ver_mode, ubuntu=True, publish=should_publish),
postgres_integration_tests_step(),
mysql_integration_tests_step(),
]
if publish:
if should_upload:
steps.append(upload_packages_step(edition=edition, ver_mode=ver_mode))
if should_publish:
steps.extend([
upload_packages_step(edition=edition, ver_mode=ver_mode),
publish_storybook_step(edition=edition, ver_mode=ver_mode),
release_npm_packages_step(edition=edition, ver_mode=ver_mode),
])
......@@ -88,9 +92,9 @@ def get_steps(edition, ver_mode, publish):
return steps, windows_steps
def get_oss_pipelines(trigger, ver_mode, publish):
def get_oss_pipelines(trigger, ver_mode):
services = integration_test_services()
steps, windows_steps = get_steps(edition='oss', ver_mode=ver_mode, publish=publish)
steps, windows_steps = get_steps(edition='oss', ver_mode=ver_mode)
return [
pipeline(
name='oss-build-{}'.format(ver_mode), edition='oss', trigger=trigger, services=services, steps=steps,
......@@ -102,9 +106,9 @@ def get_oss_pipelines(trigger, ver_mode, publish):
),
]
def get_enterprise_pipelines(trigger, ver_mode, publish):
def get_enterprise_pipelines(trigger, ver_mode):
services = integration_test_services()
steps, windows_steps = get_steps(edition='enterprise', ver_mode=ver_mode, publish=publish)
steps, windows_steps = get_steps(edition='enterprise', ver_mode=ver_mode)
return [
pipeline(
name='enterprise-build-{}'.format(ver_mode), edition='enterprise', trigger=trigger, services=services,
......@@ -155,16 +159,16 @@ def release_pipelines(ver_mode='release', trigger=None):
'ref': ['refs/tags/v*',],
}
publish = ver_mode in ('release', 'test-release',)
should_publish = ver_mode in ('release', 'test-release',)
# The release pipelines include also enterprise ones, so both editions are built for a release.
# We could also solve this by triggering a downstream build for the enterprise repo, but by including enterprise
# in OSS release builds, we simplify the UX for the release engineer.
oss_pipelines = get_oss_pipelines(ver_mode=ver_mode, trigger=trigger, publish=publish)
enterprise_pipelines = get_enterprise_pipelines(ver_mode=ver_mode, trigger=trigger, publish=publish)
oss_pipelines = get_oss_pipelines(ver_mode=ver_mode, trigger=trigger)
enterprise_pipelines = get_enterprise_pipelines(ver_mode=ver_mode, trigger=trigger)
pipelines = oss_pipelines + enterprise_pipelines
if publish:
if should_publish:
publish_pipeline = pipeline(
name='publish-{}'.format(ver_mode), trigger=trigger, edition='oss', steps=[
publish_packages_step(edition='oss'),
......@@ -189,8 +193,8 @@ def test_release_pipelines():
'event': ['custom',],
}
oss_pipelines = get_oss_pipelines(ver_mode=ver_mode, trigger=trigger, publish=True)
enterprise_pipelines = get_enterprise_pipelines(ver_mode=ver_mode, trigger=trigger, publish=True)
oss_pipelines = get_oss_pipelines(ver_mode=ver_mode, trigger=trigger)
enterprise_pipelines = get_enterprise_pipelines(ver_mode=ver_mode, trigger=trigger)
publish_cmd = './bin/grabpl publish-packages --edition {{}} --dry-run {}'.format(test_release_ver)
......
......@@ -3,7 +3,7 @@ load(
'release_pipelines',
)
ver_mode = 'version-branch'
ver_mode = 'release-branch'
def version_branch_pipelines():
return release_pipelines(ver_mode=ver_mode, trigger={
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment