| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  | load( | 
					
						
							| 
									
										
										
										
											2021-09-07 17:15:04 +08:00
										 |  |  |     'scripts/drone/steps/lib.star', | 
					
						
							| 
									
										
										
										
											2021-11-17 17:25:55 +08:00
										 |  |  |     'download_grabpl_step', | 
					
						
							|  |  |  |     'initialize_step', | 
					
						
							| 
									
										
										
										
											2021-11-16 01:14:33 +08:00
										 |  |  |     'lint_drone_step', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     'lint_backend_step', | 
					
						
							| 
									
										
										
										
											2021-09-30 15:56:08 +08:00
										 |  |  |     'lint_frontend_step', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     'codespell_step', | 
					
						
							|  |  |  |     'shellcheck_step', | 
					
						
							|  |  |  |     'test_backend_step', | 
					
						
							| 
									
										
										
										
											2021-10-11 17:23:55 +08:00
										 |  |  |     'test_backend_integration_step', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     'test_frontend_step', | 
					
						
							|  |  |  |     'build_backend_step', | 
					
						
							|  |  |  |     'build_frontend_step', | 
					
						
							|  |  |  |     'build_plugins_step', | 
					
						
							|  |  |  |     'package_step', | 
					
						
							| 
									
										
										
										
											2021-11-24 18:20:11 +08:00
										 |  |  |     'install_cypress_step', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     'e2e_tests_server_step', | 
					
						
							|  |  |  |     'e2e_tests_step', | 
					
						
							|  |  |  |     'build_storybook_step', | 
					
						
							| 
									
										
										
										
											2020-10-14 20:35:55 +08:00
										 |  |  |     'build_frontend_docs_step', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     'copy_packages_for_docker_step', | 
					
						
							|  |  |  |     'build_docker_images_step', | 
					
						
							|  |  |  |     'postgres_integration_tests_step', | 
					
						
							|  |  |  |     'mysql_integration_tests_step', | 
					
						
							| 
									
										
										
										
											2021-04-06 21:50:54 +08:00
										 |  |  |     'redis_integration_tests_step', | 
					
						
							| 
									
										
										
										
											2021-04-07 21:06:10 +08:00
										 |  |  |     'memcached_integration_tests_step', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     'get_windows_steps', | 
					
						
							|  |  |  |     'benchmark_ldap_step', | 
					
						
							|  |  |  |     'enterprise_downstream_step', | 
					
						
							|  |  |  |     'frontend_metrics_step', | 
					
						
							|  |  |  |     'publish_storybook_step', | 
					
						
							| 
									
										
										
										
											2020-12-03 18:31:14 +08:00
										 |  |  |     'release_canary_npm_packages_step', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     'upload_packages_step', | 
					
						
							|  |  |  |     'publish_packages_step', | 
					
						
							| 
									
										
										
										
											2021-09-07 15:21:49 +08:00
										 |  |  |     'upload_cdn_step', | 
					
						
							|  |  |  |     'validate_scuemata_step', | 
					
						
							| 
									
										
										
										
											2021-10-08 20:47:55 +08:00
										 |  |  |     'ensure_cuetsified_step', | 
					
						
							| 
									
										
										
										
											2021-08-23 16:08:01 +08:00
										 |  |  |     'test_a11y_frontend_step' | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-07 15:21:49 +08:00
										 |  |  | load( | 
					
						
							| 
									
										
										
										
											2021-09-07 17:15:04 +08:00
										 |  |  |     'scripts/drone/services/services.star', | 
					
						
							| 
									
										
										
										
											2021-09-07 15:21:49 +08:00
										 |  |  |     'integration_test_services', | 
					
						
							|  |  |  |     'ldap_service', | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | load( | 
					
						
							| 
									
										
										
										
											2021-09-07 17:15:04 +08:00
										 |  |  |     'scripts/drone/utils/utils.star', | 
					
						
							| 
									
										
										
										
											2021-09-07 15:21:49 +08:00
										 |  |  |     'pipeline', | 
					
						
							|  |  |  |     'notify_pipeline', | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-06 22:29:29 +08:00
										 |  |  | ver_mode = 'main' | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | def get_steps(edition, is_downstream=False): | 
					
						
							|  |  |  |     publish = edition != 'enterprise' or is_downstream | 
					
						
							| 
									
										
										
										
											2021-01-06 20:22:20 +08:00
										 |  |  |     include_enterprise2 = edition == 'enterprise' | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     steps = [ | 
					
						
							| 
									
										
										
										
											2021-11-16 01:14:33 +08:00
										 |  |  |         lint_drone_step(), | 
					
						
							| 
									
										
										
										
											2020-12-23 22:42:20 +08:00
										 |  |  |         enterprise_downstream_step(edition=edition), | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         codespell_step(), | 
					
						
							|  |  |  |         shellcheck_step(), | 
					
						
							| 
									
										
										
										
											2021-05-04 21:05:39 +08:00
										 |  |  |         lint_backend_step(edition=edition), | 
					
						
							| 
									
										
										
										
											2021-09-30 15:56:08 +08:00
										 |  |  |         lint_frontend_step(), | 
					
						
							| 
									
										
										
										
											2021-08-24 23:07:06 +08:00
										 |  |  |         test_backend_step(edition=edition), | 
					
						
							| 
									
										
										
										
											2021-10-11 17:23:55 +08:00
										 |  |  |         test_backend_integration_step(edition=edition), | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         test_frontend_step(), | 
					
						
							| 
									
										
										
										
											2021-11-20 04:50:34 +08:00
										 |  |  |         postgres_integration_tests_step(edition=edition, ver_mode=ver_mode), | 
					
						
							|  |  |  |         mysql_integration_tests_step(edition=edition, ver_mode=ver_mode), | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         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-09-07 15:21:49 +08:00
										 |  |  |         validate_scuemata_step(), | 
					
						
							| 
									
										
										
										
											2021-10-08 20:47:55 +08:00
										 |  |  |         ensure_cuetsified_step(), | 
					
						
							| 
									
										
										
										
											2021-01-06 20:22:20 +08:00
										 |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if include_enterprise2: | 
					
						
							|  |  |  |         edition2 = 'enterprise2' | 
					
						
							|  |  |  |         steps.extend([ | 
					
						
							| 
									
										
										
										
											2021-05-04 21:05:39 +08:00
										 |  |  |             lint_backend_step(edition=edition2), | 
					
						
							| 
									
										
										
										
											2021-08-24 23:07:06 +08:00
										 |  |  |             test_backend_step(edition=edition2), | 
					
						
							| 
									
										
										
										
											2021-10-11 17:23:55 +08:00
										 |  |  |             test_backend_integration_step(edition=edition2), | 
					
						
							| 
									
										
										
										
											2021-01-06 20:22:20 +08:00
										 |  |  |             build_backend_step(edition=edition2, ver_mode=ver_mode, variants=['linux-x64'], is_downstream=is_downstream), | 
					
						
							|  |  |  |         ]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Insert remaining steps | 
					
						
							|  |  |  |     steps.extend([ | 
					
						
							| 
									
										
										
										
											2021-10-21 14:59:12 +08:00
										 |  |  |         package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2, is_downstream=is_downstream), | 
					
						
							| 
									
										
										
										
											2021-11-24 18:20:11 +08:00
										 |  |  |         install_cypress_step(), | 
					
						
							| 
									
										
										
										
											2020-12-23 22:42:20 +08:00
										 |  |  |         e2e_tests_server_step(edition=edition), | 
					
						
							| 
									
										
										
										
											2021-11-24 18:20:11 +08:00
										 |  |  |         e2e_tests_step('dashboards-suite', edition=edition), | 
					
						
							|  |  |  |         e2e_tests_step('smoke-tests-suite', edition=edition), | 
					
						
							|  |  |  |         e2e_tests_step('panels-suite', edition=edition), | 
					
						
							|  |  |  |         e2e_tests_step('various-suite', edition=edition), | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         build_storybook_step(edition=edition, ver_mode=ver_mode), | 
					
						
							|  |  |  |         publish_storybook_step(edition=edition, ver_mode=ver_mode), | 
					
						
							| 
									
										
										
										
											2021-11-10 20:35:03 +08:00
										 |  |  |         test_a11y_frontend_step(ver_mode=ver_mode, edition=edition), | 
					
						
							| 
									
										
										
										
											2021-06-29 16:29:34 +08:00
										 |  |  |         frontend_metrics_step(edition=edition), | 
					
						
							| 
									
										
										
										
											2020-10-14 20:35:55 +08:00
										 |  |  |         build_frontend_docs_step(edition=edition), | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08: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), | 
					
						
							| 
									
										
										
										
											2021-04-06 21:50:54 +08:00
										 |  |  |     ]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if include_enterprise2: | 
					
						
							| 
									
										
										
										
											2021-11-20 04:50:34 +08:00
										 |  |  |       steps.extend([redis_integration_tests_step(edition=edition2, ver_mode=ver_mode), memcached_integration_tests_step(edition=edition2, ver_mode=ver_mode)]) | 
					
						
							| 
									
										
										
										
											2021-04-06 21:50:54 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     steps.extend([ | 
					
						
							| 
									
										
										
										
											2020-12-03 18:31:14 +08:00
										 |  |  |         release_canary_npm_packages_step(edition), | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         upload_packages_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream), | 
					
						
							| 
									
										
										
										
											2021-09-07 15:21:49 +08:00
										 |  |  |         upload_cdn_step(edition=edition) | 
					
						
							| 
									
										
										
										
											2021-01-06 20:22:20 +08:00
										 |  |  |     ]) | 
					
						
							| 
									
										
										
										
											2021-02-09 21:55:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-06 20:22:20 +08:00
										 |  |  |     if include_enterprise2: | 
					
						
							|  |  |  |         edition2 = 'enterprise2' | 
					
						
							| 
									
										
										
										
											2020-12-23 22:42:20 +08:00
										 |  |  |         steps.extend([ | 
					
						
							| 
									
										
										
										
											2021-10-21 14:59:12 +08:00
										 |  |  |             package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64'], is_downstream=is_downstream), | 
					
						
							| 
									
										
										
										
											2021-01-06 20:22:20 +08:00
										 |  |  |             e2e_tests_server_step(edition=edition2, port=3002), | 
					
						
							|  |  |  |             e2e_tests_step(edition=edition2, port=3002), | 
					
						
							| 
									
										
										
										
											2021-11-24 18:20:11 +08:00
										 |  |  |             e2e_tests_step('dashboards-suite', edition=edition2, port=3002), | 
					
						
							|  |  |  |             e2e_tests_step('smoke-tests-suite', edition=edition2, port=3002), | 
					
						
							|  |  |  |             e2e_tests_step('panels-suite', edition=edition2, port=3002), | 
					
						
							|  |  |  |             e2e_tests_step('various-suite', edition=edition2, port=3002), | 
					
						
							| 
									
										
										
										
											2021-01-06 20:22:20 +08:00
										 |  |  |             upload_packages_step(edition=edition2, ver_mode=ver_mode, is_downstream=is_downstream), | 
					
						
							| 
									
										
										
										
											2021-09-07 15:21:49 +08:00
										 |  |  |             upload_cdn_step(edition=edition2) | 
					
						
							| 
									
										
										
										
											2020-12-23 22:42:20 +08:00
										 |  |  |         ]) | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-23 22:42:20 +08: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 20:22:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return steps, windows_steps, publish_steps | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-06 22:29:29 +08:00
										 |  |  | def main_pipelines(edition): | 
					
						
							| 
									
										
										
										
											2021-04-06 21:50:54 +08:00
										 |  |  |     services = integration_test_services(edition) | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     trigger = { | 
					
						
							|  |  |  |         'event': ['push',], | 
					
						
							| 
									
										
										
										
											2021-05-06 22:29:29 +08:00
										 |  |  |         'branch': 'main', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     steps, windows_steps, publish_steps = get_steps(edition=edition) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if edition == 'enterprise': | 
					
						
							|  |  |  |         steps.append(benchmark_ldap_step()) | 
					
						
							|  |  |  |         services.append(ldap_service()) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pipelines = [ | 
					
						
							|  |  |  |         pipeline( | 
					
						
							| 
									
										
										
										
											2021-11-17 17:25:55 +08:00
										 |  |  |             name='build-main', edition=edition, trigger=trigger, services=services, | 
					
						
							|  |  |  |             steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + steps, | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         ), | 
					
						
							|  |  |  |         pipeline( | 
					
						
							| 
									
										
										
										
											2021-11-17 17:25:55 +08:00
										 |  |  |             name='windows-main', edition=edition, trigger=trigger, | 
					
						
							|  |  |  |             steps=initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_steps, | 
					
						
							|  |  |  |             depends_on=['build-main'], platform='windows', | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         ), | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  |     if edition != 'enterprise': | 
					
						
							|  |  |  |         pipelines.append(pipeline( | 
					
						
							| 
									
										
										
										
											2021-11-17 17:25:55 +08:00
										 |  |  |             name='publish-main', edition=edition, trigger=trigger, | 
					
						
							|  |  |  |             steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode, install_deps=False) + publish_steps, | 
					
						
							|  |  |  |             depends_on=['build-main', 'windows-main',], | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         )) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         pipelines.append(notify_pipeline( | 
					
						
							| 
									
										
										
										
											2021-05-06 22:29:29 +08:00
										 |  |  |             name='notify-main', slack_channel='grafana-ci-notifications', trigger=trigger, | 
					
						
							|  |  |  |             depends_on=['build-main', 'windows-main', 'publish-main'], | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         )) | 
					
						
							|  |  |  |     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( | 
					
						
							| 
									
										
										
										
											2021-11-17 17:25:55 +08:00
										 |  |  |             name='build-main-downstream', edition=edition, trigger=trigger, services=services, | 
					
						
							|  |  |  |             steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode, is_downstream=True) + steps, | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         )) | 
					
						
							|  |  |  |         pipelines.append(pipeline( | 
					
						
							| 
									
										
										
										
											2021-11-17 17:25:55 +08:00
										 |  |  |             name='windows-main-downstream', edition=edition, trigger=trigger, | 
					
						
							|  |  |  |             steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode, is_downstream=True) + windows_steps, | 
					
						
							|  |  |  |             platform='windows', depends_on=['build-main-downstream'], | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         )) | 
					
						
							|  |  |  |         pipelines.append(pipeline( | 
					
						
							| 
									
										
										
										
											2021-11-17 17:25:55 +08:00
										 |  |  |             name='publish-main-downstream', edition=edition, trigger=trigger, | 
					
						
							|  |  |  |             steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode, is_downstream=True, install_deps=False) + publish_steps, | 
					
						
							|  |  |  |             depends_on=['build-main-downstream', 'windows-main-downstream'], | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         )) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         pipelines.append(notify_pipeline( | 
					
						
							| 
									
										
										
										
											2021-05-06 22:29:29 +08:00
										 |  |  |             name='notify-main-downstream', slack_channel='grafana-enterprise-ci-notifications', trigger=trigger, | 
					
						
							|  |  |  |             depends_on=['build-main-downstream', 'windows-main-downstream', 'publish-main-downstream'], | 
					
						
							| 
									
										
										
										
											2020-10-07 20:22:15 +08:00
										 |  |  |         )) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return pipelines |