diff --git a/.drone.star b/.drone.star index f633ee08e85..8cf6438940c 100644 --- a/.drone.star +++ b/.drone.star @@ -12,7 +12,6 @@ load("scripts/drone/events/main.star", "main_pipelines") load("scripts/drone/events/pr.star", "pr_pipelines") load( "scripts/drone/events/release.star", - "integration_test_pipelines", "publish_artifacts_pipelines", "publish_npm_pipelines", "publish_packages_pipeline", @@ -38,7 +37,6 @@ def main(_ctx): publish_npm_pipelines() + publish_packages_pipeline() + rgm() + - integration_test_pipelines() + cronjobs() + secrets() ) diff --git a/.drone.yml b/.drone.yml index a84202719ec..a1e47c8ce2e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -102,303 +102,6 @@ image_pull_secrets: - gcr - gar kind: pipeline -name: pr-verify-storybook -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - yarn install --immutable || yarn install --immutable - depends_on: [] - image: node:22.16.0-alpine - name: yarn-install -- commands: - - yarn storybook --quiet - depends_on: - - yarn-install - detach: true - image: node:22.16.0-alpine - name: start-storybook -- commands: - - npx wait-on@7.2.0 -t 1m http://$HOST:$PORT - - yarn e2e:storybook - depends_on: - - start-storybook - environment: - HOST: start-storybook - PORT: "9001" - image: cypress/included:14.3.2 - name: end-to-end-tests-storybook-suite -trigger: - event: - - pull_request - paths: - exclude: - - docs/** - - '*.md' - include: - - packages/grafana-ui/** -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: pr-test-backend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $(/usr/bin/github-app-external-token) > /github-app/token - environment: - GITHUB_APP_ID: - from_secret: github-app-app-id - GITHUB_APP_INSTALLATION_ID: - from_secret: github-app-installation-id - GITHUB_APP_PRIVATE_KEY: - from_secret: github-app-private-key - failure: ignore - image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 - name: github-app-generate-token - volumes: - - name: github-app - path: /github-app -- commands: - - apk add --update curl jq bash - - GITHUB_TOKEN=$(cat /github-app/token) - - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" - | jq .head.repo.fork) - - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - ../grafana-enterprise - - cd ../grafana-enterprise - - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; - elif git checkout ${DRONE_TARGET_BRANCH}; then echo "git checkout ${DRONE_TARGET_BRANCH}"; - else git checkout main; fi - - cd ../ - - ln -s src grafana - - cd ./grafana-enterprise - - ./build.sh - depends_on: - - github-app-generate-token - failure: ignore - image: alpine/git:2.40.1 - name: clone-enterprise - volumes: - - name: github-app - path: /github-app -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: test-backend -- commands: - - apk add --update build-base - - go test -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: test-backend-integration -trigger: - event: - - pull_request - paths: - exclude: - - docs/** - - '*.md' - include: - - Makefile - - pkg/** - - packaging/** - - .drone.yml - - conf/** - - go.sum - - go.mod - - public/app/plugins/**/plugin.json - - docs/sources/setup-grafana/configure-grafana/feature-toggles/** - - devenv/** - - apps/** -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: github-app - temp: {} ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: pr-lint-backend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.4-alpine - name: compile-build-cmd -- commands: - - echo $(/usr/bin/github-app-external-token) > /github-app/token - environment: - GITHUB_APP_ID: - from_secret: github-app-app-id - GITHUB_APP_INSTALLATION_ID: - from_secret: github-app-installation-id - GITHUB_APP_PRIVATE_KEY: - from_secret: github-app-private-key - failure: ignore - image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 - name: github-app-generate-token - volumes: - - name: github-app - path: /github-app -- commands: - - apk add --update curl jq bash - - GITHUB_TOKEN=$(cat /github-app/token) - - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" - | jq .head.repo.fork) - - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - ../grafana-enterprise - - cd ../grafana-enterprise - - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; - elif git checkout ${DRONE_TARGET_BRANCH}; then echo "git checkout ${DRONE_TARGET_BRANCH}"; - else git checkout main; fi - - cd ../ - - ln -s src grafana - - cd ./grafana-enterprise - - ./build.sh - depends_on: - - github-app-generate-token - failure: ignore - image: alpine/git:2.40.1 - name: clone-enterprise - volumes: - - name: github-app - path: /github-app -- commands: - - apk add --update make - - make gen-go - depends_on: [] - image: golang:1.24.4-alpine - name: wire-install -- commands: - - go run scripts/modowners/modowners.go check go.mod - image: golang:1.24.4-alpine - name: validate-modfile -- commands: - - apk add --update make - - make swagger-validate - image: golang:1.24.4-alpine - name: validate-openapi-spec -trigger: - event: - - pull_request - paths: - exclude: - - docs/** - - '*.md' - include: - - .golangci.toml - - Makefile - - pkg/** - - packaging/** - - .drone.yml - - conf/** - - go.sum - - go.mod - - public/app/plugins/**/plugin.json - - devenv/** - - .bingo/** - - apps/** -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: github-app - temp: {} ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline name: pr-build-e2e node: type: no-parallel @@ -800,258 +503,6 @@ image_pull_secrets: - gcr - gar kind: pipeline -name: pr-integration-tests -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: -- environment: - PGDATA: /var/lib/postgresql/data/pgdata - POSTGRES_DB: grafanatest - POSTGRES_PASSWORD: grafanatest - POSTGRES_USER: grafanatest - image: postgres:12.3-alpine - name: postgres - volumes: - - name: postgres - path: /var/lib/postgresql/data/pgdata -- commands: - - docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password - environment: - MYSQL_DATABASE: grafana_tests - MYSQL_PASSWORD: password - MYSQL_ROOT_PASSWORD: rootpass - MYSQL_USER: grafana - image: mysql:8.0.32 - name: mysql80 - volumes: - - name: mysql80 - path: /var/lib/mysql -- commands: - - /bin/mimir -target=backend -alertmanager.grafana-alertmanager-compatibility-enabled - -alertmanager.utf8-strict-mode-enabled - environment: {} - image: grafana/mimir-alpine:r316-55f47f8 - name: mimir_backend -- environment: {} - image: redis:6.2.11-alpine - name: redis -- environment: {} - image: memcached:1.6.9-alpine - name: memcached -steps: -- commands: - - echo $(/usr/bin/github-app-external-token) > /github-app/token - environment: - GITHUB_APP_ID: - from_secret: github-app-app-id - GITHUB_APP_INSTALLATION_ID: - from_secret: github-app-installation-id - GITHUB_APP_PRIVATE_KEY: - from_secret: github-app-private-key - failure: ignore - image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 - name: github-app-generate-token - volumes: - - name: github-app - path: /github-app -- commands: - - apk add --update curl jq bash - - GITHUB_TOKEN=$(cat /github-app/token) - - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" - | jq .head.repo.fork) - - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - ../grafana-enterprise - - cd ../grafana-enterprise - - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; - elif git checkout ${DRONE_TARGET_BRANCH}; then echo "git checkout ${DRONE_TARGET_BRANCH}"; - else git checkout main; fi - - cd ../ - - ln -s src grafana - - cd ./grafana-enterprise - - ./build.sh - depends_on: - - github-app-generate-token - failure: ignore - image: alpine/git:2.40.1 - name: clone-enterprise - volumes: - - name: github-app - path: /github-app -- commands: - - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.1.2/grabpl - - chmod +x bin/grabpl - image: byrnedo/alpine-curl:0.1.8 - name: grabpl -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.4-alpine - name: compile-build-cmd -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - dockerize -wait tcp://postgres:5432 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-postgres -- commands: - - apk add --update build-base - - apk add --update postgresql-client - - psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql - - go clean -testcache - - go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - - wait-for-postgres - environment: - GRAFANA_TEST_DB: postgres - PGPASSWORD: grafanatest - POSTGRES_HOST: postgres - image: golang:1.24.4-alpine - name: postgres-integration-tests -- commands: - - dockerize -wait tcp://mysql80:3306 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-mysql-8.0 -- commands: - - apk add --update build-base - - apk add --update mariadb-client - - cat devenv/docker/blocks/mysql_tests/setup.sql | mariadb -h mysql80 -P 3306 -u - root -prootpass --disable-ssl-verify-server-cert - - go clean -testcache - - go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - - wait-for-mysql-8.0 - environment: - GRAFANA_TEST_DB: mysql - MYSQL_HOST: mysql80 - image: golang:1.24.4-alpine - name: mysql-8.0-integration-tests -- commands: - - dockerize -wait tcp://redis:6379 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-redis -- commands: - - apk add --update build-base - - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic - -timeout=2m - depends_on: - - wire-install - - wait-for-redis - environment: - REDIS_URL: redis://redis:6379/0 - image: golang:1.24.4-alpine - name: redis-integration-tests -- commands: - - dockerize -wait tcp://memcached:11211 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-memcached -- commands: - - apk add --update build-base - - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic - -timeout=2m - depends_on: - - wire-install - - wait-for-memcached - environment: - MEMCACHED_HOSTS: memcached:11211 - image: golang:1.24.4-alpine - name: memcached-integration-tests -- commands: - - dockerize -wait tcp://mimir_backend:8080 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-remote-alertmanager -- commands: - - apk add --update build-base - - go clean -testcache - - go test -run TestIntegrationRemoteAlertmanager -covermode=atomic -timeout=2m ./pkg/services/ngalert/... - depends_on: - - wire-install - - wait-for-remote-alertmanager - environment: - AM_TENANT_ID: test - AM_URL: http://mimir_backend:8080 - image: golang:1.24.4-alpine - name: remote-alertmanager-integration-tests -trigger: - event: - - pull_request - paths: - exclude: - - docs/** - - '*.md' - include: - - pkg/** - - packaging/** - - .drone.yml - - conf/** - - go.sum - - go.mod - - public/app/plugins/**/plugin.json -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: postgres - temp: - medium: memory -- name: mysql80 - temp: - medium: memory -- name: github-app - temp: {} ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline name: pr-docs node: type: no-parallel @@ -1122,178 +573,6 @@ image_pull_secrets: - gcr - gar kind: pipeline -name: pr-integration-benchmarks -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: -- environment: - PGDATA: /var/lib/postgresql/data/pgdata - POSTGRES_DB: grafanatest - POSTGRES_PASSWORD: grafanatest - POSTGRES_USER: grafanatest - image: postgres:12.3-alpine - name: postgres - volumes: - - name: postgres - path: /var/lib/postgresql/data/pgdata -- commands: - - docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password - environment: - MYSQL_DATABASE: grafana_tests - MYSQL_PASSWORD: password - MYSQL_ROOT_PASSWORD: rootpass - MYSQL_USER: grafana - image: mysql:8.0.32 - name: mysql80 - volumes: - - name: mysql80 - path: /var/lib/mysql -- commands: - - /bin/mimir -target=backend -alertmanager.grafana-alertmanager-compatibility-enabled - -alertmanager.utf8-strict-mode-enabled - environment: {} - image: grafana/mimir-alpine:r316-55f47f8 - name: mimir_backend -- environment: {} - image: redis:6.2.11-alpine - name: redis -- environment: {} - image: memcached:1.6.9-alpine - name: memcached -steps: -- commands: - - echo $(/usr/bin/github-app-external-token) > /github-app/token - environment: - GITHUB_APP_ID: - from_secret: github-app-app-id - GITHUB_APP_INSTALLATION_ID: - from_secret: github-app-installation-id - GITHUB_APP_PRIVATE_KEY: - from_secret: github-app-private-key - failure: ignore - image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 - name: github-app-generate-token - volumes: - - name: github-app - path: /github-app -- commands: - - apk add --update curl jq bash - - GITHUB_TOKEN=$(cat /github-app/token) - - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" - ../grafana-enterprise - - cd ../grafana-enterprise - - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; - elif git checkout ${DRONE_TARGET_BRANCH}; then echo "git checkout ${DRONE_TARGET_BRANCH}"; - else git checkout main; fi - - cd ../ - - ln -s src grafana - - cd ./grafana-enterprise - - ./build.sh - depends_on: - - github-app-generate-token - failure: ignore - image: alpine/git:2.40.1 - name: clone-enterprise - volumes: - - name: github-app - path: /github-app -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.4-alpine - name: compile-build-cmd -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: - - clone-enterprise - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: - - clone-enterprise - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - apk add --update build-base - - if [ -z ${GO_PACKAGES} ]; then echo 'missing GO_PACKAGES'; false; fi - - go test -v -run=^$ -benchmem -timeout=1h -count=8 -bench=. ${GO_PACKAGES} - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: sqlite-benchmark-integration-tests -- commands: - - apk add --update build-base - - if [ -z ${GO_PACKAGES} ]; then echo 'missing GO_PACKAGES'; false; fi - - go test -v -run=^$ -benchmem -timeout=1h -count=8 -bench=. ${GO_PACKAGES} - depends_on: - - wire-install - environment: - GRAFANA_TEST_DB: postgres - PGPASSWORD: grafanatest - POSTGRES_HOST: postgres - image: golang:1.24.4-alpine - name: postgres-benchmark-integration-tests -- commands: - - apk add --update build-base - - if [ -z ${GO_PACKAGES} ]; then echo 'missing GO_PACKAGES'; false; fi - - go test -v -run=^$ -benchmem -timeout=1h -count=8 -bench=. ${GO_PACKAGES} - depends_on: - - wire-install - environment: - GRAFANA_TEST_DB: mysql - MYSQL_HOST: mysql80 - image: golang:1.24.4-alpine - name: mysql-8.0-benchmark-integration-tests -trigger: - event: - - promote - target: - - gobenchmarks -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: postgres - temp: - medium: memory -- name: mysql80 - temp: - medium: memory -- name: github-app - temp: {} ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline name: main-docs node: type: no-parallel @@ -1365,212 +644,6 @@ image_pull_secrets: - gcr - gar kind: pipeline -name: main-test-backend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: test-backend -- commands: - - apk add --update build-base - - go test -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: test-backend-integration -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json - repo: - - grafana/grafana -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: main-lint-backend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.4-alpine - name: compile-build-cmd -- commands: - - apk add --update make - - make gen-go - depends_on: [] - image: golang:1.24.4-alpine - name: wire-install -- commands: - - go run scripts/modowners/modowners.go check go.mod - image: golang:1.24.4-alpine - name: validate-modfile -- commands: - - apk add --update make - - make swagger-validate - image: golang:1.24.4-alpine - name: validate-openapi-spec -- commands: - - ./bin/build verify-drone - depends_on: - - compile-build-cmd - image: byrnedo/alpine-curl:0.1.8 - name: lint-drone -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json - repo: - - grafana/grafana -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: main-verify-storybook -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - yarn install --immutable || yarn install --immutable - depends_on: [] - image: node:22.16.0-alpine - name: yarn-install -- commands: - - yarn storybook --quiet - depends_on: - - yarn-install - detach: true - image: node:22.16.0-alpine - name: start-storybook -- commands: - - npx wait-on@7.2.0 -t 1m http://$HOST:$PORT - - yarn e2e:storybook - depends_on: - - start-storybook - environment: - HOST: start-storybook - PORT: "9001" - image: cypress/included:14.3.2 - name: end-to-end-tests-storybook-suite -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json - repo: - - grafana/grafana -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline name: main-build-e2e-publish node: type: no-parallel @@ -2076,218 +1149,10 @@ volumes: - name: github-app temp: {} --- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: main-integration-tests -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: -- environment: - PGDATA: /var/lib/postgresql/data/pgdata - POSTGRES_DB: grafanatest - POSTGRES_PASSWORD: grafanatest - POSTGRES_USER: grafanatest - image: postgres:12.3-alpine - name: postgres - volumes: - - name: postgres - path: /var/lib/postgresql/data/pgdata -- commands: - - docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password - environment: - MYSQL_DATABASE: grafana_tests - MYSQL_PASSWORD: password - MYSQL_ROOT_PASSWORD: rootpass - MYSQL_USER: grafana - image: mysql:8.0.32 - name: mysql80 - volumes: - - name: mysql80 - path: /var/lib/mysql -- commands: - - /bin/mimir -target=backend -alertmanager.grafana-alertmanager-compatibility-enabled - -alertmanager.utf8-strict-mode-enabled - environment: {} - image: grafana/mimir-alpine:r316-55f47f8 - name: mimir_backend -- environment: {} - image: redis:6.2.11-alpine - name: redis -- environment: {} - image: memcached:1.6.9-alpine - name: memcached -steps: -- commands: - - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.1.2/grabpl - - chmod +x bin/grabpl - image: byrnedo/alpine-curl:0.1.8 - name: grabpl -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.4-alpine - name: compile-build-cmd -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - dockerize -wait tcp://postgres:5432 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-postgres -- commands: - - apk add --update build-base - - apk add --update postgresql-client - - psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql - - go clean -testcache - - go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - - wait-for-postgres - environment: - GRAFANA_TEST_DB: postgres - PGPASSWORD: grafanatest - POSTGRES_HOST: postgres - image: golang:1.24.4-alpine - name: postgres-integration-tests -- commands: - - dockerize -wait tcp://mysql80:3306 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-mysql-8.0 -- commands: - - apk add --update build-base - - apk add --update mariadb-client - - cat devenv/docker/blocks/mysql_tests/setup.sql | mariadb -h mysql80 -P 3306 -u - root -prootpass --disable-ssl-verify-server-cert - - go clean -testcache - - go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - - wait-for-mysql-8.0 - environment: - GRAFANA_TEST_DB: mysql - MYSQL_HOST: mysql80 - image: golang:1.24.4-alpine - name: mysql-8.0-integration-tests -- commands: - - dockerize -wait tcp://redis:6379 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-redis -- commands: - - apk add --update build-base - - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic - -timeout=2m - depends_on: - - wire-install - - wait-for-redis - environment: - REDIS_URL: redis://redis:6379/0 - image: golang:1.24.4-alpine - name: redis-integration-tests -- commands: - - dockerize -wait tcp://memcached:11211 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-memcached -- commands: - - apk add --update build-base - - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic - -timeout=2m - depends_on: - - wire-install - - wait-for-memcached - environment: - MEMCACHED_HOSTS: memcached:11211 - image: golang:1.24.4-alpine - name: memcached-integration-tests -- commands: - - dockerize -wait tcp://mimir_backend:8080 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-remote-alertmanager -- commands: - - apk add --update build-base - - go clean -testcache - - go test -run TestIntegrationRemoteAlertmanager -covermode=atomic -timeout=2m ./pkg/services/ngalert/... - depends_on: - - wire-install - - wait-for-remote-alertmanager - environment: - AM_TENANT_ID: test - AM_URL: http://mimir_backend:8080 - image: golang:1.24.4-alpine - name: remote-alertmanager-integration-tests -trigger: - branch: main - event: - - push - paths: - exclude: - - '*.md' - - docs/** - - latest.json - repo: - - grafana/grafana -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: postgres - temp: - medium: memory -- name: mysql80 - temp: - medium: memory ---- clone: retries: 3 depends_on: - main-build-e2e-publish -- main-integration-tests environment: EDITION: oss image_pull_secrets: @@ -2333,9 +1198,7 @@ volumes: clone: retries: 3 depends_on: -- main-test-backend - main-build-e2e-publish -- main-integration-tests kind: pipeline name: main-notify platform: @@ -2376,478 +1239,6 @@ image_pull_secrets: - gcr - gar kind: pipeline -name: rrc-test-frontend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - yarn install --immutable || yarn install --immutable - depends_on: [] - image: node:22.16.0-alpine - name: yarn-install -- commands: - - apk add --update git bash - - yarn betterer:ci - depends_on: - - yarn-install - image: node:22.16.0-alpine - name: betterer-frontend -- commands: - - yarn run ci:test-frontend - depends_on: - - yarn-install - environment: - TEST_MAX_WORKERS: 50% - image: node:22.16.0-alpine - name: test-frontend -trigger: - branch: - - instant - - fast - - steady - - slow - ref: - include: - - refs/tags/rrc* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rrc-lint-frontend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - yarn install --immutable || yarn install --immutable - depends_on: [] - image: node:22.16.0-alpine - name: yarn-install -- commands: - - yarn run prettier:check - - yarn run lint - - yarn run typecheck - depends_on: - - yarn-install - environment: - TEST_MAX_WORKERS: 50% - image: node:22.16.0-alpine - name: lint-frontend -- commands: - - |- - make i18n-extract || (echo " - Extraction failed. Make sure that you have no dynamic translation phrases, such as 't(\`preferences.theme.\$${themeID}\`, themeName)' and that no translation key is used twice. Search the output for '[warning]' to find the offending file." && false) - - "\n file_diff=$(git diff --dirstat public/locales)\n if - [ -n \"$file_diff\" ]; then\n echo $file_diff\n echo - \"\nTranslation extraction has not been committed. Please run 'make i18n-extract', - commit the changes and push again.\"\n exit 1\n fi\n - \ " - depends_on: - - yarn-install - image: node:22-bookworm - name: verify-i18n -- commands: - - yarn generate-apis - - "\n file_diff=$(git diff ':!conf')\n if [ -n \"$file_diff\" - ]; then\n echo $file_diff\n echo \"\nAPI client - generation has not been committed. Please run 'yarn generate-apis', commit the - changes and push again.\"\n exit 1\n fi\n " - depends_on: - - yarn-install - image: node:22-bookworm - name: verify-api-clients -trigger: - branch: - - instant - - fast - - steady - - slow - ref: - include: - - refs/tags/rrc* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rrc-test-backend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: test-backend -- commands: - - apk add --update build-base - - go test -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: test-backend-integration -trigger: - branch: - - instant - - fast - - steady - - slow - ref: - include: - - refs/tags/rrc* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rrc-lint-backend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.4-alpine - name: compile-build-cmd -- commands: - - apk add --update make - - make gen-go - depends_on: [] - image: golang:1.24.4-alpine - name: wire-install -- commands: - - go run scripts/modowners/modowners.go check go.mod - image: golang:1.24.4-alpine - name: validate-modfile -- commands: - - apk add --update make - - make swagger-validate - image: golang:1.24.4-alpine - name: validate-openapi-spec -trigger: - branch: - - instant - - fast - - steady - - slow - ref: - include: - - refs/tags/rrc* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: rrc-integration-tests -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: -- environment: - PGDATA: /var/lib/postgresql/data/pgdata - POSTGRES_DB: grafanatest - POSTGRES_PASSWORD: grafanatest - POSTGRES_USER: grafanatest - image: postgres:12.3-alpine - name: postgres - volumes: - - name: postgres - path: /var/lib/postgresql/data/pgdata -- commands: - - docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password - environment: - MYSQL_DATABASE: grafana_tests - MYSQL_PASSWORD: password - MYSQL_ROOT_PASSWORD: rootpass - MYSQL_USER: grafana - image: mysql:8.0.32 - name: mysql80 - volumes: - - name: mysql80 - path: /var/lib/mysql -- commands: - - /bin/mimir -target=backend -alertmanager.grafana-alertmanager-compatibility-enabled - -alertmanager.utf8-strict-mode-enabled - environment: {} - image: grafana/mimir-alpine:r316-55f47f8 - name: mimir_backend -- environment: {} - image: redis:6.2.11-alpine - name: redis -- environment: {} - image: memcached:1.6.9-alpine - name: memcached -steps: -- commands: - - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.1.2/grabpl - - chmod +x bin/grabpl - image: byrnedo/alpine-curl:0.1.8 - name: grabpl -- commands: - - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd - depends_on: [] - environment: - CGO_ENABLED: 0 - image: golang:1.24.4-alpine - name: compile-build-cmd -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - dockerize -wait tcp://postgres:5432 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-postgres -- commands: - - apk add --update build-base - - apk add --update postgresql-client - - psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql - - go clean -testcache - - go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - - wait-for-postgres - environment: - GRAFANA_TEST_DB: postgres - PGPASSWORD: grafanatest - POSTGRES_HOST: postgres - image: golang:1.24.4-alpine - name: postgres-integration-tests -- commands: - - dockerize -wait tcp://mysql80:3306 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-mysql-8.0 -- commands: - - apk add --update build-base - - apk add --update mariadb-client - - cat devenv/docker/blocks/mysql_tests/setup.sql | mariadb -h mysql80 -P 3306 -u - root -prootpass --disable-ssl-verify-server-cert - - go clean -testcache - - go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - - wait-for-mysql-8.0 - environment: - GRAFANA_TEST_DB: mysql - MYSQL_HOST: mysql80 - image: golang:1.24.4-alpine - name: mysql-8.0-integration-tests -- commands: - - dockerize -wait tcp://redis:6379 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-redis -- commands: - - apk add --update build-base - - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic - -timeout=2m - depends_on: - - wire-install - - wait-for-redis - environment: - REDIS_URL: redis://redis:6379/0 - image: golang:1.24.4-alpine - name: redis-integration-tests -- commands: - - dockerize -wait tcp://memcached:11211 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-memcached -- commands: - - apk add --update build-base - - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic - -timeout=2m - depends_on: - - wire-install - - wait-for-memcached - environment: - MEMCACHED_HOSTS: memcached:11211 - image: golang:1.24.4-alpine - name: memcached-integration-tests -- commands: - - dockerize -wait tcp://mimir_backend:8080 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-remote-alertmanager -- commands: - - apk add --update build-base - - go clean -testcache - - go test -run TestIntegrationRemoteAlertmanager -covermode=atomic -timeout=2m ./pkg/services/ngalert/... - depends_on: - - wire-install - - wait-for-remote-alertmanager - environment: - AM_TENANT_ID: test - AM_URL: http://mimir_backend:8080 - image: golang:1.24.4-alpine - name: remote-alertmanager-integration-tests -trigger: - branch: - - instant - - fast - - steady - - slow - ref: - include: - - refs/tags/rrc* -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: postgres - temp: - medium: memory -- name: mysql80 - temp: - medium: memory ---- -clone: - retries: 3 -depends_on: -- rrc-integration-tests -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline name: rrc-trigger-downstream node: type: no-parallel @@ -3500,8 +1891,7 @@ volumes: --- clone: retries: 3 -depends_on: -- main-test-backend +depends_on: [] image_pull_secrets: - gcr - gar @@ -3805,138 +2195,6 @@ volumes: clone: retries: 3 depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: nightly-test-frontend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- commands: - - yarn install --immutable || yarn install --immutable - depends_on: [] - image: node:22.16.0-alpine - name: yarn-install -- commands: - - apk add --update git bash - - yarn betterer:ci - depends_on: - - yarn-install - image: node:22.16.0-alpine - name: betterer-frontend -- commands: - - yarn run ci:test-frontend - depends_on: - - yarn-install - environment: - TEST_MAX_WORKERS: 50% - image: node:22.16.0-alpine - name: test-frontend -trigger: - cron: - include: - - nightly-release - event: - include: - - cron -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: nightly-test-backend -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: [] -steps: -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: test-backend -- commands: - - apk add --update build-base - - go test -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - image: golang:1.24.4-alpine - name: test-backend-integration -trigger: - cron: - include: - - nightly-release - event: - include: - - cron -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker ---- -clone: - retries: 3 -depends_on: -- nightly-test-backend -- nightly-test-frontend image_pull_secrets: - gcr - gar @@ -4318,199 +2576,6 @@ volumes: - name: github-app temp: {} --- -clone: - retries: 3 -depends_on: [] -environment: - EDITION: oss -image_pull_secrets: -- gcr -- gar -kind: pipeline -name: integration-tests -node: - type: no-parallel -platform: - arch: amd64 - os: linux -services: -- environment: - PGDATA: /var/lib/postgresql/data/pgdata - POSTGRES_DB: grafanatest - POSTGRES_PASSWORD: grafanatest - POSTGRES_USER: grafanatest - image: postgres:12.3-alpine - name: postgres - volumes: - - name: postgres - path: /var/lib/postgresql/data/pgdata -- commands: - - docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password - environment: - MYSQL_DATABASE: grafana_tests - MYSQL_PASSWORD: password - MYSQL_ROOT_PASSWORD: rootpass - MYSQL_USER: grafana - image: mysql:8.0.32 - name: mysql80 - volumes: - - name: mysql80 - path: /var/lib/mysql -- commands: - - /bin/mimir -target=backend -alertmanager.grafana-alertmanager-compatibility-enabled - -alertmanager.utf8-strict-mode-enabled - environment: {} - image: grafana/mimir-alpine:r316-55f47f8 - name: mimir_backend -- environment: {} - image: redis:6.2.11-alpine - name: redis -- environment: {} - image: memcached:1.6.9-alpine - name: memcached -steps: -- commands: - - mkdir -p bin - - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.1.2/grabpl - - chmod +x bin/grabpl - image: byrnedo/alpine-curl:0.1.8 - name: grabpl -- commands: - - echo $DRONE_RUNNER_NAME - image: alpine:3.21.3 - name: identify-runner -- 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.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-cue - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-cue -- commands: - - '# It is required that generated jsonnet is committed and in sync with its inputs.' - - '# The following command will fail if running code generators produces any diff - in output.' - - apk add --update make - - CODEGEN_VERIFY=1 make gen-jsonnet - depends_on: [] - image: golang:1.24.4-alpine - name: verify-gen-jsonnet -- commands: - - apk add --update make - - make gen-go - depends_on: - - verify-gen-cue - image: golang:1.24.4-alpine - name: wire-install -- commands: - - dockerize -wait tcp://postgres:5432 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-postgres -- commands: - - apk add --update build-base - - apk add --update postgresql-client - - psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql - - go clean -testcache - - go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - - wait-for-postgres - environment: - GRAFANA_TEST_DB: postgres - PGPASSWORD: grafanatest - POSTGRES_HOST: postgres - image: golang:1.24.4-alpine - name: postgres-integration-tests -- commands: - - dockerize -wait tcp://mysql80:3306 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-mysql-8.0 -- commands: - - apk add --update build-base - - apk add --update mariadb-client - - cat devenv/docker/blocks/mysql_tests/setup.sql | mariadb -h mysql80 -P 3306 -u - root -prootpass --disable-ssl-verify-server-cert - - go clean -testcache - - go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find - ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' - | grep -o '\(.*\)/' | sort -u) - depends_on: - - wire-install - - wait-for-mysql-8.0 - environment: - GRAFANA_TEST_DB: mysql - MYSQL_HOST: mysql80 - image: golang:1.24.4-alpine - name: mysql-8.0-integration-tests -- commands: - - dockerize -wait tcp://redis:6379 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-redis -- commands: - - apk add --update build-base - - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic - -timeout=2m - depends_on: - - wire-install - - wait-for-redis - environment: - REDIS_URL: redis://redis:6379/0 - image: golang:1.24.4-alpine - name: redis-integration-tests -- commands: - - dockerize -wait tcp://memcached:11211 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-memcached -- commands: - - apk add --update build-base - - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic - -timeout=2m - depends_on: - - wire-install - - wait-for-memcached - environment: - MEMCACHED_HOSTS: memcached:11211 - image: golang:1.24.4-alpine - name: memcached-integration-tests -- commands: - - dockerize -wait tcp://mimir_backend:8080 -timeout 120s - image: jwilder/dockerize:0.6.1 - name: wait-for-remote-alertmanager -- commands: - - apk add --update build-base - - go clean -testcache - - go test -run TestIntegrationRemoteAlertmanager -covermode=atomic -timeout=2m ./pkg/services/ngalert/... - depends_on: - - wire-install - - wait-for-remote-alertmanager - environment: - AM_TENANT_ID: test - AM_URL: http://mimir_backend:8080 - image: golang:1.24.4-alpine - name: remote-alertmanager-integration-tests -trigger: - event: - - promote - target: integration-tests -type: docker -volumes: -- host: - path: /var/run/docker.sock - name: docker -- name: postgres - temp: - medium: memory -- name: mysql80 - temp: - medium: memory ---- clone: retries: 3 kind: pipeline @@ -4805,21 +2870,12 @@ steps: - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM ubuntu:22.04 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM byrnedo/alpine-curl:0.1.8 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM plugins/slack - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM python:3.8 - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM postgres:12.3-alpine - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM grafana/mimir-alpine:r316-55f47f8 - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM mysql:8.0.32 - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM redis:6.2.11-alpine - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM memcached:1.6.9-alpine - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM us.gcr.io/kubernetes-dev/package-publish:latest - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM osixia/openldap:1.4.0 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM grafana/drone-downstream - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM grafana/docker-puppeteer:1.1.0 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM grafana/docs-base:latest - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM cypress/included:14.3.2 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM jwilder/dockerize:0.6.1 - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM rockylinux:9 - - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM scottyhardy/docker-wine:stable-9.0 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 depends_on: - authenticate-gcr @@ -4842,21 +2898,12 @@ steps: - trivy --exit-code 1 --severity HIGH,CRITICAL ubuntu:22.04 - trivy --exit-code 1 --severity HIGH,CRITICAL byrnedo/alpine-curl:0.1.8 - trivy --exit-code 1 --severity HIGH,CRITICAL plugins/slack - - trivy --exit-code 1 --severity HIGH,CRITICAL python:3.8 - - trivy --exit-code 1 --severity HIGH,CRITICAL postgres:12.3-alpine - - trivy --exit-code 1 --severity HIGH,CRITICAL grafana/mimir-alpine:r316-55f47f8 - - trivy --exit-code 1 --severity HIGH,CRITICAL mysql:8.0.32 - - trivy --exit-code 1 --severity HIGH,CRITICAL redis:6.2.11-alpine - - trivy --exit-code 1 --severity HIGH,CRITICAL memcached:1.6.9-alpine - trivy --exit-code 1 --severity HIGH,CRITICAL us.gcr.io/kubernetes-dev/package-publish:latest - - trivy --exit-code 1 --severity HIGH,CRITICAL osixia/openldap:1.4.0 - trivy --exit-code 1 --severity HIGH,CRITICAL grafana/drone-downstream - trivy --exit-code 1 --severity HIGH,CRITICAL grafana/docker-puppeteer:1.1.0 - trivy --exit-code 1 --severity HIGH,CRITICAL grafana/docs-base:latest - trivy --exit-code 1 --severity HIGH,CRITICAL cypress/included:14.3.2 - trivy --exit-code 1 --severity HIGH,CRITICAL jwilder/dockerize:0.6.1 - - trivy --exit-code 1 --severity HIGH,CRITICAL rockylinux:9 - - trivy --exit-code 1 --severity HIGH,CRITICAL scottyhardy/docker-wine:stable-9.0 - trivy --exit-code 1 --severity HIGH,CRITICAL us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 depends_on: - authenticate-gcr @@ -5089,6 +3136,6 @@ kind: secret name: gcr_credentials --- kind: signature -hmac: 062d3adb66b70ca115b7a8178c4d1171c394ee73d11790d6a5a3e01e9ea9137c +hmac: e6c1b534a4d8744e0290343b9bbb6932b0284cd422f53146fcdbbb2919aa8a20 ... diff --git a/scripts/drone/events/main.star b/scripts/drone/events/main.star index ad1fef55462..35f60141760 100644 --- a/scripts/drone/events/main.star +++ b/scripts/drone/events/main.star @@ -11,26 +11,10 @@ load( "docs_pipelines", "trigger_docs_main", ) -load( - "scripts/drone/pipelines/integration_tests.star", - "integration_tests", -) -load( - "scripts/drone/pipelines/lint_backend.star", - "lint_backend_pipeline", -) -load( - "scripts/drone/pipelines/test_backend.star", - "test_backend", -) load( "scripts/drone/pipelines/trigger_downstream.star", "enterprise_downstream_pipeline", ) -load( - "scripts/drone/pipelines/verify_storybook.star", - "verify_storybook", -) load( "scripts/drone/utils/utils.star", "failure_template", @@ -60,20 +44,14 @@ def main_pipelines(): # Let's make an effort to reduce the amount of string constants in "depends_on" lists. pipelines = [ docs_pipelines(ver_mode, trigger_docs_main()), - test_backend(trigger, ver_mode), - lint_backend_pipeline(trigger, ver_mode), - verify_storybook(trigger, ver_mode), build_e2e(trigger, ver_mode), - integration_tests(trigger, prefix = ver_mode, ver_mode = ver_mode), enterprise_downstream_pipeline(), notify_pipeline( name = "main-notify", slack_channel = "grafana-ci-notifications", trigger = dict(trigger, status = ["failure"]), depends_on = [ - "main-test-backend", "main-build-e2e-publish", - "main-integration-tests", ], template = failure_template, secret = "slack_webhook", diff --git a/scripts/drone/events/pr.star b/scripts/drone/events/pr.star index 876e1fb8f60..29a456329cb 100644 --- a/scripts/drone/events/pr.star +++ b/scripts/drone/events/pr.star @@ -3,10 +3,6 @@ This module returns all pipelines used in the event of a pull request. It also includes a function generating a PR trigger from a list of included and excluded paths. """ -load( - "scripts/drone/pipelines/benchmarks.star", - "integration_benchmarks", -) load( "scripts/drone/pipelines/build.star", "build_e2e", @@ -16,18 +12,6 @@ load( "docs_pipelines", "trigger_docs_pr", ) -load( - "scripts/drone/pipelines/integration_tests.star", - "integration_tests", -) -load( - "scripts/drone/pipelines/lint_backend.star", - "lint_backend_pipeline", -) -load( - "scripts/drone/pipelines/test_backend.star", - "test_backend", -) load( "scripts/drone/pipelines/verify_drone.star", "verify_drone", @@ -36,10 +20,6 @@ load( "scripts/drone/pipelines/verify_starlark.star", "verify_starlark", ) -load( - "scripts/drone/pipelines/verify_storybook.star", - "verify_storybook", -) ver_mode = "pr" trigger = { @@ -69,68 +49,8 @@ def pr_pipelines(): ), ver_mode, ), - verify_storybook( - get_pr_trigger( - include_paths = ["packages/grafana-ui/**"], - ), - ver_mode, - ), - test_backend( - get_pr_trigger( - include_paths = [ - "Makefile", - "pkg/**", - "packaging/**", - ".drone.yml", - "conf/**", - "go.sum", - "go.mod", - "public/app/plugins/**/plugin.json", - "docs/sources/setup-grafana/configure-grafana/feature-toggles/**", - "devenv/**", - "apps/**", - ], - ), - ver_mode, - ), - lint_backend_pipeline( - get_pr_trigger( - include_paths = [ - ".golangci.toml", - "Makefile", - "pkg/**", - "packaging/**", - ".drone.yml", - "conf/**", - "go.sum", - "go.mod", - "public/app/plugins/**/plugin.json", - "devenv/**", - ".bingo/**", - "apps/**", - ], - ), - ver_mode, - ), build_e2e(trigger, ver_mode), - integration_tests( - get_pr_trigger( - include_paths = [ - "pkg/**", - "packaging/**", - ".drone.yml", - "conf/**", - "go.sum", - "go.mod", - "public/app/plugins/**/plugin.json", - ], - ), - prefix = ver_mode, - ), docs_pipelines(ver_mode, trigger_docs_pr()), - integration_benchmarks( - prefix = ver_mode, - ), ] def get_pr_trigger(include_paths = None, exclude_paths = None): diff --git a/scripts/drone/events/release.star b/scripts/drone/events/release.star index 8241657bc36..d71f01f3581 100644 --- a/scripts/drone/events/release.star +++ b/scripts/drone/events/release.star @@ -2,11 +2,6 @@ This module returns all the pipelines used in the event of a release along with supporting functions. """ -load( - "scripts/drone/services/services.star", - "integration_test_services", - "integration_test_services_volumes", -) load( "scripts/drone/steps/github.star", "github_app_generate_token_step", @@ -16,19 +11,9 @@ load( load( "scripts/drone/steps/lib.star", "compile_build_cmd", - "download_grabpl_step", - "identify_runner_step", - "memcached_integration_tests_steps", - "mysql_integration_tests_steps", - "postgres_integration_tests_steps", "publish_grafanacom_step", "publish_linux_packages_step", - "redis_integration_tests_steps", - "remote_alertmanager_integration_tests_steps", - "verify_gen_cue_step", - "verify_gen_jsonnet_step", "verify_grafanacom_step", - "wire_install_step", "yarn_install_step", ) load( @@ -255,47 +240,6 @@ def publish_npm_pipelines(): ), ] -def integration_test_pipelines(): - """ - Trigger integration tests on release builds - - These pipelines should be triggered when we have a release that does a lot of - cherry-picking and we still want to have all the integration tests run on that - particular build. - - Returns: - List of Drone pipelines - """ - trigger = { - "event": ["promote"], - "target": "integration-tests", - } - pipelines = [] - volumes = integration_test_services_volumes() - integration_test_steps = postgres_integration_tests_steps() + \ - mysql_integration_tests_steps("mysql80", "8.0") + \ - redis_integration_tests_steps() + \ - memcached_integration_tests_steps() + \ - remote_alertmanager_integration_tests_steps() - - pipelines.append(pipeline( - name = "integration-tests", - trigger = trigger, - services = integration_test_services(), - steps = [ - download_grabpl_step(), - identify_runner_step(), - verify_gen_cue_step(), - verify_gen_jsonnet_step(), - wire_install_step(), - ] + - integration_test_steps, - environment = {"EDITION": "oss"}, - volumes = volumes, - )) - - return pipelines - def verify_release_pipeline( name = "verify-prerelease-assets", bucket = from_secret(prerelease_bucket), diff --git a/scripts/drone/events/rrc-patch.star b/scripts/drone/events/rrc-patch.star index 3a119c5de82..5b888e5b21c 100644 --- a/scripts/drone/events/rrc-patch.star +++ b/scripts/drone/events/rrc-patch.star @@ -2,26 +2,6 @@ This module returns all the pipelines used in the event of pushes to an RRC branch. """ -load( - "scripts/drone/pipelines/integration_tests.star", - "integration_tests", -) -load( - "scripts/drone/pipelines/lint_backend.star", - "lint_backend_pipeline", -) -load( - "scripts/drone/pipelines/lint_frontend.star", - "lint_frontend_pipeline", -) -load( - "scripts/drone/pipelines/test_backend.star", - "test_backend", -) -load( - "scripts/drone/pipelines/test_frontend.star", - "test_frontend", -) load( "scripts/drone/steps/lib.star", "enterprise_downstream_step", @@ -48,11 +28,6 @@ trigger = { def rrc_patch_pipelines(): pipelines = [ - test_frontend(trigger, ver_mode), - lint_frontend_pipeline(trigger, ver_mode), - test_backend(trigger, ver_mode), - lint_backend_pipeline(trigger, ver_mode), - integration_tests(trigger, prefix = ver_mode, ver_mode = ver_mode), rrc_enterprise_downstream_pipeline(trigger = trigger), ] @@ -68,6 +43,5 @@ def rrc_enterprise_downstream_pipeline(trigger): name = "rrc-trigger-downstream", trigger = trigger, steps = steps, - depends_on = ["rrc-integration-tests"], environment = environment, ) diff --git a/scripts/drone/pipelines/benchmarks.star b/scripts/drone/pipelines/benchmarks.star deleted file mode 100644 index 40bd49eea9e..00000000000 --- a/scripts/drone/pipelines/benchmarks.star +++ /dev/null @@ -1,84 +0,0 @@ -""" -This module returns the pipeline used for integration benchmarks. -""" - -load( - "scripts/drone/services/services.star", - "integration_test_services", - "integration_test_services_volumes", -) -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", -) -load( - "scripts/drone/steps/lib.star", - "compile_build_cmd", - "enterprise_setup_step", - "integration_benchmarks_step", - "verify_gen_cue_step", - "verify_gen_jsonnet_step", - "wire_install_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def integration_benchmarks(prefix): - """Generate a pipeline for integration tests. - - Args: - prefix: used in the naming of the pipeline. - Returns: - Drone pipeline. - """ - environment = {"EDITION": "oss"} - - services = integration_test_services() - volumes = integration_test_services_volumes() + github_app_pipeline_volumes() - - # In pull requests, attempt to clone grafana enterprise. - init_steps = [ - github_app_generate_token_step(), - enterprise_setup_step(isPromote = True), - ] - - verify_step = verify_gen_cue_step() - verify_jsonnet_step = verify_gen_jsonnet_step() - - # Ensure that verif_gen_cue happens after we clone enterprise - # At the time of writing this, very_gen_cue is depended on by the wire step which is what everything else depends on. - verify_step["depends_on"].append("clone-enterprise") - verify_jsonnet_step["depends_on"].append("clone-enterprise") - - init_steps += [ - compile_build_cmd(), - verify_step, - verify_jsonnet_step, - wire_install_step(), - ] - - benchmark_steps = integration_benchmarks_step("sqlite") + \ - integration_benchmarks_step("postgres", { - "PGPASSWORD": "grafanatest", - "GRAFANA_TEST_DB": "postgres", - "POSTGRES_HOST": "postgres", - }) + \ - integration_benchmarks_step("mysql-8.0", { - "GRAFANA_TEST_DB": "mysql", - "MYSQL_HOST": "mysql80", - }) - - return pipeline( - name = "{}-integration-benchmarks".format(prefix), - trigger = { - "event": ["promote"], - "target": ["gobenchmarks"], - }, - environment = environment, - services = services, - volumes = volumes, - steps = init_steps + benchmark_steps, - ) diff --git a/scripts/drone/pipelines/integration_tests.star b/scripts/drone/pipelines/integration_tests.star deleted file mode 100644 index 0fd23d427d4..00000000000 --- a/scripts/drone/pipelines/integration_tests.star +++ /dev/null @@ -1,86 +0,0 @@ -""" -This module returns the pipeline used for integration tests. -""" - -load( - "scripts/drone/services/services.star", - "integration_test_services", - "integration_test_services_volumes", -) -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", -) -load( - "scripts/drone/steps/lib.star", - "compile_build_cmd", - "download_grabpl_step", - "enterprise_setup_step", - "identify_runner_step", - "memcached_integration_tests_steps", - "mysql_integration_tests_steps", - "postgres_integration_tests_steps", - "redis_integration_tests_steps", - "remote_alertmanager_integration_tests_steps", - "verify_gen_cue_step", - "verify_gen_jsonnet_step", - "wire_install_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def integration_tests(trigger, prefix, ver_mode = "pr"): - """Generate a pipeline for integration tests. - - Args: - trigger: controls which events can trigger the pipeline execution. - prefix: used in the naming of the pipeline. - ver_mode: defines the event / origin of this build. In this function, if it is set to pr, then it will attempt to clone grafana-enterprise. Otherwise it has no effect. - - Returns: - Drone pipeline. - """ - environment = {"EDITION": "oss"} - - services = integration_test_services() - volumes = integration_test_services_volumes() - - init_steps = [] - - verify_step = verify_gen_cue_step() - verify_jsonnet_step = verify_gen_jsonnet_step() - - if ver_mode == "pr": - # In pull requests, attempt to clone grafana enterprise. - init_steps.append(github_app_generate_token_step()) - init_steps.append(enterprise_setup_step()) - - volumes += github_app_pipeline_volumes() - - init_steps += [ - download_grabpl_step(), - compile_build_cmd(), - identify_runner_step(), - verify_step, - verify_jsonnet_step, - wire_install_step(), - ] - - # test_steps = [a, b] + [c, d] + [e, f]... - test_steps = postgres_integration_tests_steps() + \ - mysql_integration_tests_steps("mysql80", "8.0") + \ - redis_integration_tests_steps() + \ - memcached_integration_tests_steps() + \ - remote_alertmanager_integration_tests_steps() - - return pipeline( - name = "{}-integration-tests".format(prefix), - trigger = trigger, - environment = environment, - services = services, - volumes = volumes, - steps = init_steps + test_steps, - ) diff --git a/scripts/drone/pipelines/lint_backend.star b/scripts/drone/pipelines/lint_backend.star deleted file mode 100644 index 558cc0e036e..00000000000 --- a/scripts/drone/pipelines/lint_backend.star +++ /dev/null @@ -1,71 +0,0 @@ -""" -This module returns the pipeline used for linting backend code. -""" - -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", -) -load( - "scripts/drone/steps/lib.star", - "compile_build_cmd", - "enterprise_setup_step", - "identify_runner_step", - "lint_drone_step", - "validate_modfile_step", - "validate_openapi_spec_step", - "wire_install_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def lint_backend_pipeline(trigger, ver_mode): - """Generates the pipelines used linting backend code. - - Args: - trigger: controls which events can trigger the pipeline execution. - ver_mode: used in the naming of the pipeline. - - Returns: - Drone pipeline. - """ - environment = {"EDITION": "oss"} - - wire_step = wire_install_step() - wire_step.update({"depends_on": []}) - - init_steps = [ - identify_runner_step(), - compile_build_cmd(), - ] - - volumes = [] - - if ver_mode == "pr": - # In pull requests, attempt to clone grafana enterprise. - init_steps.append(github_app_generate_token_step()) - init_steps.append(enterprise_setup_step()) - - volumes += github_app_pipeline_volumes() - - init_steps.append(wire_step) - - test_steps = [ - validate_modfile_step(), - validate_openapi_spec_step(), - ] - - if ver_mode == "main": - test_steps.append(lint_drone_step()) - - return pipeline( - name = "{}-lint-backend".format(ver_mode), - trigger = trigger, - services = [], - steps = init_steps + test_steps, - environment = environment, - volumes = volumes, - ) diff --git a/scripts/drone/pipelines/lint_frontend.star b/scripts/drone/pipelines/lint_frontend.star deleted file mode 100644 index 381f79373db..00000000000 --- a/scripts/drone/pipelines/lint_frontend.star +++ /dev/null @@ -1,69 +0,0 @@ -""" -This module returns the pipeline used for linting frontend code. -""" - -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", -) -load( - "scripts/drone/steps/lib.star", - "enterprise_setup_step", - "identify_runner_step", - "lint_frontend_step", - "verify_api_clients_step", - "verify_i18n_step", - "yarn_install_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def lint_frontend_pipeline(trigger, ver_mode): - """Generates the pipelines used linting frontend code. - - Args: - trigger: controls which events can trigger the pipeline execution. - ver_mode: used in the naming of the pipeline. - - Returns: - Drone pipeline. - """ - environment = {"EDITION": "oss"} - - init_steps = [] - lint_step = lint_frontend_step() - i18n_step = verify_i18n_step() - api_clients_step = verify_api_clients_step() - - volumes = [] - - if ver_mode == "pr": - # In pull requests, attempt to clone grafana enterprise. - init_steps = [ - github_app_generate_token_step(), - enterprise_setup_step(), - ] - - volumes += github_app_pipeline_volumes() - - init_steps += [ - identify_runner_step(), - yarn_install_step(), - ] - test_steps = [ - lint_step, - i18n_step, - api_clients_step, - ] - - return pipeline( - name = "{}-lint-frontend".format(ver_mode), - trigger = trigger, - services = [], - steps = init_steps + test_steps, - environment = environment, - volumes = volumes, - ) diff --git a/scripts/drone/pipelines/test_backend.star b/scripts/drone/pipelines/test_backend.star deleted file mode 100644 index e49c9f952b9..00000000000 --- a/scripts/drone/pipelines/test_backend.star +++ /dev/null @@ -1,66 +0,0 @@ -""" -This module returns the pipeline used for testing backend code. -""" - -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", -) -load( - "scripts/drone/steps/lib.star", - "enterprise_setup_step", - "identify_runner_step", - "test_backend_integration_step", - "test_backend_step", - "verify_gen_cue_step", - "verify_gen_jsonnet_step", - "wire_install_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def test_backend(trigger, ver_mode): - """Generates the pipeline used for testing OSS backend code. - - Args: - trigger: a Drone trigger for the pipeline. - ver_mode: affects the pipeline name. - - Returns: - Drone pipeline. - """ - environment = {"EDITION": "oss"} - - steps = [] - - verify_step = verify_gen_cue_step() - verify_jsonnet_step = verify_gen_jsonnet_step() - - volumes = [] - - if ver_mode == "pr": - # In pull requests, attempt to clone grafana enterprise. - steps.append(github_app_generate_token_step()) - steps.append(enterprise_setup_step()) - - volumes += github_app_pipeline_volumes() - - steps += [ - identify_runner_step(), - verify_step, - verify_jsonnet_step, - wire_install_step(), - test_backend_step(), - test_backend_integration_step(), - ] - - return pipeline( - name = "{}-test-backend".format(ver_mode), - trigger = trigger, - steps = steps, - environment = environment, - volumes = volumes, - ) diff --git a/scripts/drone/pipelines/test_frontend.star b/scripts/drone/pipelines/test_frontend.star deleted file mode 100644 index e30a5105d28..00000000000 --- a/scripts/drone/pipelines/test_frontend.star +++ /dev/null @@ -1,60 +0,0 @@ -""" -This module returns the pipeline used for testing backend code. -""" - -load( - "scripts/drone/steps/github.star", - "github_app_generate_token_step", - "github_app_pipeline_volumes", -) -load( - "scripts/drone/steps/lib.star", - "betterer_frontend_step", - "enterprise_setup_step", - "identify_runner_step", - "test_frontend_step", - "yarn_install_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def test_frontend(trigger, ver_mode): - """Generates the pipeline used for testing frontend code. - - Args: - trigger: a Drone trigger for the pipeline - ver_mode: indirectly controls which revision of enterprise code to use. - - Returns: - Drone pipeline. - """ - environment = {"EDITION": "oss"} - - steps = [ - identify_runner_step(), - yarn_install_step(), - betterer_frontend_step(), - ] - - test_step = test_frontend_step() - - volumes = [] - - if ver_mode == "pr": - # In pull requests, attempt to clone grafana enterprise. - steps.append(github_app_generate_token_step()) - steps.append(enterprise_setup_step()) - - volumes += github_app_pipeline_volumes() - - steps.append(test_step) - - return pipeline( - name = "{}-test-frontend".format(ver_mode), - trigger = trigger, - steps = steps, - environment = environment, - volumes = volumes, - ) diff --git a/scripts/drone/pipelines/trigger_downstream.star b/scripts/drone/pipelines/trigger_downstream.star index 9004bf6e712..698e3af027d 100644 --- a/scripts/drone/pipelines/trigger_downstream.star +++ b/scripts/drone/pipelines/trigger_downstream.star @@ -35,7 +35,6 @@ def enterprise_downstream_pipeline(): ] deps = [ "main-build-e2e-publish", - "main-integration-tests", ] return pipeline( name = "main-trigger-downstream", diff --git a/scripts/drone/pipelines/verify_storybook.star b/scripts/drone/pipelines/verify_storybook.star deleted file mode 100644 index e95ca2ba4b6..00000000000 --- a/scripts/drone/pipelines/verify_storybook.star +++ /dev/null @@ -1,41 +0,0 @@ -""" -This module returns the pipeline used for verifying the storybook build. -""" - -load( - "scripts/drone/steps/lib.star", - "e2e_storybook_step", - "identify_runner_step", - "start_storybook_step", - "yarn_install_step", -) -load( - "scripts/drone/utils/utils.star", - "pipeline", -) - -def verify_storybook(trigger, ver_mode): - """Generates the pipeline used for verifying the storybook build. - - Args: - trigger: a Drone trigger for the pipeline - ver_mode: indirectly controls which revision of enterprise code to use. - - Returns: - Drone pipeline. - """ - environment = {"EDITION": "oss"} - - steps = [ - identify_runner_step(), - yarn_install_step(), - start_storybook_step(), - e2e_storybook_step(), - ] - - return pipeline( - name = "{}-verify-storybook".format(ver_mode), - trigger = trigger, - steps = steps, - environment = environment, - ) diff --git a/scripts/drone/rgm.star b/scripts/drone/rgm.star index 32d3cfc9d05..abaf82b9127 100644 --- a/scripts/drone/rgm.star +++ b/scripts/drone/rgm.star @@ -10,14 +10,6 @@ load( "scripts/drone/events/release.star", "verify_release_pipeline", ) -load( - "scripts/drone/pipelines/test_backend.star", - "test_backend", -) -load( - "scripts/drone/pipelines/test_frontend.star", - "test_frontend", -) load( "scripts/drone/steps/github.star", "github_app_generate_token_step", @@ -215,7 +207,6 @@ def rgm_main(): name = "rgm-main-prerelease", trigger = main_trigger, steps = rgm_run("rgm-build", "drone_build_main.sh"), - depends_on = ["main-test-backend"], ) def rgm_tag(): @@ -252,7 +243,6 @@ def rgm_nightly_build(): name = "rgm-nightly-build", trigger = nightly_trigger, steps = rgm_run("rgm-build", "drone_build_nightly_grafana.sh") + copy_steps, - depends_on = ["nightly-test-backend", "nightly-test-frontend"], ) def rgm_nightly_publish(): @@ -278,8 +268,6 @@ def rgm_nightly_publish(): def rgm_nightly_pipeline(): return [ - test_frontend(nightly_trigger, "nightly"), - test_backend(nightly_trigger, "nightly"), rgm_nightly_build(), rgm_nightly_publish(), ] diff --git a/scripts/drone/services/services.star b/scripts/drone/services/services.star deleted file mode 100644 index 3796214a517..00000000000 --- a/scripts/drone/services/services.star +++ /dev/null @@ -1,72 +0,0 @@ -""" -This module has functions for Drone services to be used in pipelines. -""" - -load( - "scripts/drone/utils/images.star", - "images", -) - -def integration_test_services_volumes(): - return [ - {"name": "postgres", "temp": {"medium": "memory"}}, - {"name": "mysql80", "temp": {"medium": "memory"}}, - ] - -def integration_test_services(): - services = [ - { - "name": "postgres", - "image": images["postgres_alpine"], - "environment": { - "POSTGRES_USER": "grafanatest", - "POSTGRES_PASSWORD": "grafanatest", - "POSTGRES_DB": "grafanatest", - "PGDATA": "/var/lib/postgresql/data/pgdata", - }, - "volumes": [ - {"name": "postgres", "path": "/var/lib/postgresql/data/pgdata"}, - ], - }, - { - "name": "mysql80", - "image": images["mysql8"], - "environment": { - "MYSQL_ROOT_PASSWORD": "rootpass", - "MYSQL_DATABASE": "grafana_tests", - "MYSQL_USER": "grafana", - "MYSQL_PASSWORD": "password", - }, - "volumes": [{"name": "mysql80", "path": "/var/lib/mysql"}], - "commands": ["docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"], - }, - { - "name": "mimir_backend", - "image": images["mimir"], - "environment": {}, - "commands": ["/bin/mimir -target=backend -alertmanager.grafana-alertmanager-compatibility-enabled -alertmanager.utf8-strict-mode-enabled"], - }, - { - "name": "redis", - "image": images["redis_alpine"], - "environment": {}, - }, - { - "name": "memcached", - "image": images["memcached_alpine"], - "environment": {}, - }, - ] - - return services - -def ldap_service(): - return { - "name": "ldap", - "image": images["openldap"], - "environment": { - "LDAP_ADMIN_PASSWORD": "grafana", - "LDAP_DOMAIN": "grafana.org", - "SLAPD_ADDITIONAL_MODULES": "memberof", - }, - } diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index 411596c85a3..c944e7d5e31 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -568,34 +568,6 @@ def build_plugins_step(ver_mode): ], } -def test_backend_step(): - return { - "name": "test-backend", - "image": images["go"], - "depends_on": [ - "wire-install", - ], - "commands": [ - # shared-mime-info and shared-mime-info-lang is used for exactly 1 test for the - # mime.TypeByExtension function. - "apk add --update build-base shared-mime-info shared-mime-info-lang", - "go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m", - ], - } - -def test_backend_integration_step(): - return { - "name": "test-backend-integration", - "image": images["go"], - "depends_on": [ - "wire-install", - ], - "commands": [ - "apk add --update build-base", - "go test -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\\(.*\\)/' | sort -u)", - ], - } - def betterer_frontend_step(): """Run betterer on frontend code. @@ -615,44 +587,6 @@ def betterer_frontend_step(): ], } -def test_frontend_step(): - """Runs tests on frontend code. - - Returns: - Drone step. - """ - - return { - "name": "test-frontend", - "image": images["node"], - "environment": { - "TEST_MAX_WORKERS": "50%", - }, - "depends_on": [ - "yarn-install", - ], - "commands": [ - "yarn run ci:test-frontend", - ], - } - -def lint_frontend_step(): - return { - "name": "lint-frontend", - "image": images["node"], - "environment": { - "TEST_MAX_WORKERS": "50%", - }, - "depends_on": [ - "yarn-install", - ], - "commands": [ - "yarn run prettier:check", - "yarn run lint", - "yarn run typecheck", - ], - } - def verify_i18n_step(): extract_error_message = "\nExtraction failed. Make sure that you have no dynamic translation phrases, such as 't(\\`preferences.theme.\\$${themeID}\\`, themeName)' and that no translation key is used twice. Search the output for '[warning]' to find the offending file." uncommited_error_message = "\nTranslation extraction has not been committed. Please run 'make i18n-extract', commit the changes and push again." @@ -835,23 +769,6 @@ def start_storybook_step(): "detach": True, } -def e2e_storybook_step(): - return { - "name": "end-to-end-tests-storybook-suite", - "image": images["cypress"], - "depends_on": [ - "start-storybook", - ], - "environment": { - "HOST": "start-storybook", - "PORT": "9001", - }, - "commands": [ - "npx wait-on@7.2.0 -t 1m http://$HOST:$PORT", - "yarn e2e:storybook", - ], - } - def cloud_plugins_e2e_tests_step(suite, cloud, trigger = None): """Run cloud plugins end-to-end tests. @@ -1014,129 +931,6 @@ def publish_images_step(ver_mode, docker_repo, trigger = None, depends_on = ["rg return step -def integration_tests_steps(name, cmds, hostname = None, port = None, environment = None, canFail = False): - """Integration test steps - - Args: - name: the name of the step. - cmds: the commands to run to perform the integration tests. - hostname: the hostname where the remote server is available. - port: the port where the remote server is available. - environment: Any extra environment variables needed to run the integration tests. - canFail: controls whether the step can fail. - - Returns: - A list of drone steps. If a hostname / port were provided, then a step to wait for the remove server to be - available is also returned. - """ - dockerize_name = "wait-for-{}".format(name) - - depends = [ - "wire-install", - ] - - step = { - "name": "{}-integration-tests".format(name), - "image": images["go"], - "depends_on": depends, - "commands": [ - "apk add --update build-base", - ] + cmds, - } - - if canFail: - step["failure"] = "ignore" - - if environment: - step["environment"] = environment - - if hostname == None: - return [step] - - depends = depends.append(dockerize_name) - - return [ - dockerize_step(dockerize_name, hostname, port), - step, - ] - -def integration_benchmarks_step(name, environment = None): - cmds = [ - "if [ -z ${GO_PACKAGES} ]; then echo 'missing GO_PACKAGES'; false; fi", - "go test -v -run=^$ -benchmem -timeout=1h -count=8 -bench=. ${GO_PACKAGES}", - ] - - return integration_tests_steps("{}-benchmark".format(name), cmds, environment = environment) - -def postgres_integration_tests_steps(): - cmds = [ - "apk add --update postgresql-client", - "psql -p 5432 -h postgres -U grafanatest -d grafanatest -f " + - "devenv/docker/blocks/postgres_tests/setup.sql", - "go clean -testcache", - "go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\\(.*\\)/' | sort -u)", - ] - - environment = { - "PGPASSWORD": "grafanatest", - "GRAFANA_TEST_DB": "postgres", - "POSTGRES_HOST": "postgres", - } - - return integration_tests_steps("postgres", cmds, "postgres", "5432", environment) - -def mysql_integration_tests_steps(hostname, version): - cmds = [ - "apk add --update mariadb-client", # alpine doesn't package mysql anymore; more info: https://wiki.alpinelinux.org/wiki/MySQL - "cat devenv/docker/blocks/mysql_tests/setup.sql | mariadb -h {} -P 3306 -u root -prootpass --disable-ssl-verify-server-cert".format(hostname), - "go clean -testcache", - "go test -p=1 -count=1 -covermode=atomic -timeout=5m -run '^TestIntegration' $(find ./pkg -type f -name '*_test.go' -exec grep -l '^func TestIntegration' '{}' '+' | grep -o '\\(.*\\)/' | sort -u)", - ] - - environment = { - "GRAFANA_TEST_DB": "mysql", - "MYSQL_HOST": hostname, - } - - return integration_tests_steps("mysql-{}".format(version), cmds, hostname, "3306", environment) - -def redis_integration_tests_steps(): - cmds = [ - "go clean -testcache", - "go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic -timeout=2m", - ] - - environment = { - "REDIS_URL": "redis://redis:6379/0", - } - - return integration_tests_steps("redis", cmds, "redis", "6379", environment = environment) - -def remote_alertmanager_integration_tests_steps(): - cmds = [ - "go clean -testcache", - "go test -run TestIntegrationRemoteAlertmanager -covermode=atomic -timeout=2m ./pkg/services/ngalert/...", - ] - - environment = { - "AM_TENANT_ID": "test", - "AM_URL": "http://mimir_backend:8080", - } - - return integration_tests_steps("remote-alertmanager", cmds, "mimir_backend", "8080", environment = environment) - -def memcached_integration_tests_steps(): - cmds = [ - "go clean -testcache", - "go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic -timeout=2m", - ] - - environment = { - "MEMCACHED_HOSTS": "memcached:11211", - } - - return integration_tests_steps("memcached", cmds, "memcached", "11211", environment) - def release_canary_npm_packages_step(trigger = None): """Releases canary NPM packages. diff --git a/scripts/drone/utils/images.star b/scripts/drone/utils/images.star index d4f9b659922..02b03169ed6 100644 --- a/scripts/drone/utils/images.star +++ b/scripts/drone/utils/images.star @@ -20,20 +20,11 @@ images = { "ubuntu": "ubuntu:22.04", "curl": "byrnedo/alpine-curl:0.1.8", "plugins_slack": "plugins/slack", - "python": "python:3.8", - "postgres_alpine": "postgres:12.3-alpine", - "mimir": "grafana/mimir-alpine:r316-55f47f8", - "mysql8": "mysql:8.0.32", - "redis_alpine": "redis:6.2.11-alpine", - "memcached_alpine": "memcached:1.6.9-alpine", "package_publish": "us.gcr.io/kubernetes-dev/package-publish:latest", - "openldap": "osixia/openldap:1.4.0", "drone_downstream": "grafana/drone-downstream", "docker_puppeteer": "grafana/docker-puppeteer:1.1.0", "docs": "grafana/docs-base:latest", "cypress": "cypress/included:14.3.2", "dockerize": "jwilder/dockerize:0.6.1", - "rocky": "rockylinux:9", - "wine": "scottyhardy/docker-wine:stable-9.0", "github_app_secret_writer": "us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59", }