2020-10-07 07:22:15 -05:00
|
|
|
load(
|
|
|
|
'scripts/lib.star',
|
|
|
|
'pipeline',
|
|
|
|
'lint_backend_step',
|
|
|
|
'codespell_step',
|
|
|
|
'shellcheck_step',
|
|
|
|
'test_backend_step',
|
|
|
|
'test_frontend_step',
|
|
|
|
'build_backend_step',
|
|
|
|
'build_frontend_step',
|
|
|
|
'build_plugins_step',
|
2021-01-06 06:22:20 -06:00
|
|
|
'gen_version_step',
|
2020-10-07 07:22:15 -05:00
|
|
|
'package_step',
|
|
|
|
'e2e_tests_server_step',
|
|
|
|
'e2e_tests_step',
|
|
|
|
'build_storybook_step',
|
2020-10-14 07:35:55 -05:00
|
|
|
'build_frontend_docs_step',
|
2020-10-07 07:22:15 -05:00
|
|
|
'copy_packages_for_docker_step',
|
|
|
|
'build_docker_images_step',
|
|
|
|
'postgres_integration_tests_step',
|
|
|
|
'mysql_integration_tests_step',
|
2021-04-06 08:50:54 -05:00
|
|
|
'redis_integration_tests_step',
|
2021-04-07 08:06:10 -05:00
|
|
|
'memcached_integration_tests_step',
|
2020-10-07 07:22:15 -05:00
|
|
|
'get_windows_steps',
|
|
|
|
'benchmark_ldap_step',
|
|
|
|
'ldap_service',
|
|
|
|
'enterprise_downstream_step',
|
|
|
|
'frontend_metrics_step',
|
|
|
|
'publish_storybook_step',
|
2020-12-03 04:31:14 -06:00
|
|
|
'release_canary_npm_packages_step',
|
2020-10-07 07:22:15 -05:00
|
|
|
'upload_packages_step',
|
|
|
|
'deploy_to_kubernetes_step',
|
|
|
|
'publish_packages_step',
|
|
|
|
'notify_pipeline',
|
|
|
|
'integration_test_services',
|
2021-02-09 07:55:11 -06:00
|
|
|
'upload_cdn'
|
2020-10-07 07:22:15 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
ver_mode = 'master'
|
|
|
|
|
|
|
|
def get_steps(edition, is_downstream=False):
|
|
|
|
publish = edition != 'enterprise' or is_downstream
|
2021-01-06 06:22:20 -06:00
|
|
|
include_enterprise2 = edition == 'enterprise'
|
2020-10-07 07:22:15 -05:00
|
|
|
steps = [
|
2020-12-23 08:42:20 -06:00
|
|
|
enterprise_downstream_step(edition=edition),
|
|
|
|
lint_backend_step(edition=edition),
|
2020-10-07 07:22:15 -05:00
|
|
|
codespell_step(),
|
|
|
|
shellcheck_step(),
|
2021-01-06 06:22:20 -06:00
|
|
|
test_backend_step(edition=edition),
|
2020-10-07 07:22:15 -05:00
|
|
|
test_frontend_step(),
|
|
|
|
frontend_metrics_step(edition=edition),
|
|
|
|
build_backend_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream),
|
|
|
|
build_frontend_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream),
|
|
|
|
build_plugins_step(edition=edition, sign=True),
|
2021-01-06 06:22:20 -06:00
|
|
|
]
|
|
|
|
|
|
|
|
# Have to insert Enterprise2 steps before they're depended on (in the gen-version step)
|
|
|
|
if include_enterprise2:
|
|
|
|
edition2 = 'enterprise2'
|
|
|
|
steps.extend([
|
|
|
|
lint_backend_step(edition=edition2),
|
|
|
|
test_backend_step(edition=edition2),
|
|
|
|
build_backend_step(edition=edition2, ver_mode=ver_mode, variants=['linux-x64'], is_downstream=is_downstream),
|
|
|
|
])
|
|
|
|
|
|
|
|
# Insert remaining steps
|
|
|
|
steps.extend([
|
|
|
|
gen_version_step(ver_mode=ver_mode, is_downstream=is_downstream, include_enterprise2=include_enterprise2),
|
2020-10-07 07:22:15 -05:00
|
|
|
package_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream),
|
2020-12-23 08:42:20 -06:00
|
|
|
e2e_tests_server_step(edition=edition),
|
2021-01-06 06:22:20 -06:00
|
|
|
e2e_tests_step(edition=edition),
|
2020-10-07 07:22:15 -05:00
|
|
|
build_storybook_step(edition=edition, ver_mode=ver_mode),
|
|
|
|
publish_storybook_step(edition=edition, ver_mode=ver_mode),
|
2020-10-14 07:35:55 -05:00
|
|
|
build_frontend_docs_step(edition=edition),
|
2020-10-07 07:22:15 -05:00
|
|
|
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),
|
|
|
|
postgres_integration_tests_step(),
|
|
|
|
mysql_integration_tests_step(),
|
2021-04-06 08:50:54 -05:00
|
|
|
])
|
|
|
|
|
|
|
|
if include_enterprise2:
|
2021-04-07 08:06:10 -05:00
|
|
|
steps.extend([redis_integration_tests_step(), memcached_integration_tests_step()])
|
2021-04-06 08:50:54 -05:00
|
|
|
|
|
|
|
steps.extend([
|
2020-12-03 04:31:14 -06:00
|
|
|
release_canary_npm_packages_step(edition),
|
2020-10-07 07:22:15 -05:00
|
|
|
upload_packages_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream),
|
|
|
|
deploy_to_kubernetes_step(edition=edition, is_downstream=is_downstream),
|
2021-02-10 01:58:41 -06:00
|
|
|
upload_cdn(edition=edition)
|
2021-01-06 06:22:20 -06:00
|
|
|
])
|
2021-02-09 07:55:11 -06:00
|
|
|
|
2021-01-06 06:22:20 -06:00
|
|
|
if include_enterprise2:
|
|
|
|
edition2 = 'enterprise2'
|
2020-12-23 08:42:20 -06:00
|
|
|
steps.extend([
|
2021-01-06 06:22:20 -06:00
|
|
|
package_step(edition=edition2, ver_mode=ver_mode, variants=['linux-x64'], is_downstream=is_downstream),
|
|
|
|
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),
|
2021-02-10 01:58:41 -06:00
|
|
|
upload_cdn(edition=edition2)
|
2020-12-23 08:42:20 -06:00
|
|
|
])
|
2020-10-07 07:22:15 -05:00
|
|
|
|
2020-12-23 08:42:20 -06:00
|
|
|
windows_steps = get_windows_steps(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream)
|
|
|
|
if edition == 'enterprise' and not is_downstream:
|
|
|
|
publish_steps = []
|
|
|
|
else:
|
|
|
|
publish_steps = [
|
|
|
|
publish_packages_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream),
|
|
|
|
]
|
2020-10-07 07:22:15 -05:00
|
|
|
|
|
|
|
return steps, windows_steps, publish_steps
|
|
|
|
|
|
|
|
def master_pipelines(edition):
|
2021-04-06 08:50:54 -05:00
|
|
|
services = integration_test_services(edition)
|
2020-10-07 07:22:15 -05:00
|
|
|
trigger = {
|
|
|
|
'event': ['push',],
|
|
|
|
'branch': 'master',
|
|
|
|
}
|
|
|
|
steps, windows_steps, publish_steps = get_steps(edition=edition)
|
|
|
|
|
|
|
|
if edition == 'enterprise':
|
|
|
|
steps.append(benchmark_ldap_step())
|
|
|
|
services.append(ldap_service())
|
|
|
|
|
|
|
|
pipelines = [
|
|
|
|
pipeline(
|
|
|
|
name='build-master', edition=edition, trigger=trigger, services=services, steps=steps,
|
|
|
|
ver_mode=ver_mode,
|
|
|
|
),
|
|
|
|
pipeline(
|
|
|
|
name='windows-master', edition=edition, trigger=trigger, steps=windows_steps, platform='windows',
|
|
|
|
depends_on=['build-master'], ver_mode=ver_mode,
|
|
|
|
),
|
|
|
|
]
|
|
|
|
if edition != 'enterprise':
|
|
|
|
pipelines.append(pipeline(
|
|
|
|
name='publish-master', edition=edition, trigger=trigger, steps=publish_steps,
|
|
|
|
depends_on=['build-master', 'windows-master',], install_deps=False, ver_mode=ver_mode,
|
|
|
|
))
|
|
|
|
|
|
|
|
pipelines.append(notify_pipeline(
|
|
|
|
name='notify-master', slack_channel='grafana-ci-notifications', trigger=trigger,
|
|
|
|
depends_on=['build-master', 'windows-master', 'publish-master'],
|
|
|
|
))
|
|
|
|
else:
|
|
|
|
# Add downstream enterprise pipelines triggerable from OSS builds
|
|
|
|
trigger = {
|
|
|
|
'event': ['custom',],
|
|
|
|
}
|
|
|
|
steps, windows_steps, publish_steps = get_steps(edition=edition, is_downstream=True)
|
|
|
|
pipelines.append(pipeline(
|
|
|
|
name='build-master-downstream', edition=edition, trigger=trigger, services=services, steps=steps,
|
|
|
|
is_downstream=True, ver_mode=ver_mode,
|
|
|
|
))
|
|
|
|
pipelines.append(pipeline(
|
|
|
|
name='windows-master-downstream', edition=edition, trigger=trigger, steps=windows_steps,
|
|
|
|
platform='windows', depends_on=['build-master-downstream'], is_downstream=True, ver_mode=ver_mode,
|
|
|
|
))
|
|
|
|
pipelines.append(pipeline(
|
|
|
|
name='publish-master-downstream', edition=edition, trigger=trigger, steps=publish_steps,
|
|
|
|
depends_on=['build-master-downstream', 'windows-master-downstream'], is_downstream=True, install_deps=False,
|
|
|
|
ver_mode=ver_mode,
|
|
|
|
))
|
|
|
|
|
|
|
|
pipelines.append(notify_pipeline(
|
|
|
|
name='notify-master-downstream', slack_channel='grafana-enterprise-ci-notifications', trigger=trigger,
|
|
|
|
depends_on=['build-master-downstream', 'windows-master-downstream', 'publish-master-downstream'],
|
|
|
|
))
|
|
|
|
|
|
|
|
return pipelines
|