diff --git a/.drone.yml b/.drone.yml index f6ad9b3ddd9..5737de35c02 100644 --- a/.drone.yml +++ b/.drone.yml @@ -301,7 +301,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database postgres depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: postgres PGPASSWORD: grafanatest @@ -317,7 +317,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database mysql depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: mysql MYSQL_HOST: mysql @@ -450,7 +450,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database postgres depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: postgres PGPASSWORD: grafanatest @@ -466,7 +466,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database mysql depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: mysql MYSQL_HOST: mysql @@ -905,7 +905,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database postgres depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: postgres PGPASSWORD: grafanatest @@ -921,7 +921,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database mysql depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: mysql MYSQL_HOST: mysql @@ -1206,7 +1206,7 @@ steps: GITHUB_TOKEN: from_secret: github_token image: grafana/build-container:1.4.5 - name: clone + name: clone-enterprise - commands: - mv bin/grabpl /tmp/ - rmdir bin @@ -1220,7 +1220,7 @@ steps: - ./bin/grabpl gen-version ${DRONE_TAG} - yarn install --immutable depends_on: - - clone + - clone-enterprise image: grafana/build-container:1.4.5 name: initialize - commands: @@ -1850,7 +1850,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database postgres depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: postgres PGPASSWORD: grafanatest @@ -1866,7 +1866,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database mysql depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: mysql MYSQL_HOST: mysql @@ -2140,7 +2140,7 @@ steps: GITHUB_TOKEN: from_secret: github_token image: grafana/build-container:1.4.5 - name: clone + name: clone-enterprise - commands: - mv bin/grabpl /tmp/ - rmdir bin @@ -2154,7 +2154,7 @@ steps: - ./bin/grabpl gen-version v7.3.0-test - yarn install --immutable depends_on: - - clone + - clone-enterprise image: grafana/build-container:1.4.5 name: initialize - commands: @@ -2223,7 +2223,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database postgres depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: postgres PGPASSWORD: grafanatest @@ -2239,7 +2239,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database mysql depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: mysql MYSQL_HOST: mysql @@ -2398,7 +2398,7 @@ steps: - dockerize -wait tcp://redis:6379/0 -timeout 120s - ./bin/grabpl integration-tests depends_on: - - initialize + - grabpl environment: REDIS_URL: redis://redis:6379/0 image: grafana/build-container:1.4.5 @@ -2407,7 +2407,7 @@ steps: - dockerize -wait tcp://memcached:11211 -timeout 120s - ./bin/grabpl integration-tests depends_on: - - initialize + - grabpl environment: MEMCACHED_HOSTS: memcached:11211 image: grafana/build-container:1.4.5 @@ -2781,7 +2781,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database postgres depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: postgres PGPASSWORD: grafanatest @@ -2797,7 +2797,7 @@ steps: - go clean -testcache - ./bin/grabpl integration-tests --database mysql depends_on: - - initialize + - grabpl environment: GRAFANA_TEST_DB: mysql MYSQL_HOST: mysql @@ -3044,7 +3044,7 @@ steps: GITHUB_TOKEN: from_secret: github_token image: grafana/build-container:1.4.5 - name: clone + name: clone-enterprise - commands: - mv bin/grabpl /tmp/ - rmdir bin @@ -3057,7 +3057,7 @@ steps: - ./bin/grabpl gen-version --build-id ${DRONE_BUILD_NUMBER} - yarn install --immutable depends_on: - - clone + - clone-enterprise image: grafana/build-container:1.4.5 name: initialize - commands: @@ -3556,6 +3556,6 @@ kind: secret name: drone_token --- kind: signature -hmac: 12c6a397733d4624d68b34b9eeb4b3b0728eb9a1c678cf6eeb9b435f9b9a652f +hmac: 68182383c80b7e49367441fa69d6c7fb21527649213196a0ee44ddbe9a1d7e41 ... diff --git a/scripts/drone/pipelines/main.star b/scripts/drone/pipelines/main.star index 9cd262fa2ad..91c1ed9b99b 100644 --- a/scripts/drone/pipelines/main.star +++ b/scripts/drone/pipelines/main.star @@ -65,8 +65,8 @@ def get_steps(edition, is_downstream=False): test_backend_step(edition=edition), test_backend_integration_step(edition=edition), test_frontend_step(), - postgres_integration_tests_step(), - mysql_integration_tests_step(), + postgres_integration_tests_step(edition=edition, ver_mode=ver_mode), + mysql_integration_tests_step(edition=edition, ver_mode=ver_mode), build_backend_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream), build_frontend_step(edition=edition, ver_mode=ver_mode, is_downstream=is_downstream), build_plugins_step(edition=edition, sign=True), @@ -99,7 +99,7 @@ def get_steps(edition, is_downstream=False): ]) if include_enterprise2: - steps.extend([redis_integration_tests_step(), memcached_integration_tests_step()]) + steps.extend([redis_integration_tests_step(edition=edition2, ver_mode=ver_mode), memcached_integration_tests_step(edition=edition2, ver_mode=ver_mode)]) steps.extend([ release_canary_npm_packages_step(edition), diff --git a/scripts/drone/pipelines/pr.star b/scripts/drone/pipelines/pr.star index 331e020a74f..f5df7fedf17 100644 --- a/scripts/drone/pipelines/pr.star +++ b/scripts/drone/pipelines/pr.star @@ -66,8 +66,8 @@ def pr_pipelines(edition): ensure_cuetsified_step(), ] integration_test_steps = [ - postgres_integration_tests_step(), - mysql_integration_tests_step(), + postgres_integration_tests_step(edition=edition, ver_mode=ver_mode), + mysql_integration_tests_step(edition=edition, ver_mode=ver_mode), ] if include_enterprise2: @@ -98,8 +98,8 @@ def pr_pipelines(edition): if include_enterprise2: integration_test_steps.extend([ - redis_integration_tests_step(), - memcached_integration_tests_step(), + redis_integration_tests_step(edition=edition2, ver_mode=ver_mode), + memcached_integration_tests_step(edition=edition, ver_mode=ver_mode), ]) build_steps.extend([ package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']), diff --git a/scripts/drone/pipelines/release.star b/scripts/drone/pipelines/release.star index 369d85a233c..ed37a28731b 100644 --- a/scripts/drone/pipelines/release.star +++ b/scripts/drone/pipelines/release.star @@ -77,14 +77,15 @@ def release_npm_packages_step(edition, ver_mode): } def get_steps(edition, ver_mode): + build_steps = [] + package_steps = [] + windows_package_steps = [] + publish_steps = [] should_publish = ver_mode in ('release', 'test-release',) should_upload = should_publish or ver_mode in ('release-branch',) include_enterprise2 = edition == 'enterprise' - tries = None - if should_publish: - tries = 5 - steps = [ + build_steps = [ codespell_step(), shellcheck_step(), lint_backend_step(edition=edition), @@ -92,8 +93,8 @@ def get_steps(edition, ver_mode): test_backend_step(edition=edition), test_backend_integration_step(edition=edition), test_frontend_step(), - postgres_integration_tests_step(), - mysql_integration_tests_step(), + postgres_integration_tests_step(edition=edition, ver_mode=ver_mode), + mysql_integration_tests_step(edition=edition, ver_mode=ver_mode), build_backend_step(edition=edition, ver_mode=ver_mode), build_frontend_step(edition=edition, ver_mode=ver_mode), build_plugins_step(edition=edition, sign=True), @@ -101,9 +102,9 @@ def get_steps(edition, ver_mode): ensure_cuetsified_step(), ] + edition2 = 'enterprise2' if include_enterprise2: - edition2 = 'enterprise2' - steps.extend([ + build_steps.extend([ lint_backend_step(edition=edition2), test_backend_step(edition=edition2), test_backend_integration_step(edition=edition2), @@ -111,7 +112,7 @@ def get_steps(edition, ver_mode): ]) # Insert remaining steps - steps.extend([ + build_steps.extend([ package_step(edition=edition, ver_mode=ver_mode, include_enterprise2=include_enterprise2), e2e_tests_server_step(edition=edition), e2e_tests_step(edition=edition, tries=3), @@ -122,26 +123,26 @@ def get_steps(edition, ver_mode): build_storybook = build_storybook_step(edition=edition, ver_mode=ver_mode) if build_storybook: - steps.append(build_storybook) + build_steps.append(build_storybook) if include_enterprise2: - steps.extend([redis_integration_tests_step(), memcached_integration_tests_step()]) + build_steps.extend([redis_integration_tests_step(edition=edition2, ver_mode=ver_mode), memcached_integration_tests_step(edition=edition2, ver_mode=ver_mode)]) if should_upload: - steps.append(upload_cdn_step(edition=edition)) - steps.append(upload_packages_step(edition=edition, ver_mode=ver_mode)) + publish_steps.append(upload_cdn_step(edition=edition)) + publish_steps.append(upload_packages_step(edition=edition, ver_mode=ver_mode)) if should_publish: publish_step = publish_storybook_step(edition=edition, ver_mode=ver_mode) release_npm_step = release_npm_packages_step(edition=edition, ver_mode=ver_mode) if publish_step: - steps.append(publish_step) + publish_steps.append(publish_step) if release_npm_step: - steps.append(release_npm_step) - windows_steps = get_windows_steps(edition=edition, ver_mode=ver_mode) + publish_steps.append(release_npm_step) + windows_package_steps = get_windows_steps(edition=edition, ver_mode=ver_mode) if include_enterprise2: edition2 = 'enterprise2' - steps.extend([ + publish_steps.extend([ package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, variants=['linux-x64']), e2e_tests_server_step(edition=edition2, port=3002), e2e_tests_step(edition=edition2, port=3002, tries=3), @@ -150,22 +151,23 @@ def get_steps(edition, ver_mode): if should_upload: step = upload_packages_step(edition=edition2, ver_mode=ver_mode) if step: - steps.append(step) + publish_steps.append(step) - return steps, windows_steps + return build_steps, package_steps, windows_package_steps, publish_steps def get_oss_pipelines(trigger, ver_mode): edition = 'oss' services = integration_test_services(edition=edition) - steps, windows_steps = get_steps(edition=edition, ver_mode=ver_mode) + build_steps, package_steps, windows_package_steps, publish_steps = get_steps(edition=edition, ver_mode=ver_mode) return [ pipeline( name='oss-build-{}'.format(ver_mode), edition=edition, trigger=trigger, services=services, - steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + steps, + steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + + build_steps + package_steps + publish_steps, ), pipeline( name='oss-windows-{}'.format(ver_mode), edition=edition, trigger=trigger, - steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_steps, + steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_package_steps, platform='windows', depends_on=['oss-build-{}'.format(ver_mode)], ), ] @@ -173,15 +175,16 @@ def get_oss_pipelines(trigger, ver_mode): def get_enterprise_pipelines(trigger, ver_mode): edition = 'enterprise' services = integration_test_services(edition=edition) - steps, windows_steps = get_steps(edition=edition, ver_mode=ver_mode) + build_steps, package_steps, windows_package_steps, publish_steps = get_steps(edition=edition, ver_mode=ver_mode) return [ pipeline( name='enterprise-build-{}'.format(ver_mode), edition=edition, trigger=trigger, services=services, - steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + steps, + steps=[download_grabpl_step()] + initialize_step(edition, platform='linux', ver_mode=ver_mode) + + build_steps + package_steps + publish_steps, ), pipeline( name='enterprise-windows-{}'.format(ver_mode), edition=edition, trigger=trigger, - steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_steps, + steps=[download_grabpl_step()] + initialize_step(edition, platform='windows', ver_mode=ver_mode) + windows_package_steps, platform='windows', depends_on=['enterprise-build-{}'.format(ver_mode)], ), ] diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index 523c189f5f9..e7580c6cf5b 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -11,6 +11,7 @@ windows_image = 'mcr.microsoft.com/windows:1809' wix_image = 'grafana/ci-wix:0.1.1' test_release_ver = 'v7.3.0-test' + def slack_step(channel): return { 'name': 'slack', @@ -22,6 +23,7 @@ def slack_step(channel): }, } + def initialize_step(edition, platform, ver_mode, is_downstream=False, install_deps=True): if platform == 'windows': return [ @@ -53,13 +55,7 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de build_no = '$${SOURCE_BUILD_NUMBER}' args = '--build-id {}'.format(build_no) - identify_runner_step = { - 'name': 'identify-runner', - 'image': alpine_image, - 'commands': [ - 'echo $DRONE_RUNNER_NAME', - ], - } + identify_runner = identify_runner_step(platform) if install_deps: common_cmds.extend([ @@ -80,41 +76,30 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de source_commit = ' $${SOURCE_COMMIT}' committish = '${DRONE_COMMIT}' steps = [ - identify_runner_step, - { - 'name': 'clone', - '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), - ], - }, + identify_runner, + clone_enterprise(committish), { 'name': 'initialize', 'image': build_image, 'depends_on': [ - 'clone', + 'clone-enterprise', ], 'commands': [ - 'mv bin/grabpl /tmp/', - 'rmdir bin', - 'mv grafana-enterprise /tmp/', - '/tmp/grabpl init-enterprise /tmp/grafana-enterprise{}'.format(source_commit), - 'mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json', - 'mkdir bin', - 'mv /tmp/grabpl bin/' - ] + common_cmds, + 'mv bin/grabpl /tmp/', + 'rmdir bin', + 'mv grafana-enterprise /tmp/', + '/tmp/grabpl init-enterprise /tmp/grafana-enterprise{}'.format(source_commit), + 'mv /tmp/grafana-enterprise/deployment_tools_config.json deployment_tools_config.json', + 'mkdir bin', + 'mv /tmp/grabpl bin/' + ] + common_cmds, }, ] return steps steps = [ - identify_runner_step, + identify_runner, { 'name': 'initialize', 'image': build_image, @@ -124,6 +109,41 @@ def initialize_step(edition, platform, ver_mode, is_downstream=False, install_de return steps + +def identify_runner_step(platform): + if platform == 'linux': + return { + 'name': 'identify-runner', + 'image': alpine_image, + 'commands': [ + 'echo $DRONE_RUNNER_NAME', + ], + } + else: + return { + 'name': 'identify-runner', + 'image': windows_image, + 'commands': [ + 'echo $env:DRONE_RUNNER_NAME', + ], + } + + +def clone_enterprise(committish): + 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), + ], + } + + def download_grabpl_step(): return { 'name': 'grabpl', @@ -137,6 +157,7 @@ def download_grabpl_step(): ] } + def lint_drone_step(): return { 'name': 'lint-drone', @@ -149,6 +170,7 @@ def lint_drone_step(): ], } + def enterprise_downstream_step(edition): if edition in ('enterprise', 'enterprise2'): return None @@ -169,6 +191,7 @@ def enterprise_downstream_step(edition): }, } + def lint_backend_step(edition): return { 'name': 'lint-backend' + enterprise2_suffix(edition), @@ -186,6 +209,7 @@ def lint_backend_step(edition): ], } + def benchmark_ldap_step(): return { 'name': 'benchmark-ldap', @@ -194,7 +218,7 @@ def benchmark_ldap_step(): 'initialize', ], 'environment': { - 'LDAP_HOSTNAME': 'ldap', + 'LDAP_HOSTNAME': 'ldap', }, 'commands': [ 'dockerize -wait tcp://ldap:389 -timeout 120s', @@ -202,6 +226,7 @@ def benchmark_ldap_step(): ], } + def build_storybook_step(edition, ver_mode): if edition in ('enterprise', 'enterprise2') and ver_mode in ('release', 'test-release'): return None @@ -222,6 +247,7 @@ def build_storybook_step(edition, ver_mode): ], } + def publish_storybook_step(edition, ver_mode): if edition in ('enterprise', 'enterprise2'): return None @@ -233,16 +259,17 @@ def publish_storybook_step(edition, ver_mode): else: commands = [] if ver_mode == 'release': - channels = ['latest', '${DRONE_TAG}',] + channels = ['latest', '${DRONE_TAG}', ] else: - channels = ['canary',] + channels = ['canary', ] commands.extend([ - 'printenv GCP_KEY | base64 -d > /tmp/gcpkey.json', - 'gcloud auth activate-service-account --key-file=/tmp/gcpkey.json', - ] + [ - 'gsutil -m rsync -d -r ./packages/grafana-ui/dist/storybook gs://grafana-storybook/{}'.format(c) - for c in channels - ]) + 'printenv GCP_KEY | base64 -d > /tmp/gcpkey.json', + 'gcloud auth activate-service-account --key-file=/tmp/gcpkey.json', + ] + [ + 'gsutil -m rsync -d -r ./packages/grafana-ui/dist/storybook gs://grafana-storybook/{}'.format( + c) + for c in channels + ]) return { 'name': 'publish-storybook', @@ -257,6 +284,7 @@ def publish_storybook_step(edition, ver_mode): 'commands': commands, } + def upload_cdn_step(edition): return { 'name': 'upload-cdn-assets' + enterprise2_suffix(edition), @@ -268,10 +296,11 @@ def upload_cdn_step(edition): 'GCP_GRAFANA_UPLOAD_KEY': from_secret('gcp_key'), }, 'commands': [ - './bin/grabpl upload-cdn --edition {} --bucket "grafana-static-assets"'.format(edition), + './bin/grabpl upload-cdn --edition {} --bucket "grafana-static-assets"'.format(edition), ], } + def build_backend_step(edition, ver_mode, variants=None, is_downstream=False): variants_str = '' if variants: @@ -318,6 +347,7 @@ def build_backend_step(edition, ver_mode, variants=None, is_downstream=False): 'commands': cmds, } + def build_frontend_step(edition, ver_mode, is_downstream=False): if not is_downstream: build_no = '${DRONE_BUILD_NUMBER}' @@ -328,17 +358,17 @@ def build_frontend_step(edition, ver_mode, is_downstream=False): if ver_mode == 'release': cmds = [ './bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps ' + \ - '--edition {} --no-pull-enterprise ${{DRONE_TAG}}'.format(edition), + '--edition {} --no-pull-enterprise ${{DRONE_TAG}}'.format(edition), ] elif ver_mode == 'test-release': cmds = [ './bin/grabpl build-frontend --jobs 8 --github-token $${GITHUB_TOKEN} --no-install-deps ' + \ - '--edition {} --no-pull-enterprise {}'.format(edition, test_release_ver), - ] + '--edition {} --no-pull-enterprise {}'.format(edition, test_release_ver), + ] else: cmds = [ './bin/grabpl build-frontend --jobs 8 --no-install-deps --edition {} '.format(edition) + \ - '--build-id {} --no-pull-enterprise'.format(build_no), + '--build-id {} --no-pull-enterprise'.format(build_no), ] return { @@ -350,6 +380,7 @@ def build_frontend_step(edition, ver_mode, is_downstream=False): 'commands': cmds, } + def build_frontend_docs_step(edition): return { 'name': 'build-frontend-docs', @@ -362,6 +393,7 @@ def build_frontend_docs_step(edition): ] } + def build_plugins_step(edition, sign=False): if sign: env = { @@ -384,6 +416,7 @@ def build_plugins_step(edition, sign=False): ], } + def test_backend_step(edition): return { 'name': 'test-backend' + enterprise2_suffix(edition), @@ -396,6 +429,7 @@ def test_backend_step(edition): ], } + def test_backend_integration_step(edition): return { 'name': 'test-backend-integration' + enterprise2_suffix(edition), @@ -408,6 +442,7 @@ def test_backend_integration_step(edition): ], } + def test_frontend_step(): return { 'name': 'test-frontend', @@ -423,6 +458,7 @@ def test_frontend_step(): ], } + def lint_frontend_step(): return { 'name': 'lint-frontend', @@ -440,6 +476,7 @@ def lint_frontend_step(): ], } + def test_a11y_frontend_step(ver_mode, edition, port=3001): commands = [ 'yarn wait-on http://$HOST:$PORT', @@ -459,9 +496,9 @@ def test_a11y_frontend_step(ver_mode, edition, port=3001): 'name': 'test-a11y-frontend' + enterprise2_suffix(edition), 'image': 'hugohaggmark/docker-puppeteer', 'depends_on': [ - 'end-to-end-tests-server' + enterprise2_suffix(edition), + 'end-to-end-tests-server' + enterprise2_suffix(edition), ], - 'environment': { + 'environment': { 'GRAFANA_MISC_STATS_API_KEY': from_secret('grafana_misc_stats_api_key'), 'HOST': 'end-to-end-tests-server' + enterprise2_suffix(edition), 'PORT': port, @@ -470,6 +507,7 @@ def test_a11y_frontend_step(ver_mode, edition, port=3001): 'commands': commands, } + def frontend_metrics_step(edition): if edition in ('enterprise', 'enterprise2'): return None @@ -489,6 +527,7 @@ def frontend_metrics_step(edition): ], } + def codespell_step(): return { 'name': 'codespell', @@ -504,6 +543,7 @@ def codespell_step(): ], } + def shellcheck_step(): return { 'name': 'shellcheck', @@ -516,6 +556,7 @@ def shellcheck_step(): ], } + def package_step(edition, ver_mode, include_enterprise2=False, variants=None, is_downstream=False): deps = [ 'build-plugins', @@ -552,16 +593,16 @@ def package_step(edition, ver_mode, include_enterprise2=False, variants=None, is if ver_mode == 'release': cmds = [ '{}./bin/grabpl package --jobs 8 --edition {} '.format(test_args, edition) + \ - '--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} ${{DRONE_TAG}}'.format( - sign_args - ), + '--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} ${{DRONE_TAG}}'.format( + sign_args + ), ] elif ver_mode == 'test-release': cmds = [ '{}./bin/grabpl package --jobs 8 --edition {} '.format(test_args, edition) + \ - '--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} {}'.format( - sign_args, test_release_ver, - ), + '--github-token $${{GITHUB_TOKEN}} --no-pull-enterprise{} {}'.format( + sign_args, test_release_ver, + ), ] else: if not is_downstream: @@ -570,7 +611,7 @@ def package_step(edition, ver_mode, include_enterprise2=False, variants=None, is build_no = '$${SOURCE_BUILD_NUMBER}' cmds = [ '{}./bin/grabpl package --jobs 8 --edition {} '.format(test_args, edition) + \ - '--build-id {} --no-pull-enterprise{}{}'.format(build_no, variants_str, sign_args), + '--build-id {} --no-pull-enterprise{}{}'.format(build_no, variants_str, sign_args), ] return { @@ -581,6 +622,7 @@ def package_step(edition, ver_mode, include_enterprise2=False, variants=None, is 'commands': cmds, } + def e2e_tests_server_step(edition, port=3001): package_file_pfx = '' if edition == 'enterprise2': @@ -608,6 +650,7 @@ def e2e_tests_server_step(edition, port=3001): ], } + def e2e_tests_step(edition, port=3001, tries=None): cmd = './bin/grabpl e2e-tests --port {}'.format(port) if tries: @@ -629,6 +672,7 @@ def e2e_tests_step(edition, port=3001, tries=None): ], } + def build_docs_website_step(): return { 'name': 'build-docs-website', @@ -644,6 +688,7 @@ def build_docs_website_step(): ], } + def copy_packages_for_docker_step(): return { 'name': 'copy-packages-for-docker', @@ -657,6 +702,7 @@ def copy_packages_for_docker_step(): ], } + def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publish=False): if ver_mode == 'test-release': publish = False @@ -683,13 +729,17 @@ def build_docker_images_step(edition, ver_mode, archs=None, ubuntu=False, publis 'settings': settings, } -def postgres_integration_tests_step(): + +def postgres_integration_tests_step(edition, ver_mode): + deps = [] + if edition in ('enterprise', 'enterprise2') and ver_mode in ('release-branch', 'release'): + deps.extend(['initialize']) + else: + deps.extend(['grabpl']) return { 'name': 'postgres-integration-tests', 'image': build_image, - 'depends_on': [ - 'initialize', - ], + 'depends_on': deps, 'environment': { 'PGPASSWORD': 'grafanatest', 'GRAFANA_TEST_DB': 'postgres', @@ -700,20 +750,24 @@ def postgres_integration_tests_step(): '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', + 'devenv/docker/blocks/postgres_tests/setup.sql', # Make sure that we don't use cached results for another database 'go clean -testcache', './bin/grabpl integration-tests --database postgres', ], } -def mysql_integration_tests_step(): + +def mysql_integration_tests_step(edition, ver_mode): + deps = [] + if edition in ('enterprise', 'enterprise2') and ver_mode in ('release-branch', 'release'): + deps.extend(['initialize']) + else: + deps.extend(['grabpl']) return { 'name': 'mysql-integration-tests', 'image': build_image, - 'depends_on': [ - 'initialize', - ], + 'depends_on': deps, 'environment': { 'GRAFANA_TEST_DB': 'mysql', 'MYSQL_HOST': 'mysql', @@ -729,13 +783,17 @@ def mysql_integration_tests_step(): ], } -def redis_integration_tests_step(): + +def redis_integration_tests_step(edition, ver_mode): + deps = [] + if edition in ('enterprise', 'enterprise2') and ver_mode in ('release-branch', 'release'): + deps.extend(['initialize']) + else: + deps.extend(['grabpl']) return { 'name': 'redis-integration-tests', 'image': build_image, - 'depends_on': [ - 'initialize', - ], + 'depends_on': deps, 'environment': { 'REDIS_URL': 'redis://redis:6379/0', }, @@ -745,13 +803,17 @@ def redis_integration_tests_step(): ], } -def memcached_integration_tests_step(): + +def memcached_integration_tests_step(edition, ver_mode): + deps = [] + if edition in ('enterprise', 'enterprise2') and ver_mode in ('release-branch', 'release'): + deps.extend(['initialize']) + else: + deps.extend(['grabpl']) return { 'name': 'memcached-integration-tests', 'image': build_image, - 'depends_on': [ - 'initialize', - ], + 'depends_on': deps, 'environment': { 'MEMCACHED_HOSTS': 'memcached:11211', },