diff --git a/.drone.yml b/.drone.yml index 7554714ed6b..53ebaac1a2d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,7 @@ --- depends_on: [] kind: pipeline -name: pr-test +name: pr-test-frontend node: type: no-parallel platform: @@ -25,16 +25,73 @@ steps: - grabpl image: grafana/build-container:1.5.4 name: gen-version -- commands: - - make gen-go - image: grafana/build-container:1.5.4 - name: wire-install - commands: - yarn install --immutable depends_on: - grabpl image: grafana/build-container:1.5.4 name: yarn-install +- commands: + - yarn run prettier:check + - yarn run lint + - yarn run i18n:compile + - yarn run typecheck + depends_on: + - yarn-install + environment: + TEST_MAX_WORKERS: 50% + image: grafana/build-container:1.5.4 + name: lint-frontend +- commands: + - yarn run ci:test-frontend + depends_on: + - yarn-install + environment: + TEST_MAX_WORKERS: 50% + image: grafana/build-container:1.5.4 + name: test-frontend +trigger: + event: + - pull_request + paths: + exclude: + - docs/** +type: docker +volumes: +- host: + path: /var/run/docker.sock + name: docker +--- +depends_on: [] +kind: pipeline +name: pr-test-backend +node: + type: no-parallel +platform: + arch: amd64 + os: linux +services: [] +steps: +- commands: + - echo $DRONE_RUNNER_NAME + image: alpine:3.15 + name: identify-runner +- commands: + - mkdir -p bin + - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v2.9.41/grabpl + - chmod +x bin/grabpl + image: byrnedo/alpine-curl:0.1.8 + name: grabpl +- commands: + - ./bin/grabpl gen-version --build-id ${DRONE_BUILD_NUMBER} + depends_on: + - grabpl + image: grafana/build-container:1.5.4 + name: gen-version +- commands: + - make gen-go + image: grafana/build-container:1.5.4 + name: wire-install - commands: - ./bin/grabpl verify-drone depends_on: @@ -67,17 +124,6 @@ steps: CGO_ENABLED: "1" image: grafana/build-container:1.5.4 name: lint-backend -- commands: - - yarn run prettier:check - - yarn run lint - - yarn run i18n:compile - - yarn run typecheck - depends_on: - - yarn-install - environment: - TEST_MAX_WORKERS: 50% - image: grafana/build-container:1.5.4 - name: lint-frontend - commands: - ./bin/grabpl test-backend --edition oss depends_on: @@ -90,14 +136,6 @@ steps: - wire-install image: grafana/build-container:1.5.4 name: test-backend-integration -- commands: - - yarn run ci:test-frontend - depends_on: - - yarn-install - environment: - TEST_MAX_WORKERS: 50% - image: grafana/build-container:1.5.4 - name: test-frontend trigger: event: - pull_request @@ -4536,6 +4574,6 @@ kind: secret name: gcp_upload_artifacts_key --- kind: signature -hmac: 48f6a3ade75e5993b4a49d8f1a5b7d184a63767a108b16c5f71eca6c986da9c7 +hmac: 7ca5d844d600cf20dd0f568ab2753aa82a57a159a7b9dcf0435fe87003d9447e ... diff --git a/scripts/drone/pipelines/pr.star b/scripts/drone/pipelines/pr.star index d14425cc84e..c2ed7f3f500 100644 --- a/scripts/drone/pipelines/pr.star +++ b/scripts/drone/pipelines/pr.star @@ -56,28 +56,73 @@ load( ) ver_mode = 'pr' +trigger = { + 'event': [ + 'pull_request', + ], + 'paths': { + 'exclude': [ + 'docs/**', + ], + }, +} -def pr_pipelines(edition): - services = integration_test_services(edition) - volumes = integration_test_services_volumes() - variants = ['linux-amd64', 'linux-amd64-musl', 'darwin-amd64', 'windows-amd64', 'armv6',] + +def pr_test_frontend(): + init_steps = [ + identify_runner_step(), + download_grabpl_step(), + gen_version_step(ver_mode), + yarn_install_step(), + ] + test_steps = [ + lint_frontend_step(), + test_frontend_step(), + ] + return pipeline( + name='pr-test-frontend', edition="oss", trigger=trigger, services=[], steps=init_steps + test_steps, + ) + + +def pr_test_backend(edition): include_enterprise2 = edition == 'enterprise' init_steps = [ identify_runner_step(), download_grabpl_step(), gen_version_step(ver_mode), wire_install_step(), - yarn_install_step(), ] test_steps = [ lint_drone_step(), codespell_step(), shellcheck_step(), lint_backend_step(edition=edition), - lint_frontend_step(), test_backend_step(edition=edition), test_backend_integration_step(edition=edition), - test_frontend_step(), + ] + if include_enterprise2: + edition2 = 'enterprise2' + test_steps.extend([ + lint_backend_step(edition=edition2), + test_backend_step(edition=edition2), + test_backend_integration_step(edition=edition2), + ]) + return pipeline( + name='pr-test-backend', edition="oss", trigger=trigger, services=[], steps=init_steps + test_steps, + ) + + +def pr_pipelines(edition): + services = integration_test_services(edition) + volumes = integration_test_services_volumes() + variants = ['linux-amd64', 'linux-amd64-musl', 'darwin-amd64', 'windows-amd64', 'armv6', ] + include_enterprise2 = edition == 'enterprise' + init_steps = [ + identify_runner_step(), + download_grabpl_step(), + gen_version_step(ver_mode), + wire_install_step(), + yarn_install_step(), ] build_steps = [ build_backend_step(edition=edition, ver_mode=ver_mode, variants=variants), @@ -96,11 +141,6 @@ def pr_pipelines(edition): edition2 = 'enterprise2' build_steps.append(benchmark_ldap_step()) services.append(ldap_service()) - test_steps.extend([ - lint_backend_step(edition=edition2), - test_backend_step(edition=edition2), - test_backend_integration_step(edition=edition2), - ]) build_steps.extend([ build_backend_step(edition=edition2, ver_mode=ver_mode, variants=['linux-amd64']), ]) @@ -117,7 +157,7 @@ def pr_pipelines(edition): build_storybook_step(edition=edition, ver_mode=ver_mode), test_a11y_frontend_step(ver_mode=ver_mode, edition=edition), copy_packages_for_docker_step(), - build_docker_images_step(edition=edition, ver_mode=ver_mode, archs=['amd64',]), + build_docker_images_step(edition=edition, ver_mode=ver_mode, archs=['amd64', ]), ]) if include_enterprise2: @@ -126,28 +166,18 @@ def pr_pipelines(edition): 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-amd64']), + package_step(edition=edition2, ver_mode=ver_mode, include_enterprise2=include_enterprise2, + variants=['linux-amd64']), ]) - trigger = { - 'event': [ - 'pull_request', - ], - 'paths': { - 'exclude': [ - 'docs/**', - ], - }, - } - return [ + pr_test_frontend(), + pr_test_backend(edition), pipeline( - name='pr-test', edition=edition, trigger=trigger, services=[], steps=init_steps + test_steps, - ), pipeline( name='pr-build-e2e', edition=edition, trigger=trigger, services=[], steps=init_steps + build_steps, ), pipeline( name='pr-integration-tests', edition=edition, trigger=trigger, services=services, - steps=[download_grabpl_step(), identify_runner_step(),] + integration_test_steps, + steps=[download_grabpl_step(), identify_runner_step(), ] + integration_test_steps, volumes=volumes, ), docs_pipelines(edition, ver_mode, trigger_docs()) ]