[v7.4.x]: Sync drone config from master to stable release branch (#31213)

This commit is contained in:
Torkel Ödegaard authored and GitHub committed 2021-02-15 12:26:43 +01:00
1 parent dbad6a9182
commit 1adce1fcfc
4 files changed
+344 -239

No files matched your search

+288 -188
View File
File diff suppressed because it is too large. Load diff
+48 -51
View File
@@ -1,5 +1,5 @@
grabpl_version = '0.5.36'
build_image = 'grafana/build-container:1.3.1'
grabpl_version = '0.5.38'
build_image = 'grafana/build-container:1.3.2'
publish_image = 'grafana/grafana-ci-deploy:1.3.1'
grafana_docker_image = 'grafana/drone-grafana-docker:0.3.2'
alpine_image = 'alpine:3.12'
@@ -71,7 +71,7 @@ def slack_step(channel):
'from_secret': 'slack_webhook',
},
'channel': channel,
'template': 'Build {{build.number}} failed: {{build.link}}',
'template': 'Build {{build.number}} failed for commit: <https://github.com/{{repo.owner}}/{{repo.name}}/commit/{{build.commit}}|{{ truncate build.commit 8 }}>: {{build.link}}\nAuthor: {{build.author}}',
},
}
@@ -206,11 +206,8 @@ def enterprise_downstream_step(edition):
}
def lint_backend_step(edition):
sfx = ''
if edition == 'enterprise2':
sfx = '-{}'.format(edition)
return {
'name': 'lint-backend' + sfx,
'name': 'lint-backend' + enterprise2_sfx(edition),
'image': build_image,
'environment': {
# We need CGO because of go-sqlite3
@@ -309,15 +306,28 @@ def publish_storybook_step(edition, ver_mode):
'commands': commands,
}
def upload_cdn(edition):
return {
'name': 'upload-cdn-assets' + enterprise2_sfx(edition),
'image': publish_image,
'depends_on': [
'package' + enterprise2_sfx(edition),
],
'environment': {
'GCP_GRAFANA_UPLOAD_KEY': {
'from_secret': 'gcp_key',
},
},
'commands': [
'./bin/grabpl upload-cdn --edition {} --bucket "grafana-static-assets"'.format(edition),
],
}
def build_backend_step(edition, ver_mode, variants=None, is_downstream=False):
variants_str = ''
if variants:
variants_str = ' --variants {}'.format(','.join(variants))
sfx = ''
if edition == 'enterprise2':
sfx = '-{}'.format(edition)
# TODO: Convert number of jobs to percentage
if ver_mode == 'release':
env = {
@@ -354,12 +364,12 @@ def build_backend_step(edition, ver_mode, variants=None, is_downstream=False):
]
return {
'name': 'build-backend' + sfx,
'name': 'build-backend' + enterprise2_sfx(edition),
'image': build_image,
'depends_on': [
'initialize',
'lint-backend' + sfx,
'test-backend' + sfx,
'lint-backend' + enterprise2_sfx(edition),
'test-backend' + enterprise2_sfx(edition),
],
'environment': env,
'commands': cmds,
@@ -436,16 +446,12 @@ def build_plugins_step(edition, sign=False):
}
def test_backend_step(edition):
sfx = ''
if edition == 'enterprise2':
sfx = '-{}'.format(edition)
return {
'name': 'test-backend' + sfx,
'name': 'test-backend' + enterprise2_sfx(edition),
'image': build_image,
'depends_on': [
'initialize',
'lint-backend' + sfx,
'lint-backend' + enterprise2_sfx(edition),
],
'commands': [
# First make sure that there are no tests with FocusConvey
@@ -576,10 +582,6 @@ def package_step(edition, ver_mode, variants=None, is_downstream=False):
if variants:
variants_str = ' --variants {}'.format(','.join(variants))
sfx = ''
if edition == 'enterprise2':
sfx = '-{}'.format(edition)
if ver_mode in ('master', 'release', 'test-release', 'release-branch'):
sign_args = ' --sign'
env = {
@@ -631,7 +633,7 @@ def package_step(edition, ver_mode, variants=None, is_downstream=False):
]
return {
'name': 'package' + sfx,
'name': 'package' + enterprise2_sfx(edition),
'image': build_image,
'depends_on': [
# This step should have all the dependencies required for packaging, and should generate
@@ -643,11 +645,9 @@ def package_step(edition, ver_mode, variants=None, is_downstream=False):
}
def e2e_tests_server_step(edition, port=3001):
sfx = ''
package_file_pfx = ''
if edition == 'enterprise2':
sfx = '-{}'.format(edition)
package_file_pfx = 'grafana' + sfx
package_file_pfx = 'grafana' + enterprise2_sfx(edition)
elif edition == 'enterprise':
package_file_pfx = 'grafana-' + edition
@@ -659,11 +659,11 @@ def e2e_tests_server_step(edition, port=3001):
environment['RUNDIR'] = 'e2e/tmp-{}'.format(package_file_pfx)
return {
'name': 'end-to-end-tests-server' + sfx,
'name': 'end-to-end-tests-server' + enterprise2_sfx(edition),
'image': build_image,
'detach': True,
'depends_on': [
'package' + sfx,
'package' + enterprise2_sfx(edition),
],
'environment': environment,
'commands': [
@@ -672,18 +672,14 @@ def e2e_tests_server_step(edition, port=3001):
}
def e2e_tests_step(edition, port=3001):
sfx = ''
if edition == 'enterprise2':
sfx = '-{}'.format(edition)
return {
'name': 'end-to-end-tests' + sfx,
'name': 'end-to-end-tests' + enterprise2_sfx(edition),
'image': 'grafana/ci-e2e:12.19.0-1',
'depends_on': [
'end-to-end-tests-server' + sfx,
'end-to-end-tests-server' + enterprise2_sfx(edition),
],
'environment': {
'HOST': 'end-to-end-tests-server' + sfx,
'HOST': 'end-to-end-tests-server' + enterprise2_sfx(edition),
},
'commands': [
# Have to re-install Cypress since it insists on searching for its binary beneath /root/.cache,
@@ -726,14 +722,16 @@ def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publis
if ver_mode == 'test-release':
publish = False
sfx = ''
ubuntu_sfx = ''
if ubuntu:
sfx = '-ubuntu'
ubuntu_sfx = '-ubuntu'
settings = {
'dry_run': not publish,
'edition': edition,
'ubuntu': ubuntu,
}
if publish:
settings['username'] = {
'from_secret': 'docker_user',
@@ -744,11 +742,9 @@ def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publis
if archs:
settings['archs'] = ','.join(archs)
return {
'name': 'build-docker-images' + sfx,
'name': 'build-docker-images' + ubuntu_sfx,
'image': grafana_docker_image,
'depends_on': [
'copy-packages-for-docker',
],
'depends_on': ['copy-packages-for-docker'],
'settings': settings,
}
@@ -840,15 +836,16 @@ def deploy_to_kubernetes_step(edition, is_downstream=False):
],
}
def enterprise2_sfx(edition):
if edition == 'enterprise2':
return '-{}'.format(edition)
return ''
def upload_packages_step(edition, ver_mode, is_downstream=False):
if ver_mode == 'master' and edition in ('enterprise', 'enterprise2') and not is_downstream:
return None
sfx = ''
packages_bucket = ''
if edition == 'enterprise2':
sfx = '-{}'.format(edition)
packages_bucket = ' --packages-bucket grafana-downloads' + sfx
packages_bucket = ' --packages-bucket grafana-downloads' + enterprise2_sfx(edition)
if ver_mode == 'test-release':
cmd = './bin/grabpl upload-packages --edition {} '.format(edition) + \
@@ -857,11 +854,11 @@ def upload_packages_step(edition, ver_mode, is_downstream=False):
cmd = './bin/grabpl upload-packages --edition {}{}'.format(edition, packages_bucket)
return {
'name': 'upload-packages' + sfx,
'name': 'upload-packages' + enterprise2_sfx(edition),
'image': publish_image,
'depends_on': [
'package' + sfx,
'end-to-end-tests' + sfx,
'package' + enterprise2_sfx(edition),
'end-to-end-tests' + enterprise2_sfx(edition),
'mysql-integration-tests',
'postgres-integration-tests',
],
+4
View File
@@ -32,6 +32,7 @@ load(
'publish_packages_step',
'notify_pipeline',
'integration_test_services',
'upload_cdn'
)
ver_mode = 'master'
@@ -79,7 +80,9 @@ def get_steps(edition, is_downstream=False):
release_canary_npm_packages_step(edition),
upload_packages_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream),
deploy_to_kubernetes_step(edition=edition, is_downstream=is_downstream),
upload_cdn(edition=edition)
])
if include_enterprise2:
edition2 = 'enterprise2'
steps.extend([
@@ -87,6 +90,7 @@ def get_steps(edition, is_downstream=False):
e2e_tests_server_step(edition=edition2, port=3002),
e2e_tests_step(edition=edition2, port=3002),
upload_packages_step(edition=edition2, ver_mode=ver_mode, is_downstream=is_downstream),
upload_cdn(edition=edition2)
])
windows_steps = get_windows_steps(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream)
+4
View File
@@ -31,6 +31,7 @@ load(
'notify_pipeline',
'integration_test_services',
'publish_packages_step',
'upload_cdn'
)
def release_npm_packages_step(edition, ver_mode):
@@ -99,7 +100,9 @@ def get_steps(edition, ver_mode):
postgres_integration_tests_step(),
mysql_integration_tests_step(),
])
if should_upload:
steps.append(upload_cdn(edition=edition))
steps.append(upload_packages_step(edition=edition, ver_mode=ver_mode))
if should_publish:
steps.extend([
@@ -112,6 +115,7 @@ def get_steps(edition, ver_mode):
edition2 = 'enterprise2'
steps.extend([
package_step(edition=edition2, ver_mode=ver_mode, variants=['linux-x64']),
upload_cdn(edition=edition2),
e2e_tests_server_step(edition=edition2, port=3002),
e2e_tests_step(edition=edition2, port=3002),
])