CI Migration: Backport pkg/build (daggerbuild) and GHAs to release-12.0.3 (#107997)
* CI: move grafana-build into pkg/build (#105640) * move grafana-build into pkg/build * Update go.mod/go.sum files after cherry-pick build - Updates from workspace sync after cherry-picking daggerbuild package - Resolves dependency conflicts from pkg/build integration - Required for successful build after CI migration backport * CI Migration: Replace .github with main branch version - Complete replacement of .github directory from main branch - Includes updated workflows, actions, and configuration files - Ensures all CI improvements from main are included - Next step: fix branch-specific issues in separate commits * Fix branch triggers: Update workflows to target release branches - Update 8 workflows to trigger on release-* instead of main - Ensures workflows run on pull requests to release branches - Workflows updated: documentation-ci, pr-codeql-analysis-*, pr-dependabot-update-go-workspace, pr-go-workspace-check, pr-k8s-codegen-check, verify-kinds, codeowners-validator * Fix branch triggers: Update workflows to target both main and release branches - CORRECTED: Include both main and release-* branch patterns - Ensures workflows run on both main branch (original functionality) and release branches (needed for backport) - Previous commit incorrectly removed main branch support - Workflows updated: documentation-ci, pr-codeql-analysis-*, pr-dependabot-update-go-workspace, pr-go-workspace-check, pr-k8s-codegen-check, verify-kinds, codeowners-validator * CI Migration: Update .gitignore to allow OSS wire file to be committed - Remove **/wire_gen.go (allow pkg/server/wire_gen.go to be committed) - Add /pkg/server/enterprise_wire_gen.go (keep enterprise wire file ignored) - This enables the new committed wire files architecture for CI * CI Migration: Add enhanced wire tool with automatic build constraints - Backport enhanced wire tool from main branch with -gen_tags flag - This enables automatic regeneration with proper constraints to prevent conflicts - Wire file contains all required functions: Initialize, InitializeDocumentBuilders, etc. - Solves the missing wire functions issue causing CI failures - Enhanced tool ensures build constraints persist on regeneration * CI Migration: Update Makefile to use enhanced wire tool with build constraints - Update gen-go target to use -gen_tags flag for automatic build constraints - Ensures future engineers get proper build constraints when running 'make gen-go' - Matches main branch approach for consistent wire file generation - Removes dependency on WIRE_TAGS variable and GO_RACE_FLAG for simplicity * Add gen-enterprise-go target to Makefile for release-12.0.3 - Backports gen-enterprise-go target from main branch - Enables enterprise wire file generation in release branches - Part of CI migration backport wire infrastructure fixes - Resolves CI issues where enterprise wire functions were missing * Fix wire tool golden file format for Drone CI compatibility - Update all 43 golden test files to match main branch format - Change go:generate command from github.com/google/wire/cmd/wire to ./pkg/build/wire/cmd/wire/main.go - Remove legacy '// +build !wireinject' constraints - Fixes Drone CI test failures that were blocking OSS PR merge - All wire tests now pass successfully This aligns the backport branch with the golden file format updates that were made in main branch when the wire tool was enhanced. * Update swagger specs to include enterprise APIs - Regenerated api-enterprise-spec.json with enterprise API definitions - Updated api-merged.json with merged OSS and enterprise specs - Regenerated openapi3.json with complete API specifications - Fixes enterprise CI swagger generation validation failures - Enterprise APIs now properly detected and documented * Fix OSS integration tests missing enterprise build tags in Drone CI - Add -tags=enterprise to all integration test steps in lib.star - Fixes test-backend-integration, postgres-integration-tests, and mysql-integration-tests - Regenerate .drone.yml with proper enterprise build tags - Resolves 'server could not find the requested resource' errors for enterprise APIs - Ensures enterprise APIs (querylibrary, reporting, banners, scim) are registered during tests - Aligns OSS Drone CI with GitHub Actions behavior and enterprise repository * Fix CODEOWNERS for release-12.0.3 compatibility - Remove 21 entries that reference files/directories not present in release branch - Resolves File Exist Checker failures in codeowners-validator workflow - Maintains team ownership assignments from main branch for existing files - Lines removed: .air.toml, apps/secret/, apps/iam/, e2e-playwright/, packages/grafana-alerting/, etc. * baldm0mma/ update releasefinder * Add i18n-extract script for release branch compatibility - Add 'i18n-extract': 'make i18n-extract' to package.json scripts - Resolves i18n-verify workflow failure that expects this script - The make target already exists and handles OSS + enterprise i18n extraction - Maintains i18n verification functionality from main branch workflows - Simple safe addition that calls existing make infrastructure * Phase 4: Fix GitHub Actions workflow branch triggers - Add release-*.*.* pattern to 8 workflows missing it - Fix duplicate release branch patterns in 3 workflows - Ensure consistent branch trigger format across all workflows - Critical workflows now properly trigger on release branches Fixes workflows: actionlint, backend-code-checks, go-lint, reject-gh-secrets, run-schema-v2-e2e, shellcheck, swagger-gen, trivy-scan * Fix: Backport E2E runner infrastructure for Enterprise CI - Add e2e/main.go and e2e/internal/ directory from main branch - Add urfave/cli/v3 dependency required by E2E runner - Fixes Enterprise CI failure: 'Build E2E test runner' and 'Build & package Grafana for e2e tests' - Root cause: E2E runner infrastructure was added to main after release-12.0.3 branch creation - Solution: Backport missing E2E runner files to enable Enterprise CI completion Resolves: no Go files in /opt/actions-runner/_work/grafana-enterprise/grafana-enterprise/grafana/e2e * Fix: Update go.mod dependency classification for urfave/cli/v3 - Change urfave/cli/v3 from indirect to direct dependency - Fixes Go Workspace Check failure in CI - Required after adding E2E runner infrastructure that directly imports urfave/cli/v3 - Resolves: make update-workspace corrects dependency classification * Fix: Add team ownership for urfave/cli/v3 dependency - Assign @grafana/grafana-backend-group as owner for github.com/urfave/cli/v3@v3.3.8 - Follows existing pattern: urfave/cli v1 and v2 also owned by grafana-backend-group - Resolves Backend Code Checks / Validate Backend Configs CI failure - Required for E2E runner infrastructure dependency ownership compliance Fixes: modowners check requiring team assignment for newly added dependencies * Fix: Revert experimental E2E playwright infrastructure to stable version - Revert pr-e2e-tests.yml to stable Cypress-based E2E testing - Remove experimental storybook-verification-playwright.yml workflow - Revert run-dashboard-search-e2e.yml and release-pr.yml to use e2e/test-plugins/ - Keep stable E2E runner infrastructure (e2e/main.go + e2e/internal/) - Remove experimental playwright features per team recommendation Team feedback: Playwright tests are experimental and shouldn't be backported to stable release branches * Fix: Complete cleanup of experimental playwright dependencies - Revert package.json to stable version (remove e2e-playwright scripts and path references) - Revert playwright.config.ts to stable plugin-e2e configuration - Remove all experimental playwright infrastructure dependencies - Ensure clean stable E2E testing environment All experimental features removed per team recommendation for stable release branches * Fix: Restore working package.json configuration - Revert package.json to version 12.0.3 (working release branch version) - Fix workspace dependency resolution issues caused by incorrect revert to main branch version - FE tests, betterer, and linting should now work correctly Issue was caused by reverting package.json to main branch (12.1.0-pre) instead of keeping the working release branch configuration (12.0.3) * CI: mirror some CI dependencies (#106148) * mirror some CI dependencies * remove -v from go build * Fix: Backport missing e2e/run-suite script for daggerbuild E2E system The daggerbuild E2E system (used by OSS workflows) expects ./e2e/run-suite to exist, but we only backported the new E2E runner infrastructure. This script is needed for: - OSS workflow: 'go run ./pkg/build/e2e --suite=dashboards-suite' - Legacy Cypress configuration with video support - Integration between daggerbuild and existing Cypress test suites Resolves E2E test failures in OSS workflows where videos directory cannot be found because run-suite script was missing. * Fix: Resolve daggerbuild E2E path doubling issue - Extract just suite name from full path using filepath.Base() - Prevents doubled paths like './e2e/e2e/dashboards-suite/videos' - Resolves 'no spec files found' and 'no such file or directory' errors - GitHub Actions passes full paths like 'e2e/dashboards-suite' but run-suite script expects just 'dashboards-suite' * Infrastructure: Wholesale copy pkg/build/ from main COMPLETE DAGGERBUILD SYSTEM UPDATE: - Modern E2E system with CLI framework and --flags support - New accessibility testing system (a11y/) - New Playwright E2E testing system (e2e-playwright/) - External infrastructure improvements (musl.cc → dl.grafana.com/ci) - Updated daggerbuild core components with latest fixes - Updated Go dependencies and wire modules ARCHITECTURAL COMPATIBILITY VERIFIED: - Modern pkg/build calls: ./e2e-runner cypress --start-grafana=false --cypress-video - Our e2e runner supports: All required parameters including --suite, --env flags - GitHub Actions workflows: Pass compatible arguments - Binary builds: Successfully creates working e2e-runner RESOLVES ISSUES: - Fixes --flags parameter compatibility with GitHub Actions - Includes all follow-up infrastructure improvements - Provides complete, tested system with modern CLI framework - Eliminates external dependency failures (musl.cc timeouts) - Removes need for path doubling workarounds (modern system handles full paths correctly) Replaces incremental cherry-picking with complete, tested system from main. * Dependencies: Update Go modules after pkg/build wholesale copy DEPENDENCY UPDATES: - Updated go.work.sum with new dependencies from modern pkg/build system - Updated all workspace module dependencies (go.mod/go.sum files) - Removed pkg/build/cmd/enterprise.go (enterprise-only file, gets copied during enterprise development) ENTERPRISE INTEGRATION FIX: - enterprise.go file doesn't belong in OSS repository - Gets copied from grafana-enterprise during development mode - Main branch doesn't have this file, explaining module compatibility All Go modules now properly resolved and compatible with modern pkg/build architecture. * Dependencies: Update workspace Go module checksums after pkg/build wholesale copy - Synchronizes all go.sum files across workspace modules - Adds missing .mod.h1 entries that were required after infrastructure update - Resolves Go Workspace Check CI failures - Updates 22 modules: .citools/, apps/, pkg/ subdirectories plus go.work.sum Addresses CI error: 'Please run make update-workspace and commit the changes' * Infrastructure: Revert to pre-Playwright E2E system for release branch compatibility Strategic combination of modern daggerbuild with stable E2E infrastructure: **Modern Daggerbuild (from main):** - Latest CLI framework (github.com/urfave/cli/v3) - External infrastructure fixes (musl.cc → dl.grafana.com/ci) - Complete pkg/build/ system with all enhancements - Updated dependencies and architecture improvements **Stable E2E Infrastructure (pre-Playwright):** - pkg/build/e2e/service.go: Reverted to version before commitb6580ccb10- pkg/build/a11y/: Reverted to stable version compatible with existing infrastructure - Removed experimental pkg/build/e2e-playwright/ system - Removed experimental e2e-playwright/ test infrastructure **Why This Approach:** - GitHub Actions workflows call 'go run ./pkg/build/e2e' (modern system) - Modern system now expects only standard e2e/ directory (compatible) - Release branches have standard e2e/ infrastructure (dashboards-suite, various-suite, etc.) - Eliminates dependency on experimental Playwright infrastructure **Key Dependencies Met:** - e2e/pa11yci.conf.js: Added for a11y test compatibility - /src/e2e directory: Standard directory structure (no e2e-playwright needed) - Existing test plugins: Uses stable e2e/test-plugins/ **Result:** Best of both worlds - modern, reliable daggerbuild infrastructure with proven E2E testing that works across all release branches without requiring experimental dependencies. * Fix: Remove unused embed.go file causing golangci-lint failure - Removes pkg/build/daggerbuild/msi/embed.go with unused embed.FS variable - MSI build process uses directory mounting instead of embedded filesystem - Resolves 'var resources is unused (unused)' linting error * Fix: Update Node.js version to match working E2E configuration - Changes from v22.11.0 to v22.16.0 to match commit17952d45e4- Working commit had all E2E tests passing with same daggerbuild infrastructure - Node.js version differences can affect frontend builds and UI rendering - Ensures consistent environment between working reference and current branch * Fix: Use conditional container base for E2E compatibility - Alpine for OSS tests (better old arch dashboardScene=false compatibility) - Ubuntu for Enterprise tests (when image renderer needed) - Restores original release-12.0.3 Alpine behavior for OSS - Should resolve old arch E2E test failures * Fix: Go fmt formatting for conditional container logic * Revert: Remove unnecessary Alpine/Ubuntu conditional logic - Real issue was wrong environment variable name (dashboardScene vs DISABLE_SCENES) - Keep Ubuntu base (original main branch behavior) for simplicity - Container base was not the root cause of old arch failures * Experiment: Copy scripts/ from pre-Playwright commit (ea0ddb3fc9) - Copied scripts directory from commitea0ddb3fc9(just before Playwright migration) - This overwrites some CI migration fixes but testing if it's actually needed - Can revert back tob9b4602dbdif CI breaks Test commit to see real impact on GitHub Actions workflows. * trigger ci 01 * Fix: Copy .drone.star from main to match scripts structure - Resolves Starlark evaluation error for missing integration_test_pipelines - Aligns .drone.star with main branch scripts structure - Same fix applied to both OSS and Enterprise repositories * make drone * Fix ARM/v7 Docker build failures by using dagger run for cross-compilation - Change artifacts_cmd() in scripts/drone/steps/rgm.star to use 'dagger run go run' instead of 'go run' - Add --max-execution-steps 100000 to make drone target in Makefile to properly regenerate .drone.yml - This fixes CGO cross-compilation issues with SQLite for ARM/v7 Docker builds - Matches the approach already used successfully in Enterprise builds * Fix Docker base image references in rgm build steps - Change from symbolic names (alpine-base, ubuntu-base) to actual Docker images - alpine-base → alpine:3.21.3 - ubuntu-base → ubuntu:22.04 - Add ubuntu and alpine parameters to rgm_artifacts_step and rgm_build_docker_step functions - Fixes Docker pull errors: 'repository does not exist or may require authorization' - Aligns OSS configuration with Enterprise approach --------- Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>
This commit is contained in:
co-authored by
Kevin Minehart
parent
aee6b20c7f
commit
dc6bd2a20a
@@ -0,0 +1,9 @@
|
||||
"""
|
||||
Utilities / functions for working with dagger pipelines
|
||||
"""
|
||||
|
||||
def with_dagger_install(commands = [], dagger_version = ""):
|
||||
return [
|
||||
"wget -qO- https://github.com/dagger/dagger/releases/download/{}/dagger_{}_linux_amd64.tar.gz | tar zx -C /bin".format(dagger_version, dagger_version),
|
||||
"apk add docker",
|
||||
] + commands
|
||||
@@ -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",
|
||||
|
||||
@@ -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,26 +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/shellcheck.star",
|
||||
"shellcheck_pipeline",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/pipelines/swagger_gen.star",
|
||||
"swagger_gen",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/pipelines/test_backend.star",
|
||||
"test_backend",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/pipelines/verify_drone.star",
|
||||
"verify_drone",
|
||||
@@ -44,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 = {
|
||||
@@ -77,72 +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()),
|
||||
shellcheck_pipeline(),
|
||||
swagger_gen(
|
||||
ver_mode,
|
||||
),
|
||||
integration_benchmarks(
|
||||
prefix = ver_mode,
|
||||
),
|
||||
]
|
||||
|
||||
def get_pr_trigger(include_paths = None, exclude_paths = None):
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -14,7 +14,6 @@ load(
|
||||
"compile_build_cmd",
|
||||
"download_grabpl_step",
|
||||
"e2e_tests_artifacts",
|
||||
"e2e_tests_step",
|
||||
"enterprise_downstream_step",
|
||||
"frontend_metrics_step",
|
||||
"grafana_server_step",
|
||||
@@ -38,10 +37,6 @@ load(
|
||||
"scripts/drone/steps/rgm.star",
|
||||
"rgm_artifacts_step",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/utils/images.star",
|
||||
"images",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/utils/utils.star",
|
||||
"pipeline",
|
||||
@@ -74,7 +69,6 @@ def build_e2e(trigger, ver_mode):
|
||||
build_steps = []
|
||||
|
||||
create_packages = rgm_artifacts_step(
|
||||
alpine = images["alpine"],
|
||||
artifacts = [
|
||||
"targz:grafana:linux/amd64",
|
||||
"targz:grafana:linux/arm64",
|
||||
@@ -88,7 +82,6 @@ def build_e2e(trigger, ver_mode):
|
||||
],
|
||||
file = "packages.txt",
|
||||
tag_format = "{{ .version_base }}-{{ .buildID }}-{{ .arch }}",
|
||||
ubuntu = images["ubuntu"],
|
||||
ubuntu_tag_format = "{{ .version_base }}-{{ .buildID }}-ubuntu-{{ .arch }}",
|
||||
)
|
||||
|
||||
@@ -122,14 +115,8 @@ def build_e2e(trigger, ver_mode):
|
||||
publish_docker,
|
||||
build_test_plugins_step(),
|
||||
grafana_server_step(),
|
||||
e2e_tests_step("dashboards-suite"),
|
||||
e2e_tests_step("old-arch/dashboards-suite"),
|
||||
e2e_tests_step("smoke-tests-suite"),
|
||||
e2e_tests_step("old-arch/smoke-tests-suite"),
|
||||
e2e_tests_step("panels-suite"),
|
||||
e2e_tests_step("old-arch/panels-suite"),
|
||||
e2e_tests_step("various-suite"),
|
||||
e2e_tests_step("old-arch/various-suite"),
|
||||
# Note: Main E2E test suites (dashboards, panels, smoke-tests, various) have been migrated to GitHub Actions
|
||||
# Only keeping tests that are not yet covered by GitHub Actions
|
||||
cloud_plugins_e2e_tests_step(
|
||||
"cloud-plugins-suite",
|
||||
cloud = "azure",
|
||||
@@ -138,7 +125,7 @@ def build_e2e(trigger, ver_mode):
|
||||
playwright_e2e_tests_step(),
|
||||
playwright_e2e_report_upload(),
|
||||
playwright_e2e_report_post_link(),
|
||||
e2e_tests_artifacts(),
|
||||
e2e_tests_artifacts(), # Collects artifacts from remaining E2E tests
|
||||
build_storybook_step(ver_mode = ver_mode),
|
||||
test_a11y_frontend_step(ver_mode = ver_mode),
|
||||
],
|
||||
|
||||
@@ -35,7 +35,6 @@ def enterprise_downstream_pipeline():
|
||||
]
|
||||
deps = [
|
||||
"main-build-e2e-publish",
|
||||
"main-integration-tests",
|
||||
]
|
||||
return pipeline(
|
||||
name = "main-trigger-downstream",
|
||||
|
||||
+16
-28
@@ -1,21 +1,15 @@
|
||||
"""
|
||||
rgm uses 'github.com/grafana/grafana-build' to build Grafana on the following events:
|
||||
* A merge to main
|
||||
* A tag that begins with a 'v'
|
||||
'rgm' pipelines are pipelines that use dagger (located in 'pkg/build/daggerbuild')
|
||||
"""
|
||||
|
||||
load(
|
||||
"scripts/drone/dagger.star",
|
||||
"with_dagger_install",
|
||||
)
|
||||
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",
|
||||
@@ -33,7 +27,7 @@ load(
|
||||
)
|
||||
load(
|
||||
"scripts/drone/variables.star",
|
||||
"golang_version",
|
||||
"dagger_version",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/vault.star",
|
||||
@@ -132,19 +126,18 @@ def rgm_run(name, script):
|
||||
Drone step.
|
||||
"""
|
||||
env = {
|
||||
"GO_VERSION": golang_version,
|
||||
"ALPINE_BASE": images["alpine"],
|
||||
"UBUNTU_BASE": images["ubuntu"],
|
||||
}
|
||||
rgm_run_step = {
|
||||
"name": name,
|
||||
"image": "grafana/grafana-build:main",
|
||||
"image": images["go"],
|
||||
"pull": "always",
|
||||
"commands": [
|
||||
"commands": with_dagger_install([
|
||||
"export GRAFANA_DIR=$$(pwd)",
|
||||
"export GITHUB_TOKEN=$(cat /github-app/token)",
|
||||
"cd /src && ./scripts/{}".format(script),
|
||||
],
|
||||
"./pkg/build/daggerbuild/scripts/{}".format(script),
|
||||
], dagger_version),
|
||||
"environment": rgm_env_secrets(env),
|
||||
# The docker socket is a requirement for running dagger programs
|
||||
# In the future we should find a way to use dagger without mounting the docker socket.
|
||||
@@ -214,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():
|
||||
@@ -251,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():
|
||||
@@ -277,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(),
|
||||
]
|
||||
@@ -328,7 +317,6 @@ def rgm_promotion_pipeline():
|
||||
}
|
||||
|
||||
env = {
|
||||
"GO_VERSION": golang_version,
|
||||
"ALPINE_BASE": images["alpine"],
|
||||
"UBUNTU_BASE": images["ubuntu"],
|
||||
}
|
||||
@@ -342,18 +330,18 @@ def rgm_promotion_pipeline():
|
||||
# * UPLOAD_TO = Google Cloud Storage URL to upload the built artifacts to. (ex: gs://some-bucket/path)
|
||||
build_step = {
|
||||
"name": "rgm-build",
|
||||
"image": "grafana/grafana-build:main",
|
||||
"image": images["go"],
|
||||
"pull": "always",
|
||||
"commands": [
|
||||
"commands": with_dagger_install([
|
||||
"export GITHUB_TOKEN=$(cat /github-app/token)",
|
||||
"dagger run --silent /src/grafana-build artifacts " +
|
||||
"dagger run --silent go run ./pkg/build/cmd artifacts " +
|
||||
"-a $${ARTIFACTS} " +
|
||||
"--grafana-ref=$${GRAFANA_REF} " +
|
||||
"--enterprise-ref=$${ENTERPRISE_REF} " +
|
||||
"--grafana-repo=$${GRAFANA_REPO} " +
|
||||
"--version=$${VERSION} " +
|
||||
"--go-version={}".format(golang_version),
|
||||
],
|
||||
"--build-id=$${DRONE_BUILD_NUMBER} " +
|
||||
"--version=$${VERSION}",
|
||||
], dagger_version),
|
||||
"environment": rgm_env_secrets(env),
|
||||
# The docker socket is a requirement for running dagger programs
|
||||
# In the future we should find a way to use dagger without mounting the docker socket.
|
||||
|
||||
+26
-234
@@ -315,14 +315,16 @@ def store_storybook_step(ver_mode, trigger = None):
|
||||
return step
|
||||
|
||||
def e2e_tests_artifacts():
|
||||
# Note: This function is kept for backward compatibility but now only handles
|
||||
# artifacts from the remaining E2E tests that haven't been migrated to GitHub Actions
|
||||
return {
|
||||
"name": "e2e-tests-artifacts-upload",
|
||||
"image": images["cloudsdk"],
|
||||
"depends_on": [
|
||||
"end-to-end-tests-dashboards-suite",
|
||||
"end-to-end-tests-panels-suite",
|
||||
"end-to-end-tests-smoke-tests-suite",
|
||||
"end-to-end-tests-various-suite",
|
||||
# Note: Main E2E tests have been migrated to GitHub Actions
|
||||
# Only depend on remaining Drone E2E tests
|
||||
"end-to-end-tests-cloud-plugins-suite-azure",
|
||||
"playwright-plugin-e2e",
|
||||
github_app_generate_token_step()["name"],
|
||||
],
|
||||
"failure": "ignore",
|
||||
@@ -338,8 +340,8 @@ def e2e_tests_artifacts():
|
||||
},
|
||||
"commands": [
|
||||
"export GITHUB_TOKEN=$(cat /github-app/token)",
|
||||
# if no videos found do nothing
|
||||
"if [ -z `find ./e2e -type f -name *spec.ts.mp4` ]; then echo 'missing videos'; false; fi",
|
||||
# if no videos found do nothing (may be fewer videos now that main tests are in GitHub Actions)
|
||||
"if [ -z `find ./e2e -type f -name *spec.ts.mp4` ]; then echo 'no e2e videos found from remaining tests'; exit 0; fi",
|
||||
"apt-get update",
|
||||
"apt-get install -yq zip",
|
||||
"printenv GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY > /tmp/gcpkey_upload_artifacts.json",
|
||||
@@ -568,34 +570,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 +589,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."
|
||||
@@ -713,21 +649,13 @@ def test_a11y_frontend_step(ver_mode, port = 3001):
|
||||
commands = [
|
||||
# Note - this runs in a container running node 14, which does not support the -y option to npx
|
||||
"npx wait-on@7.0.1 http://$HOST:$PORT",
|
||||
"pa11y-ci --config e2e/pa11yci.conf.js",
|
||||
]
|
||||
failure = "ignore"
|
||||
no_thresholds = "true"
|
||||
if ver_mode == "pr":
|
||||
commands.extend(
|
||||
[
|
||||
"pa11y-ci --config .pa11yci-pr.conf.js",
|
||||
],
|
||||
)
|
||||
failure = "always"
|
||||
else:
|
||||
commands.extend(
|
||||
[
|
||||
"pa11y-ci --config .pa11yci.conf.js --json > pa11y-ci-results.json",
|
||||
],
|
||||
)
|
||||
no_thresholds = "false"
|
||||
|
||||
return {
|
||||
"name": "test-a11y-frontend",
|
||||
@@ -740,6 +668,7 @@ def test_a11y_frontend_step(ver_mode, port = 3001):
|
||||
"GRAFANA_MISC_STATS_API_KEY": from_secret("grafana_misc_stats_api_key"),
|
||||
"HOST": "grafana-server",
|
||||
"PORT": port,
|
||||
"NO_THRESHOLDS": no_thresholds,
|
||||
},
|
||||
"failure": failure,
|
||||
"commands": commands,
|
||||
@@ -835,23 +764,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.
|
||||
|
||||
@@ -890,7 +802,7 @@ def cloud_plugins_e2e_tests_step(suite, cloud, trigger = None):
|
||||
branch = "${DRONE_SOURCE_BRANCH}".replace("/", "-")
|
||||
step = {
|
||||
"name": "end-to-end-tests-{}-{}".format(suite, cloud),
|
||||
"image": "us-docker.pkg.dev/grafanalabs-dev/cloud-data-sources/e2e-13.10.0:1.0.0",
|
||||
"image": "us-docker.pkg.dev/grafanalabs-dev/docker-oss-plugin-partnerships-dev/e2e-14.3.2:1.0.0",
|
||||
"depends_on": [
|
||||
"grafana-server",
|
||||
github_app_generate_token_step()["name"],
|
||||
@@ -1014,129 +926,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.
|
||||
|
||||
@@ -1175,12 +964,15 @@ def release_canary_npm_packages_step(trigger = None):
|
||||
|
||||
return step
|
||||
|
||||
def upload_packages_step(ver_mode, trigger = None, depends_on = [
|
||||
"end-to-end-tests-dashboards-suite",
|
||||
"end-to-end-tests-panels-suite",
|
||||
"end-to-end-tests-smoke-tests-suite",
|
||||
"end-to-end-tests-various-suite",
|
||||
]):
|
||||
def upload_packages_step(
|
||||
ver_mode,
|
||||
trigger = None,
|
||||
depends_on = [
|
||||
# Note: Main E2E tests have been migrated to GitHub Actions
|
||||
# Updated dependencies to only include remaining Drone E2E tests
|
||||
"end-to-end-tests-cloud-plugins-suite-azure",
|
||||
"playwright-plugin-e2e",
|
||||
]):
|
||||
"""Upload packages to object storage.
|
||||
|
||||
Args:
|
||||
@@ -1341,11 +1133,11 @@ def verify_gen_jsonnet_step():
|
||||
}
|
||||
|
||||
def end_to_end_tests_deps():
|
||||
# Note: Main E2E tests have been migrated to GitHub Actions
|
||||
# Only return dependencies for E2E tests that still run in Drone
|
||||
return [
|
||||
"end-to-end-tests-dashboards-suite",
|
||||
"end-to-end-tests-panels-suite",
|
||||
"end-to-end-tests-smoke-tests-suite",
|
||||
"end-to-end-tests-various-suite",
|
||||
"end-to-end-tests-cloud-plugins-suite-azure",
|
||||
"playwright-plugin-e2e",
|
||||
]
|
||||
|
||||
def compile_build_cmd():
|
||||
|
||||
@@ -3,13 +3,17 @@ Individual steps that use 'grafana-build' to replace existing individual steps.
|
||||
These aren't used in releases.
|
||||
"""
|
||||
|
||||
load(
|
||||
"scripts/drone/dagger.star",
|
||||
"with_dagger_install",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/utils/images.star",
|
||||
"images",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/variables.star",
|
||||
"golang_version",
|
||||
"dagger_version",
|
||||
)
|
||||
load(
|
||||
"scripts/drone/vault.star",
|
||||
@@ -18,7 +22,7 @@ load(
|
||||
)
|
||||
|
||||
def artifacts_cmd(artifacts = []):
|
||||
cmd = "/src/grafana-build artifacts "
|
||||
cmd = "dagger run go run ./pkg/build/cmd artifacts "
|
||||
|
||||
for artifact in artifacts:
|
||||
cmd += "-a {} ".format(artifact)
|
||||
@@ -33,25 +37,24 @@ def rgm_artifacts_step(
|
||||
depends_on = ["yarn-install"],
|
||||
tag_format = "{{ .version }}-{{ .arch }}",
|
||||
ubuntu_tag_format = "{{ .version }}-ubuntu-{{ .arch }}",
|
||||
verify = "false",
|
||||
ubuntu = images["ubuntu"],
|
||||
alpine = images["alpine"]):
|
||||
alpine = images["alpine"],
|
||||
verify = "false"):
|
||||
cmd = artifacts_cmd(artifacts = artifacts)
|
||||
|
||||
return {
|
||||
"name": name,
|
||||
"image": "grafana/grafana-build:main",
|
||||
"image": images["go"],
|
||||
"pull": "always",
|
||||
"depends_on": depends_on,
|
||||
"environment": {
|
||||
"_EXPERIMENTAL_DAGGER_CLOUD_TOKEN": from_secret(rgm_dagger_token),
|
||||
},
|
||||
"commands": [
|
||||
"commands": with_dagger_install([
|
||||
"docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --version",
|
||||
"docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*'",
|
||||
"docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all",
|
||||
cmd +
|
||||
"--go-version={} ".format(golang_version) +
|
||||
"--yarn-cache=$$YARN_CACHE_FOLDER " +
|
||||
"--build-id=$$DRONE_BUILD_NUMBER " +
|
||||
"--ubuntu-base={} ".format(ubuntu) +
|
||||
@@ -61,29 +64,27 @@ def rgm_artifacts_step(
|
||||
"--verify='{}' ".format(verify) +
|
||||
"--grafana-dir=$$PWD > {}".format(file),
|
||||
"find ./dist -name '*docker*.tar.gz' -type f | xargs -n1 docker load -i",
|
||||
],
|
||||
], dagger_version),
|
||||
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
|
||||
}
|
||||
|
||||
# rgm_build_backend will create compile the grafana backend for various platforms. It's preferred to use
|
||||
# 'rgm_package_step' if you creating a "usable" artifact. This should really only be used to verify that the code is
|
||||
# compilable.
|
||||
# rgm_build_backend will create compile the grafana backend for various platforms.
|
||||
def rgm_build_backend_step(artifacts = ["backend:grafana:linux/amd64", "backend:grafana:linux/arm64"]):
|
||||
return rgm_artifacts_step(name = "rgm-build-backend", artifacts = artifacts, depends_on = [])
|
||||
|
||||
def rgm_build_docker_step(ubuntu, alpine, depends_on = ["yarn-install"], file = "docker.txt", tag_format = "{{ .version }}-{{ .arch }}", ubuntu_tag_format = "{{ .version }}-ubuntu-{{ .arch }}"):
|
||||
def rgm_build_docker_step(depends_on = ["yarn-install"], file = "docker.txt", tag_format = "{{ .version }}-{{ .arch }}", ubuntu_tag_format = "{{ .version }}-ubuntu-{{ .arch }}", ubuntu = images["ubuntu"], alpine = images["alpine"]):
|
||||
return {
|
||||
"name": "rgm-build-docker",
|
||||
"image": "grafana/grafana-build:main",
|
||||
"image": images["go"],
|
||||
"pull": "always",
|
||||
"environment": {
|
||||
"_EXPERIMENTAL_DAGGER_CLOUD_TOKEN": from_secret(rgm_dagger_token),
|
||||
},
|
||||
"commands": [
|
||||
"commands": with_dagger_install([
|
||||
"docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --version",
|
||||
"docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --uninstall 'qemu-*'",
|
||||
"docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0-28 --install all",
|
||||
"/src/grafana-build artifacts " +
|
||||
"dagger run go run ./pkg/build/cmd artifacts " +
|
||||
"-a docker:grafana:linux/amd64 " +
|
||||
"-a docker:grafana:linux/amd64:ubuntu " +
|
||||
"-a docker:grafana:linux/arm64 " +
|
||||
@@ -92,14 +93,13 @@ def rgm_build_docker_step(ubuntu, alpine, depends_on = ["yarn-install"], file =
|
||||
"-a docker:grafana:linux/arm/v7:ubuntu " +
|
||||
"--yarn-cache=$$YARN_CACHE_FOLDER " +
|
||||
"--build-id=$$DRONE_BUILD_NUMBER " +
|
||||
"--go-version={} ".format(golang_version) +
|
||||
"--ubuntu-base={} ".format(ubuntu) +
|
||||
"--alpine-base={} ".format(alpine) +
|
||||
"--tag-format='{}' ".format(tag_format) +
|
||||
"--grafana-dir=$$PWD " +
|
||||
"--ubuntu-tag-format='{}' > {}".format(ubuntu_tag_format, file),
|
||||
"find ./dist -name '*docker*.tar.gz' -type f | xargs -n1 docker load -i",
|
||||
],
|
||||
], dagger_version),
|
||||
"volumes": [{"name": "docker", "path": "/var/run/docker.sock"}],
|
||||
"depends_on": depends_on,
|
||||
}
|
||||
|
||||
@@ -20,21 +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:13.10.0",
|
||||
"cypress": "cypress/included:14.3.2",
|
||||
"dockerize": "jwilder/dockerize:0.6.1",
|
||||
"shellcheck": "koalaman/shellcheck:stable",
|
||||
"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",
|
||||
}
|
||||
|
||||
@@ -6,4 +6,5 @@ grabpl_version = "v3.1.2"
|
||||
golang_version = "1.24.4"
|
||||
|
||||
# nodejs_version should match what's in ".nvmrc", but without the v prefix.
|
||||
nodejs_version = "22.11.0"
|
||||
nodejs_version = "22.16.0"
|
||||
dagger_version = "v0.18.8"
|
||||
|
||||
Reference in New Issue
Block a user