2021-11-30 18:53:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								load('scripts/drone/vault.star', 'from_secret', 'github_token', 'pull_secret', 'drone_token', 'prerelease_bucket')
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 14:44:31 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								grabpl_version = 'v3.0.14'
							 
						 
					
						
							
								
									
										
										
										
											2022-10-07 18:47:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								build_image = 'grafana/build-container:1.6.3'
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 18:34:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								publish_image = 'grafana/grafana-ci-deploy:1.3.3'
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								deploy_docker_image = 'us.gcr.io/kubernetes-dev/drone/plugins/deploy-image'
							 
						 
					
						
							
								
									
										
										
										
											2022-08-16 00:17:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								alpine_image = 'alpine:3.15.6'
							 
						 
					
						
							
								
									
										
										
										
											2021-11-16 01:14:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								curl_image = 'byrnedo/alpine-curl:0.1.8'
							 
						 
					
						
							
								
									
										
										
										
											2020-08-19 17:46:36 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								windows_image = 'mcr.microsoft.com/windows:1809'
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								wix_image = 'grafana/ci-wix:0.1.1'
							 
						 
					
						
							
								
									
										
										
										
											2022-10-07 18:47:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								go_image = 'golang:1.19.2'
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 17:17:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								disable_tests = False
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								trigger_oss = {
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    'repo': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'grafana/grafana',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								trigger_storybook = {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    'paths': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'include': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'packages/grafana-ui/**',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 02:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def slack_step(channel, template, secret):
							 
						 
					
						
							
								
									
										
										
										
											2020-09-30 17:04:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'slack',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': 'plugins/slack',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'settings': {
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 02:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'webhook': from_secret(secret),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-30 17:04:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'channel': channel,
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 02:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'template': template,
							 
						 
					
						
							
								
									
										
										
										
											2020-09-30 17:04:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 23:58:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def yarn_install_step(edition="oss"):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deps = []
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if edition == 'enterprise':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        deps = ['init-enterprise']
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'yarn-install',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 22:19:10 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'yarn install --immutable',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 23:58:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': deps,
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2020-07-14 19:31:26 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 22:43:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def wire_install_step():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'wire-install',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'make gen-go',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-06-09 14:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'verify-gen-cue',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2020-09-30 17:04:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def identify_runner_step(platform='linux'):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if platform == 'windows':
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'identify-runner',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'image': windows_image,
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                'echo $env:DRONE_RUNNER_NAME',
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'identify-runner',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'image': alpine_image,
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                'echo $DRONE_RUNNER_NAME',
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def clone_enterprise_step(ver_mode):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        committish = '${DRONE_TAG}'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    elif ver_mode == 'release-branch':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        committish = '${DRONE_BRANCH}'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        committish = '${DRONE_COMMIT}'
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'clone-enterprise',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GITHUB_TOKEN': from_secret(github_token),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git"',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'cd grafana-enterprise',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'git checkout {}'.format(committish),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def init_enterprise_step(ver_mode):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    source_commit = ''
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        source_commit = ' ${DRONE_TAG}'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        environment = {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GITHUB_TOKEN': from_secret(github_token),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        token = "--github-token $${GITHUB_TOKEN}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    elif ver_mode == 'release-branch':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        environment = {}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        token = ""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        environment = {}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        token = ""
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'init-enterprise',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'clone-enterprise',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': environment,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'mv bin/grabpl /tmp/',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'rmdir bin',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'mv grafana-enterprise /tmp/',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            '/tmp/grabpl init-enterprise {} /tmp/grafana-enterprise{}'.format(token, source_commit),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'mkdir bin',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'mv /tmp/grabpl bin/'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def download_grabpl_step(platform="linux"):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if platform == 'windows':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'grabpl',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'image': wix_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                '$$ProgressPreference = "SilentlyContinue"',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/{}/windows/grabpl.exe -OutFile grabpl.exe'.format(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    grabpl_version),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-16 01:14:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'grabpl',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': curl_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'mkdir -p bin',
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 22:28:29 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/{}/grabpl'.format(
							 
						 
					
						
							
								
									
										
										
										
											2021-11-16 01:14:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                grabpl_version
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'chmod +x bin/grabpl',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-16 01:14:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def lint_drone_step():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'lint-drone',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': curl_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-14 22:07:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build verify-drone',
							 
						 
					
						
							
								
									
										
										
										
											2021-11-16 01:14:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-14 22:45:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'compile-build-cmd',
							 
						 
					
						
							
								
									
										
										
										
											2021-11-16 01:14:33 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-16 20:28:37 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def enterprise_downstream_step(edition, ver_mode):
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return None
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-16 20:28:37 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    repo = 'grafana/grafana-enterprise@'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'pr':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        repo += '${DRONE_SOURCE_BRANCH}'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        repo += 'main'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    step = {
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'trigger-enterprise-downstream',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': 'grafana/drone-downstream',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'settings': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'server': 'https://drone.grafana.net',
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 18:22:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'token': from_secret(drone_token),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'repositories': [
							 
						 
					
						
							
								
									
										
										
										
											2022-05-16 20:28:37 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                repo,
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'params': [
							 
						 
					
						
							
								
									
										
										
										
											2022-02-23 00:02:36 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                'SOURCE_BUILD_NUMBER=${DRONE_COMMIT}',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                'SOURCE_COMMIT=${DRONE_COMMIT}',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-16 20:28:37 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if ver_mode == 'pr':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        step.update({ 'failure': 'ignore' })
							 
						 
					
						
							
								
									
										
										
										
											2022-06-13 23:06:11 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        step['settings']['params'].append('OSS_PULL_REQUEST=${DRONE_PULL_REQUEST}')
							 
						 
					
						
							
								
									
										
										
										
											2022-05-16 20:28:37 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return step
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-13 00:36:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								def lint_backend_step(edition):
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 22:43:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2021-09-07 15:21:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'lint-backend' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2022-09-21 19:05:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'image': go_image,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 22:43:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # We need CGO because of go-sqlite3
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'CGO_ENABLED': '1',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'wire-install',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 22:43:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-21 19:05:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'apt-get update && apt-get install make',
							 
						 
					
						
							
								
									
										
										
										
											2020-08-11 00:38:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            # Don't use Make since it will re-download the linters
							 
						 
					
						
							
								
									
										
										
										
											2022-06-18 01:46:20 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'make lint-go',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-13 22:43:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2020-07-16 15:25:07 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-01 01:28:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								def benchmark_ldap_step():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'benchmark-ldap',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'LDAP_HOSTNAME': 'ldap',
							 
						 
					
						
							
								
									
										
										
										
											2020-10-01 01:28:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2021-09-24 05:41:34 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'dockerize -wait tcp://ldap:389 -timeout 120s',
							 
						 
					
						
							
								
									
										
										
										
											2020-10-01 01:28:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'go test -benchmem -run=^$ ./pkg/extensions/ldapsync -bench "^(Benchmark50Users)$"',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								def build_storybook_step(edition, ver_mode):
							 
						 
					
						
							
								
									
										
										
										
											2022-07-22 20:29:29 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return None
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-16 15:25:07 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'build-storybook',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # Best to ensure that this step doesn't mess with what's getting built and packaged
							 
						 
					
						
							
								
									
										
										
										
											2021-10-21 14:59:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'build-frontend',
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 19:02:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'build-frontend-packages',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-16 15:25:07 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2020-11-02 17:02:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'NODE_OPTIONS': '--max_old_space_size=4096',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 21:30:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'yarn storybook:build',
							 
						 
					
						
							
								
									
										
										
										
											2020-11-04 01:34:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            './bin/grabpl verify-storybook',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 21:30:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'when': trigger_storybook,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 21:30:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def store_storybook_step(edition, ver_mode, trigger=None):
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 21:30:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return None
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 00:42:40 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    commands = []
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 17:26:45 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        commands.extend([
							 
						 
					
						
							
								
									
										
										
										
											2022-09-15 16:06:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build store-storybook --deployment latest',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            './bin/build store-storybook --deployment ${DRONE_TAG}',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 17:26:45 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
									
										
										
										
											2022-04-12 17:26:45 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        # main pipelines should deploy storybook to grafana-storybook/canary public bucket
							 
						 
					
						
							
								
									
										
										
										
											2022-09-15 16:06:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        commands = ['./bin/build store-storybook --deployment canary', ]
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    step = {
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 19:23:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'store-storybook',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 21:30:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': publish_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': ['build-storybook', ] + end_to_end_tests_deps(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 21:30:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 18:53:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'PRERELEASE_BUCKET': from_secret(prerelease_bucket)
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 21:30:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': commands,
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'when': trigger_storybook,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if trigger and ver_mode in ("release-branch", "main"):
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        # no dict merge operation available, https://github.com/harness/drone-cli/pull/220
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        when_cond = {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'repo': ['grafana/grafana',],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'paths': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'include': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'packages/grafana-ui/**',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        step = dict(step, when=when_cond)
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return step
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-24 17:43:32 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def e2e_tests_artifacts(edition):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 23:58:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'e2e-tests-artifacts-upload' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2021-12-24 17:43:32 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'image': 'google/cloud-sdk:367.0.0',
							 
						 
					
						
							
								
									
										
										
										
											2022-01-04 22:28:06 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2021-12-24 17:43:32 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'end-to-end-tests-dashboards-suite',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'end-to-end-tests-panels-suite',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'end-to-end-tests-smoke-tests-suite',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'end-to-end-tests-various-suite',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 23:58:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'when': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'status': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'success',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'failure',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2021-12-24 17:43:32 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY': from_secret('gcp_upload_artifacts_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'E2E_TEST_ARTIFACTS_BUCKET': 'releng-pipeline-artifacts-dev',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GITHUB_TOKEN': from_secret('github_token'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'apt-get update',
							 
						 
					
						
							
								
									
										
										
										
											2022-01-04 22:28:06 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'apt-get install -yq zip',
							 
						 
					
						
							
								
									
										
										
										
											2021-12-24 17:43:32 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'ls -lah ./e2e',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'find ./e2e -type f -name "*.mp4"',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'printenv GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY > /tmp/gcpkey_upload_artifacts.json',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'gcloud auth activate-service-account --key-file=/tmp/gcpkey_upload_artifacts.json',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # we want to only include files in e2e folder that end with .spec.ts.mp4
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'find ./e2e -type f -name "*spec.ts.mp4" | zip e2e/videos.zip -@',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'gsutil cp e2e/videos.zip gs://$${E2E_TEST_ARTIFACTS_BUCKET}/${DRONE_BUILD_NUMBER}/artifacts/videos/videos.zip',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'export E2E_ARTIFACTS_VIDEO_ZIP=https://storage.googleapis.com/$${E2E_TEST_ARTIFACTS_BUCKET}/${DRONE_BUILD_NUMBER}/artifacts/videos/videos.zip',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'echo "E2E Test artifacts uploaded to: $${E2E_ARTIFACTS_VIDEO_ZIP}"',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'curl -X POST https://api.github.com/repos/${DRONE_REPO}/statuses/${DRONE_COMMIT_SHA} -H "Authorization: token $${GITHUB_TOKEN}" -d ' +
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            '"{\\"state\\":\\"success\\",\\"target_url\\":\\"$${E2E_ARTIFACTS_VIDEO_ZIP}\\", \\"description\\": \\"Click on the details to download e2e recording videos\\", \\"context\\": \\"e2e_artifacts\\"}"',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def upload_cdn_step(edition, ver_mode, trigger=None):
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 20:55:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    deps = []
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if edition in 'enterprise2':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        deps.extend([
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'package' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        deps.extend([
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 01:01:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'grafana-server',
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 20:55:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    step = {
							 
						 
					
						
							
								
									
										
										
										
											2021-09-07 15:21:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'upload-cdn-assets' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 21:55:11 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': publish_image,
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 20:55:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': deps,
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 21:55:11 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2022-02-07 17:11:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 18:53:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'PRERELEASE_BUCKET': from_secret(prerelease_bucket)
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 21:55:11 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 18:41:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/grabpl upload-cdn --edition {}'.format(edition),
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 21:55:11 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if trigger and ver_mode in ("release-branch", "main"):
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        step = dict(step, when=trigger)
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return step
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 21:55:11 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def build_backend_step(edition, ver_mode, variants=None):
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    variants_str = ''
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if variants:
							 
						 
					
						
							
								
									
										
										
										
											2020-08-21 01:42:39 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        variants_str = ' --variants {}'.format(','.join(variants))
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    # TODO: Convert number of jobs to percentage
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:11:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build build-backend --jobs 8 --edition {} ${{DRONE_TAG}}'.format(
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                edition,
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            ),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        build_no = '${DRONE_BUILD_NUMBER}'
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:11:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build build-backend --jobs 8 --edition {} --build-id {}{}'.format(
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                edition, build_no, variants_str,
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            ),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2021-09-07 15:21:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'build-backend' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'wire-install',
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:11:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'compile-build-cmd',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': cmds,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def build_frontend_step(edition, ver_mode):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    build_no = '${DRONE_BUILD_NUMBER}'
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    # TODO: Use percentage for num jobs
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2022-08-10 22:29:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build build-frontend --jobs 8 ' + \
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 16:06:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '--edition {} ${{DRONE_TAG}}'.format(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2022-08-10 22:29:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build build-frontend --jobs 8 --edition {} '.format(edition) + \
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 16:06:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '--build-id {}'.format(build_no),
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'build-frontend',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 17:50:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'NODE_OPTIONS': '--max_old_space_size=8192',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-08-10 22:29:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'compile-build-cmd',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'yarn-install',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': cmds,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								def build_frontend_package_step(edition, ver_mode):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    build_no = '${DRONE_BUILD_NUMBER}'
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 19:02:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    # TODO: Use percentage for num jobs
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 01:09:08 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build build-frontend-packages --jobs 8 ' + \
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 16:06:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '--edition {} ${{DRONE_TAG}}'.format(edition),
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 19:02:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 01:09:08 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build build-frontend-packages --jobs 8 --edition {} '.format(edition) + \
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 16:06:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '--build-id {}'.format(build_no),
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 19:02:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'build-frontend-packages',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'NODE_OPTIONS': '--max_old_space_size=8192',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 23:58:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'compile-build-cmd',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'yarn-install',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 19:02:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': cmds,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 18:41:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def build_plugins_step(edition, ver_mode):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode!='pr':
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        env = {
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'GRAFANA_API_KEY': from_secret('grafana_api_key'),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        env = None
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'build-plugins',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'environment': env,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 23:58:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'compile-build-cmd',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'yarn-install',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2020-07-24 20:58:50 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            # TODO: Use percentage for num jobs
							 
						 
					
						
							
								
									
										
										
										
											2022-08-05 00:39:36 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './bin/build  build-plugins --jobs 8 --edition {}'.format(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-11 17:23:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def test_backend_step(edition):
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if edition == 'enterprise2':
							 
						 
					
						
							
								
									
										
										
										
											2022-06-10 23:46:21 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'test-backend' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'wire-install',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-10-10 15:26:47 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                'go test -tags=pro -covermode=atomic -timeout=5m ./pkg/...',
							 
						 
					
						
							
								
									
										
										
										
											2022-06-10 23:46:21 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'test-backend' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'wire-install',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-10-10 15:26:47 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                'go test -short -covermode=atomic -timeout=5m ./pkg/...',
							 
						 
					
						
							
								
									
										
										
										
											2022-06-10 23:46:21 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
									
										
										
										
											2021-10-11 17:23:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-11 17:23:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def test_backend_integration_step(edition):
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'test-backend-integration',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'wire-install',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-10-10 15:26:47 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'go test -run Integration -covermode=atomic -timeout=5m ./pkg/...',
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2022-06-02 02:55:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 15:05:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def betterer_frontend_step(edition="oss"):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deps = []
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if edition == "enterprise":
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        deps.extend(['init-enterprise'])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deps.extend(['yarn-install'])
							 
						 
					
						
							
								
									
										
										
										
											2022-06-29 22:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'betterer-frontend',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 15:05:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': deps,
							 
						 
					
						
							
								
									
										
										
										
											2022-06-29 22:04:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'yarn betterer ci',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'failure': 'ignore',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 15:05:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def test_frontend_step(edition="oss"):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deps = []
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if edition == "enterprise":
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        deps.extend(['init-enterprise'])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deps.extend(['yarn-install'])
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:21:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'test-frontend',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-24 20:58:50 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'TEST_MAX_WORKERS': '50%',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 15:05:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': deps,
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:21:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'yarn run ci:test-frontend',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2021-09-30 15:56:08 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-30 15:56:08 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def lint_frontend_step():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'lint-frontend',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'TEST_MAX_WORKERS': '50%',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'yarn-install',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2021-09-30 15:56:08 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'yarn run prettier:check',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'yarn run lint',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'yarn run i18n:compile',  # TODO: right place for this?
							 
						 
					
						
							
								
									
										
										
										
											2021-09-30 15:56:08 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'yarn run typecheck',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:21:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-10 20:35:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def test_a11y_frontend_step(ver_mode, edition, port=3001):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    commands = [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'yarn wait-on http://$HOST:$PORT',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    ]
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 13:03:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    failure = 'ignore'
							 
						 
					
						
							
								
									
										
										
										
											2021-11-10 20:35:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if ver_mode == 'pr':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        commands.extend([
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 15:49:39 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'pa11y-ci --config .pa11yci-pr.conf.js',
							 
						 
					
						
							
								
									
										
										
										
											2021-11-10 20:35:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 13:03:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        failure = 'always'
							 
						 
					
						
							
								
									
										
										
										
											2021-11-10 20:35:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        commands.extend([
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 15:49:39 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'pa11y-ci --config .pa11yci.conf.js --json > pa11y-ci-results.json',
							 
						 
					
						
							
								
									
										
										
										
											2021-11-10 20:35:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
									
										
										
										
											2021-08-23 16:08:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-14 19:23:17 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2021-11-10 20:35:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'test-a11y-frontend' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2022-07-29 00:49:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'image': 'grafana/docker-puppeteer:1.1.0',
							 
						 
					
						
							
								
									
										
										
										
											2021-09-14 19:23:17 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 01:01:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'grafana-server' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2021-09-14 19:23:17 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2021-09-14 19:23:17 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'GRAFANA_MISC_STATS_API_KEY': from_secret('grafana_misc_stats_api_key'),
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 01:01:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'HOST': 'grafana-server' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2021-09-14 19:23:17 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'PORT': port,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 13:03:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'failure': failure,
							 
						 
					
						
							
								
									
										
										
										
											2021-11-10 20:35:03 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': commands,
							 
						 
					
						
							
								
									
										
										
										
											2021-09-14 19:23:17 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def frontend_metrics_step(edition, trigger=None):
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return None
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    step = {
							 
						 
					
						
							
								
									
										
										
										
											2020-10-01 16:00:11 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'publish-frontend-metrics',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:21:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2021-09-07 15:21:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'test-a11y-frontend' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:21:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'GRAFANA_MISC_STATS_API_KEY': from_secret('grafana_misc_stats_api_key'),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:21:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2020-09-30 15:23:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'failure': 'ignore',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:21:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-13 02:28:08 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './scripts/ci-frontend-metrics.sh | ./bin/build publish-metrics $${GRAFANA_MISC_STATS_API_KEY}',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 16:21:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if trigger:
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        step = dict(step, when=trigger)
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return step
							 
						 
					
						
							
								
									
										
										
										
											2020-09-07 19:17:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								def codespell_step():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'codespell',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # Important: all words have to be in lowercase, and separated by "\n".
							 
						 
					
						
							
								
									
										
										
										
											2021-04-14 23:10:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'echo -e "unknwon\nreferer\nerrorstring\neror\niam\nwan" > words_to_ignore.txt',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'codespell -I words_to_ignore.txt docs/',
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 20:47:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'rm words_to_ignore.txt',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def package_step(edition, ver_mode, include_enterprise2=False, variants=None):
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    deps = [
							 
						 
					
						
							
								
									
										
										
										
											2021-08-24 23:07:06 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'build-plugins',
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'build-backend',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'build-frontend',
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 19:02:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'build-frontend-packages',
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if include_enterprise2:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        sfx = '-enterprise2'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        deps.extend([
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'build-backend' + sfx,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    variants_str = ''
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if variants:
							 
						 
					
						
							
								
									
										
										
										
											2021-02-13 00:36:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        variants_str = ' --variants {}'.format(','.join(variants))
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 00:42:40 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if ver_mode in ('main', 'release', 'release-branch'):
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        sign_args = ' --sign'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        env = {
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'GRAFANA_API_KEY': from_secret('grafana_api_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GPG_PRIV_KEY': from_secret('gpg_priv_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GPG_PUB_KEY': from_secret('gpg_pub_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GPG_KEY_PASSWORD': from_secret('gpg_key_password'),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test_args = ''
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        sign_args = ''
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        env = None
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        test_args = '. scripts/build/gpg-test-vars.sh && '
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    # TODO: Use percentage for jobs
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-24 00:49:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '{}./bin/build package --jobs 8 --edition {} '.format(test_args, edition) + \
							 
						 
					
						
							
								
									
										
										
										
											2022-04-15 15:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '{} ${{DRONE_TAG}}'.format(
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                sign_args
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ),
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        build_no = '${DRONE_BUILD_NUMBER}'
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-24 00:49:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '{}./bin/build package --jobs 8 --edition {} '.format(test_args, edition) + \
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 16:06:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '--build-id {}{}{}'.format(build_no, variants_str, sign_args),
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2021-09-07 15:21:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'package' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2021-10-21 14:59:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': deps,
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': env,
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': cmds,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-02 18:40:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def grafana_server_step(edition, port=3001):
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    package_file_pfx = ''
							 
						 
					
						
							
								
									
										
										
										
											2021-02-13 00:36:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if edition == 'enterprise2':
							 
						 
					
						
							
								
									
										
										
										
											2021-09-07 15:21:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        package_file_pfx = 'grafana' + enterprise2_suffix(edition)
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    elif edition == 'enterprise':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        package_file_pfx = 'grafana-' + edition
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    environment = {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'PORT': port,
							 
						 
					
						
							
								
									
										
										
										
											2022-02-02 18:40:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'ARCH': 'linux-amd64'
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if package_file_pfx:
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 01:01:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        environment['RUNDIR'] = 'scripts/grafana-server/tmp-{}'.format(package_file_pfx)
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 01:01:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'grafana-server' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'detach': True,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-02-02 18:40:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'build-plugins',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'build-backend',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'build-frontend',
							 
						 
					
						
							
								
									
										
										
										
											2022-03-02 19:02:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'build-frontend-packages',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': environment,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 01:01:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            './scripts/grafana-server/start-server',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 18:20:11 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def e2e_tests_step(suite, edition, port=3001, tries=None):
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 23:02:10 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    cmd = './bin/build e2e-tests --port {} --suite {}'.format(port, suite)
							 
						 
					
						
							
								
									
										
										
										
											2021-02-18 16:16:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if tries:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        cmd += ' --tries {}'.format(tries)
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 18:20:11 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'end-to-end-tests-{}'.format(suite) + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2022-03-09 17:10:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'image': 'cypress/included:9.5.1-node16.14.0-slim-chrome99-ff97',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-02-02 18:40:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'grafana-server',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 01:01:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'HOST': 'grafana-server' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2021-12-28 20:59:20 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'apt-get install -y netcat',
							 
						 
					
						
							
								
									
										
										
										
											2021-02-18 16:16:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            cmd,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								def build_docs_website_step():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'build-docs-website',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        # Use latest revision here, since we want to catch if it breaks
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': 'grafana/docs-base:latest',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'mkdir -p /hugo/content/docs/grafana',
							 
						 
					
						
							
								
									
										
										
										
											2020-11-10 22:44:21 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'cp -r docs/sources/* /hugo/content/docs/grafana/latest/',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'cd /hugo && make prod',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								def copy_packages_for_docker_step():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'copy-packages-for-docker',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2021-10-21 14:59:12 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'package',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'ls dist/*.tar.gz*',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-30 00:15:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'cp dist/*.tar.gz* packaging/docker/',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 01:30:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publish=False):
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 14:43:28 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    cmd = './bin/build build-docker --edition {}'.format(edition)
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 01:30:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if publish:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        cmd += ' --shouldSave'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 18:53:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ubuntu_sfx = ''
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ubuntu:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ubuntu_sfx = '-ubuntu'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        cmd += ' --ubuntu'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if archs:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        cmd += ' -archs {}'.format(','.join(archs))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 01:30:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'build-docker-images' + ubuntu_sfx,
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 18:53:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'image': 'google/cloud-sdk',
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 14:43:28 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          'copy-packages-for-docker',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          'compile-build-cmd',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 18:53:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            cmd
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'volumes': [{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'docker',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'path': '/var/run/docker.sock'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-05 14:39:38 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def fetch_images_step(edition):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'fetch-images-{}'.format(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': 'google/cloud-sdk',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'DOCKER_USER': from_secret('docker_username'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'DOCKER_PASSWORD': from_secret('docker_password'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': ['./bin/build artifacts docker fetch --edition {}'.format(edition)],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': ['compile-build-cmd'],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'volumes': [{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'docker',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'path': '/var/run/docker.sock'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def publish_images_step(edition, ver_mode, mode, docker_repo, trigger=None):
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 01:30:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if mode == 'security':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        mode = '--{} '.format(mode)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        mode = ''
							 
						 
					
						
							
								
									
										
										
										
											2021-02-10 20:55:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    cmd = './bin/grabpl artifacts docker publish {}--dockerhub-repo {} --base alpine --base ubuntu --arch amd64 --arch arm64 --arch armv7'.format(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        mode, docker_repo)
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 01:30:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        deps = ['fetch-images-{}'.format(edition)]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        cmd += ' --version-tag ${TAG}'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        deps = ['build-docker-images', 'build-docker-images-ubuntu']
							 
						 
					
						
							
								
									
										
										
										
											2021-02-10 20:55:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    step = {
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 01:30:41 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'publish-images-{}'.format(docker_repo),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': 'google/cloud-sdk',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'DOCKER_USER': from_secret('docker_username'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'DOCKER_PASSWORD': from_secret('docker_password'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [cmd],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': deps,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'volumes': [{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'docker',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'path': '/var/run/docker.sock'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }],
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if trigger and ver_mode in ("release-branch", "main"):
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        step = dict(step, when=trigger)
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return step
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 04:50:34 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def postgres_integration_tests_step(edition, ver_mode):
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 22:41:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    cmds = [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'apt-get update',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'apt-get install -yq postgresql-client',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'dockerize -wait tcp://postgres:5432 -timeout 120s',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'psql -p 5432 -h postgres -U grafanatest -d grafanatest -f ' +
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'devenv/docker/blocks/postgres_tests/setup.sql',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # Make sure that we don't use cached results for another database
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'go clean -testcache',
							 
						 
					
						
							
								
									
										
										
										
											2022-10-10 15:26:47 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            "go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic -timeout=5m {}'",
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 22:41:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'postgres-integration-tests',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': ['wire-install'],
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'PGPASSWORD': 'grafanatest',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GRAFANA_TEST_DB': 'postgres',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'POSTGRES_HOST': 'postgres',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 22:41:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': cmds,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 04:50:34 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def mysql_integration_tests_step(edition, ver_mode):
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 22:41:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    cmds = [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'apt-get update',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'apt-get install -yq default-mysql-client',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'dockerize -wait tcp://mysql:3306 -timeout 120s',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root -prootpass',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # Make sure that we don't use cached results for another database
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'go clean -testcache',
							 
						 
					
						
							
								
									
										
										
										
											2022-10-10 15:26:47 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            "go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic -timeout=5m {}'",
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 22:41:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'mysql-integration-tests',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': ['wire-install'],
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GRAFANA_TEST_DB': 'mysql',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'MYSQL_HOST': 'mysql',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 22:41:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': cmds,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-15 15:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def redis_integration_tests_step():
							 
						 
					
						
							
								
									
										
										
										
											2021-04-06 21:50:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'redis-integration-tests',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': ['wire-install'],
							 
						 
					
						
							
								
									
										
										
										
											2021-04-06 21:50:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'REDIS_URL': 'redis://redis:6379/0',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2021-09-24 05:41:34 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'dockerize -wait tcp://redis:6379/0 -timeout 120s',
							 
						 
					
						
							
								
									
										
										
										
											2021-04-06 21:50:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            './bin/grabpl integration-tests',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-15 15:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def memcached_integration_tests_step():
							 
						 
					
						
							
								
									
										
										
										
											2021-04-07 21:06:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'memcached-integration-tests',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': ['wire-install'],
							 
						 
					
						
							
								
									
										
										
										
											2021-04-07 21:06:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'MEMCACHED_HOSTS': 'memcached:11211',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2021-09-24 05:41:34 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'dockerize -wait tcp://memcached:11211 -timeout 120s',
							 
						 
					
						
							
								
									
										
										
										
											2021-04-07 21:06:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            './bin/grabpl integration-tests',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def release_canary_npm_packages_step(edition, trigger=None):
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return None
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    step = {
							 
						 
					
						
							
								
									
										
										
										
											2020-12-03 18:31:14 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'release-canary-npm-packages',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 17:17:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': end_to_end_tests_deps(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2021-12-13 16:50:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'NPM_TOKEN': from_secret('npm_token'),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2020-12-03 18:31:14 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            './scripts/circle-release-canary-packages.sh',
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if trigger:
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        step = dict(step, when=trigger)
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return step
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-07 15:21:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								def enterprise2_suffix(edition):
							 
						 
					
						
							
								
									
										
										
										
											2021-02-10 20:55:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if edition == 'enterprise2':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return '-{}'.format(edition)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return ''
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def upload_packages_step(edition, ver_mode, trigger=None):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'main' and edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        return None
							 
						 
					
						
							
								
									
										
										
										
											2021-02-13 00:36:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 20:55:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    deps = []
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 17:17:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if edition in 'enterprise2' or not end_to_end_tests_deps(edition):
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 20:55:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        deps.extend([
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'package' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 20:55:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 17:17:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        deps.extend(end_to_end_tests_deps(edition))
							 
						 
					
						
							
								
									
										
										
										
											2021-04-06 21:50:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    step = {
							 
						 
					
						
							
								
									
										
										
										
											2021-09-07 15:21:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'upload-packages' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': publish_image,
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 20:55:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': deps,
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2022-02-07 17:11:27 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 18:53:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'PRERELEASE_BUCKET': from_secret('prerelease_bucket'),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2022-07-22 17:23:08 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': ['./bin/grabpl upload-packages --edition {}'.format(edition),],
							 
						 
					
						
							
								
									
										
										
										
											2020-09-25 03:31:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if trigger and ver_mode in ("release-branch", "main"):
							 
						 
					
						
							
								
									
										
										
										
											2022-09-07 20:08:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        step = dict(step, when=trigger)
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 15:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return step
							 
						 
					
						
							
								
									
										
										
										
											2020-09-25 03:31:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-11 17:31:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def publish_packages_step(edition, ver_mode):
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 00:42:40 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 15:58:36 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        cmd = './bin/build publish packages --edition {} --gcp-key /tmp/gcpkey.json ${{DRONE_TAG}}'.format(
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            edition,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        )
							 
						 
					
						
							
								
									
										
										
										
											2021-05-06 22:29:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    elif ver_mode == 'main':
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        build_no = '${DRONE_BUILD_NUMBER}'
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 15:58:36 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        cmd = './bin/build publish packages --edition {} --gcp-key /tmp/gcpkey.json --build-id {}'.format(
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            edition, build_no,
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        )
							 
						 
					
						
							
								
									
										
										
										
											2020-09-30 00:15:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        fail('Unexpected version mode {}'.format(ver_mode))
							 
						 
					
						
							
								
									
										
										
										
											2020-09-30 00:15:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-25 03:31:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2022-08-11 17:31:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'publish-packages-{}'.format(edition),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-25 03:31:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'image': publish_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 15:58:36 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'compile-build-cmd',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-25 03:31:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'GRAFANA_COM_API_KEY': from_secret('grafana_api_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GPG_PRIV_KEY': from_secret('gpg_priv_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GPG_PUB_KEY': from_secret('gpg_pub_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GPG_KEY_PASSWORD': from_secret('gpg_key_password'),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-25 03:31:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
									
										
										
										
											2020-12-23 22:42:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            cmd,
							 
						 
					
						
							
								
									
										
										
										
											2020-07-17 19:52:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-11 17:31:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def publish_grafanacom_step(edition, ver_mode):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if ver_mode == 'release':
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 15:14:38 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        cmd = './bin/build publish grafana-com --edition {} ${{DRONE_TAG}}'.format(
							 
						 
					
						
							
								
									
										
										
										
											2022-08-11 17:31:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            edition,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    elif ver_mode == 'main':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        build_no = '${DRONE_BUILD_NUMBER}'
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 15:14:38 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        cmd = './bin/build publish grafana-com --edition {} --build-id {}'.format(
							 
						 
					
						
							
								
									
										
										
										
											2022-08-11 17:31:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            edition, build_no,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        fail('Unexpected version mode {}'.format(ver_mode))
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'publish-grafanacom-{}'.format(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': publish_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'publish-packages-{}'.format(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GRAFANA_COM_API_KEY': from_secret('grafana_api_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            cmd,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 18:41:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def publish_linux_packages_step(edition, package_manager='deb'):
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 19:13:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 18:41:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'publish-linux-packages-{}'.format(package_manager),
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 19:13:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        # See https://github.com/grafana/deployment_tools/blob/master/docker/package-publish/README.md for docs on that image
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': 'us.gcr.io/kubernetes-dev/package-publish:latest',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 20:43:40 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'grabpl'
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 19:13:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-09-27 20:44:39 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'privileged': True,
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 19:13:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'failure': 'ignore', # While we're testing it
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'settings': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'access_key_id': from_secret('packages_access_key_id'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'secret_access_key': from_secret('packages_secret_access_key'),
							 
						 
					
						
							
								
									
										
										
										
											2022-10-12 19:07:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'service_account_json': from_secret('packages_service_account'),
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 19:13:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'target_bucket': 'grafana-packages',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'deb_distribution': 'stable',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'gpg_passphrase': from_secret('packages_gpg_passphrase'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'gpg_public_key': from_secret('packages_gpg_public_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'gpg_private_key': from_secret('packages_gpg_private_key'),
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 18:41:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'package_path': 'gs://grafana-prerelease/artifacts/downloads/*${{DRONE_TAG}}/{}/**.{}'.format(edition, package_manager)
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 19:13:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def get_windows_steps(edition, ver_mode):
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    init_cmds = []
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    sfx = ''
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        sfx = '-{}'.format(edition)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else:
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        init_cmds.extend([
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            '$$ProgressPreference = "SilentlyContinue"',
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 22:28:29 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/{}/windows/grabpl.exe -OutFile grabpl.exe'.format(
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                grabpl_version),
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    steps = [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        {
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'name': 'windows-init',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'image': wix_image,
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'commands': init_cmds,
							 
						 
					
						
							
								
									
										
										
										
											2020-08-19 17:46:36 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    ]
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if (ver_mode == 'main' and (edition not in ('enterprise', 'enterprise2'))) or ver_mode in (
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 00:42:40 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'release', 'release-branch',
							 
						 
					
						
							
								
									
										
										
										
											2020-10-23 16:16:17 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    ):
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 18:53:07 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        bucket = '%PRERELEASE_BUCKET%/artifacts/downloads'
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        if ver_mode == 'release':
							 
						 
					
						
							
								
									
										
										
										
											2020-10-16 18:54:41 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            ver_part = '${DRONE_TAG}'
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            dir = 'release'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else:
							 
						 
					
						
							
								
									
										
										
										
											2021-05-06 22:29:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            dir = 'main'
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 23:57:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            bucket = 'grafana-downloads'
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            build_no = 'DRONE_BUILD_NUMBER'
							 
						 
					
						
							
								
									
										
										
										
											2020-10-08 13:39:00 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            ver_part = '--build-id $$env:{}'.format(build_no)
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        installer_commands = [
							 
						 
					
						
							
								
									
										
										
										
											2020-08-19 17:46:36 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            '$$gcpKey = $$env:GCP_KEY',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            '[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($$gcpKey)) > gcpkey.json',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # gcloud fails to read the file unless converted with dos2unix
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'dos2unix gcpkey.json',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'gcloud auth activate-service-account --key-file=gcpkey.json',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'rm gcpkey.json',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'cp C:\\App\\nssm-2.24.zip .',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if (ver_mode == 'main' and (edition not in ('enterprise', 'enterprise2'))) or ver_mode in (
							 
						 
					
						
							
								
									
										
										
										
											2022-01-20 00:42:40 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'release',
							 
						 
					
						
							
								
									
										
										
										
											2020-10-23 16:16:17 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            installer_commands.extend([
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 01:05:26 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                '.\\grabpl.exe windows-installer --edition {} {}'.format(edition, ver_part),
							 
						 
					
						
							
								
									
										
										
										
											2020-10-23 16:16:17 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                '$$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0]',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ])
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 21:12:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if ver_mode == 'main':
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                installer_commands.extend([
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'gsutil cp $$fname gs://{}/{}/{}/'.format(bucket, edition, dir),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'gsutil cp "$$fname.sha256" gs://{}/{}/{}/'.format(bucket, edition, dir),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ])
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                installer_commands.extend([
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'gsutil cp $$fname gs://{}/{}/{}/{}/'.format(bucket, ver_part, edition, dir),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    'gsutil cp "$$fname.sha256" gs://{}/{}/{}/{}/'.format(bucket, ver_part, edition, dir),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ])
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        steps.append({
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'build-windows-installer',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'image': wix_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'windows-init',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ],
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 21:09:17 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                'PRERELEASE_BUCKET': from_secret(prerelease_bucket),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'GITHUB_TOKEN': from_secret('github_token')
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            },
							 
						 
					
						
							
								
									
										
										
										
											2020-11-14 02:28:46 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'commands': installer_commands,
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        })
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 20:22:20 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 22:22:41 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        if ver_mode == 'release':
							 
						 
					
						
							
								
									
										
										
										
											2020-10-16 18:54:41 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            committish = '${DRONE_TAG}'
							 
						 
					
						
							
								
									
										
										
										
											2020-11-25 16:26:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        elif ver_mode == 'release-branch':
							 
						 
					
						
							
								
									
										
										
										
											2020-10-23 16:16:17 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            committish = '$$env:DRONE_BRANCH'
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 22:22:41 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            committish = '$$env:DRONE_COMMIT'
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        # For enterprise, we have to clone both OSS and enterprise and merge the latter into the former
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 17:25:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        download_grabpl_step_cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            '$$ProgressPreference = "SilentlyContinue"',
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 22:28:29 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/{}/windows/grabpl.exe -OutFile grabpl.exe'.format(
							 
						 
					
						
							
								
									
										
										
										
											2021-11-19 18:35:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                grabpl_version),
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 18:55:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        clone_cmds = [
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'git clone "https://$$env:GITHUB_TOKEN@github.com/grafana/grafana-enterprise.git"',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        clone_cmds.extend([
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'cd grafana-enterprise',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'git checkout {}'.format(committish),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        steps.insert(0, {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'name': 'clone',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'image': wix_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2021-05-12 21:30:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								                'GITHUB_TOKEN': from_secret(github_token),
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            },
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 17:25:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'commands': download_grabpl_step_cmds + clone_cmds,
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        })
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        steps[1]['depends_on'] = [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'clone',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        steps[1]['commands'].extend([
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # Need to move grafana-enterprise out of the way, so directory is empty and can be cloned into
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'cp -r grafana-enterprise C:\\App\\grafana-enterprise',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'rm -r -force grafana-enterprise',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'cp grabpl.exe C:\\App\\grabpl.exe',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'rm -force grabpl.exe',
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'C:\\App\\grabpl.exe init-enterprise --github-token $$env:GITHUB_TOKEN C:\\App\\grafana-enterprise',
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            'cp C:\\App\\grabpl.exe grabpl.exe',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ])
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 21:09:17 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if 'environment' in steps[1]:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            steps[1]['environment'] + {'GITHUB_TOKEN': from_secret(github_token)}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            steps[1]['environment'] = {'GITHUB_TOKEN': from_secret(github_token)}
							 
						 
					
						
							
								
									
										
										
										
											2020-09-24 21:20:48 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return steps
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 20:22:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def verify_gen_cue_step(edition):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    deps = []
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 16:42:24 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        deps.extend(['init-enterprise'])
							 
						 
					
						
							
								
									
										
										
										
											2022-05-27 09:21:37 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'verify-gen-cue',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-06-22 21:22:42 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': deps,
							 
						 
					
						
							
								
									
										
										
										
											2022-05-27 09:21:37 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            '# It is required that code generated from Thema/CUE be committed and in sync with its inputs.',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            '# The following command will fail if running code generators produces any diff in output.',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'CODEGEN_VERIFY=1 make gen-cue',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 19:56:14 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 21:43:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def trigger_test_release():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'trigger-test-release',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 17:01:18 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'GITHUB_TOKEN': from_secret('github_token_pr'),
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 21:43:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'DOWNSTREAM_REPO': from_secret('downstream'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'TEST_TAG': 'v0.0.0-test',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" --depth=1',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'cd grafana-enterprise',
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 17:01:18 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'git fetch origin "refs/tags/*:refs/tags/*" --quiet',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git push --delete origin $${TEST_TAG}; fi',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'git tag $${TEST_TAG} && git push origin $${TEST_TAG}',
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 21:43:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'cd -',
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 17:01:18 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            'git fetch https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git "refs/tags/*:refs/tags/*" --quiet && git fetch --quiet',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'if git show-ref --tags $${TEST_TAG} --quiet; then git tag -d $${TEST_TAG} && git push --delete https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git $${TEST_TAG}; fi',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'git tag $${TEST_TAG} && git push https://$${GITHUB_TOKEN}@github.com/grafana/grafana.git $${TEST_TAG}',
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 21:43:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'failure': 'ignore',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'when': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'paths': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'include': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                    '.drone.yml',
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 21:21:09 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    'pkg/build/**',
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 21:43:19 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'repo': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                'grafana/grafana',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 23:00:28 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def artifacts_page_step():
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'name': 'artifacts-page',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'image': build_image,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'depends_on': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'grabpl',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 21:44:43 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'GCP_KEY': from_secret('gcp_key'),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        },
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 23:00:28 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            './bin/grabpl artifacts-page',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 17:17:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def end_to_end_tests_deps(edition):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if disable_tests:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return []
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'end-to-end-tests-dashboards-suite' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'end-to-end-tests-panels-suite' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'end-to-end-tests-smoke-tests-suite' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        'end-to-end-tests-various-suite' + enterprise2_suffix(edition),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    ]
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:11:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-01 18:56:06 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								def compile_build_cmd(edition='oss'):
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    dependencies = []
							 
						 
					
						
							
								
									
										
										
										
											2022-10-11 15:05:13 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if edition in ('enterprise', 'enterprise2'):
							 
						 
					
						
							
								
									
										
										
										
											2022-08-01 18:56:06 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          dependencies = ['init-enterprise',]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return {
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:11:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'name': 'compile-build-cmd',
							 
						 
					
						
							
								
									
										
										
										
											2022-09-12 18:03:49 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'image': go_image,
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:11:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'commands': [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            "go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ],
							 
						 
					
						
							
								
									
										
										
										
											2022-08-01 18:56:06 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'depends_on': dependencies,
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:11:22 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        'environment': {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            'CGO_ENABLED': 0,
							 
						 
					
						
							
								
									
										
										
										
											2022-08-01 18:56:06 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}