Skip to content

Require Bazel 8+#39

Merged
greggdonovan merged 18 commits intomainfrom
grafana-foundation-sdk
Dec 20, 2025
Merged

Require Bazel 8+#39
greggdonovan merged 18 commits intomainfrom
grafana-foundation-sdk

Conversation

@greggdonovan
Copy link
Contributor

@greggdonovan greggdonovan commented Dec 19, 2025

Description

Require Bazel 8+
Add the metadata and CI target for Bazel Central Registry support.
Call this version 2.0.0. We will upgrade to 3.x in a future release with the grafana foundation SDK, as grafanalib is in maintenance mode and the foundation SDK has first-party support.

Please include a brief summary of the changes.

Context / Why are we making this change?

Please include details on why this change is necessary, and any applicable tickets, design docs, or documentation links.

Testing and QA Plan

How has this work been tested or QA'd?

Impact

What are the implications of these changes? Are there any cross-cutting concerns to keep in mind?

greggdonovan and others added 2 commits December 19, 2025 17:03
Replace the community-maintained grafanalib with Grafana's official
Foundation SDK for dashboards-as-code. The Foundation SDK is actively
maintained by Grafana Labs, auto-generated from Grafana's schemas,
and provides strongly-typed builders.

Changes:
- Update requirements.in to use grafana-foundation-sdk 11.6.0
- Update grafana.bzl to reference the new package
- Migrate example/sample.py and test/dash.py to Foundation SDK
  builder pattern

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Dependency updates:
- aspect_bazel_lib: 2.20.0 → 2.21.2
- bazel_skylib: 1.8.1 → 1.9.0
- container_structure_test: 1.19.1 → 1.21.1
- platforms: 0.0.11 → 1.0.0
- rules_oci: 2.2.0 → 2.2.7
- rules_pkg: 1.0.1 → 1.1.0
- rules_python: 0.38.0 → 1.7.0
- Python: 3.11.8 → 3.11.13 (security fixes for CVE-2025-47273)

Grafana change:
- Downgrade from 12.0 to 11.6.9 for a more conservative upgrade path
  (Etsy currently uses 10.x)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@cristifalcas cristifalcas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet

greggdonovan and others added 3 commits December 20, 2025 11:04
- Bump version to 2.0.0 (breaking change: grafanalib → grafana-foundation-sdk)
- Add oci_load target to example for running Grafana locally
- Update README with correct instructions and grafana-foundation-sdk examples
- Add .bcr/ directory with BCR metadata templates
- Add GitHub Actions CI (Bazel 7.x/8.x on Ubuntu/macOS) and release workflows
- Add module docstring to grafana.bzl with SDK example

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove invalid bazel-version input from setup-bazel action
- Use specific bazelisk version (1.25.0) instead of "latest"
- Control Bazel version via USE_BAZEL_VERSION environment variable
- Comment out E2E tests (on separate branch)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Split CI into linux and macos jobs
- macOS: only build non-OCI targets (Grafana image requires linux)
- Add docker tags to container_structure_test targets
- Mark grafana_with_plugins_docker_test as manual (path differs Bazel 7/8)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@greggdonovan greggdonovan marked this pull request as ready for review December 20, 2025 16:20
greggdonovan and others added 13 commits December 20, 2025 11:28
- Add linux/arm64 platform to oci_pull for M1/M2 Mac support
- Use latest bazelisk (1.27.0) and latest-7/latest Bazel versions
- Update BCR presubmit to use macos-15 and exclude docker tests
- Add detailed comment explaining Bazel 7/8 canonical repo name difference
  (Bazel 7: _main~ext~repo, Bazel 8: +ext+repo)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Grafana OCI image digest is for linux/amd64 only. On macOS:
- Local dev: Docker Desktop handles translation via Rosetta
- CI: Skip OCI targets, only build dashboard rules

BCR presubmit now has separate Linux-only job for OCI targets.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update bazel_compatibility to >=8.0.0
- Remove Bazel 7.x from CI matrix and BCR presubmit
- Remove E2E Testing section from README (moved to playwright-e2e branch)
- Enable grafana_with_plugins_docker_test (no longer manual since Bazel 8 only)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add grafana_with_plugins_docker_test to Linux CI
- Add plugin build and test to BCR presubmit
- Update release.yml comment (BCR app is now installed)
- Clarify extensions.bzl comment about macOS OCI builds

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add tags parameter to grafana_image macro
- Add "oci" tag to all OCI targets
- Linux CI: build and test //... (everything)
- macOS CI: use --build_tag_filters=-oci and --test_tag_filters=-docker,-oci
- BCR presubmit: use //... patterns with tag filters
- Document tags parameter in README

This approach is more maintainable as new targets are automatically
included without updating CI configuration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
OCI images can be built on any platform - they're just tar layers.
The only thing that fails on macOS CI is container_structure_test
because Docker is not available on GitHub-hosted macOS runners.

See: actions/runner#1456

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Before: 3 jobs (ubuntu ran twice with redundant builds)
After: 2 jobs (1 per platform, no redundancy)

- bcr_test_module_linux: builds and tests everything
- bcr_test_module_macos: builds everything, tests non-docker

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Push to main: CI runs
- Any PR: CI runs (removed branch filter)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The oci tag was added when we incorrectly thought OCI builds
failed on macOS. Only docker tests need filtering (they require
Docker which isn't available on GitHub macOS runners).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
oci_pull creates a select() for linux/amd64. On arm64 macOS (GitHub
Actions runners), builds fail because there's no matching platform.

- Add "oci" tag to grafana_image and oci_load targets
- Use --build_tag_filters=-oci on macOS CI
- Use --test_tag_filters=-docker,-oci on macOS CI

Intel Macs work fine (x86_64 matches linux/amd64 in select).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
container_structure_test depends on grafana_image. Even with
--build_tag_filters=-oci, Bazel analyzes the test's dependencies.
Adding oci tag to tests ensures they're fully excluded on arm64 macOS.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
--test_tag_filters only filters which tests RUN, not which targets
are ANALYZED. bazel test //... still analyzes all targets.
Need --build_tag_filters=-oci to prevent analysis of OCI targets.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@greggdonovan greggdonovan changed the title Grafana foundation sdk Require Bazel 8+ Dec 20, 2025
@greggdonovan greggdonovan merged commit b6a3a79 into main Dec 20, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants