diff --git a/.aspect/bazelrc/BUILD.bazel b/.aspect/bazelrc/BUILD.bazel index bfa2fb35..adf63e80 100644 --- a/.aspect/bazelrc/BUILD.bazel +++ b/.aspect/bazelrc/BUILD.bazel @@ -2,4 +2,10 @@ load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets") +filegroup( + name = "all_files", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) + write_aspect_bazelrc_presets(name = "update_aspect_bazelrc_presets") diff --git a/.bazelignore b/.bazelignore index c7ca8d09..8356632e 100644 --- a/.bazelignore +++ b/.bazelignore @@ -1 +1,33 @@ -e2e +# make sure we ignore bazel managed directories for e2e tests +e2e/bazel-bzlmod-lock-file-from-args/bazel-bin +e2e/bazel-bzlmod-lock-file-from-args/bazel-out +e2e/bazel-bzlmod-lock-file-from-args/bazel-bazel-bzlmod-lock-file-from-args +e2e/bazel-bzlmod-lock-file-from-args/bazel-testlogs +e2e/bazel-bzlmod-lock-file/bazel-bin +e2e/bazel-bzlmod-lock-file/bazel-out +e2e/bazel-bzlmod-lock-file/bazel-bazel-bzlmod-lock-file +e2e/bazel-bzlmod-lock-file/bazel-testlogs +e2e/bazel-bzlmod-toolchain-from-source-lock-file/bazel-bin +e2e/bazel-bzlmod-toolchain-from-source-lock-file/bazel-out +e2e/bazel-bzlmod-toolchain-from-source-lock-file/bazel-bazel-bzlmod-toolchain-from-source-lock-file +e2e/bazel-bzlmod-toolchain-from-source-lock-file/bazel-testlogs +e2e/bazel-bzlmod-toolchain-from-source/bazel-bin +e2e/bazel-bzlmod-toolchain-from-source/bazel-out +e2e/bazel-bzlmod-toolchain-from-source/bazel-bazel-bzlmod-toolchain-from-source +e2e/bazel-bzlmod-toolchain-from-source/bazel-testlogs +e2e/bazel-bzlmod/bazel-bin +e2e/bazel-bzlmod/bazel-out +e2e/bazel-bzlmod/bazel-bazel-bzlmod +e2e/bazel-bzlmod/bazel-testlogs +e2e/bazel-workspace/bazel-bin +e2e/bazel-workspace/bazel-out +e2e/bazel-workspace/bazel-bazel-workspace +e2e/bazel-workspace/bazel-testlogs +e2e/bzlmod-toolchain-circular-dependencies/bazel-bin +e2e/bzlmod-toolchain-circular-dependencies/bazel-out +e2e/bzlmod-toolchain-circular-dependencies/bazel-bzlmod-toolchain-circular-dependencies +e2e/bzlmod-toolchain-circular-dependencies/bazel-testlogs +e2e/repo-yaml/bazel-bin +e2e/repo-yaml/bazel-out +e2e/repo-yaml/bazel-repo-yaml +e2e/repo-yaml/bazel-testlogs diff --git a/.bazelrc b/.bazelrc index 3700c9e5..b3f1e981 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,12 +1,20 @@ # Import Aspect bazelrc presets -import %workspace%/.aspect/bazelrc/bazel7.bazelrc # will only work in bazel7+ +import %workspace%/.aspect/bazelrc/bazel7.bazelrc import %workspace%/.aspect/bazelrc/convenience.bazelrc import %workspace%/.aspect/bazelrc/correctness.bazelrc import %workspace%/.aspect/bazelrc/debug.bazelrc import %workspace%/.aspect/bazelrc/performance.bazelrc +# Prevent Bazel from treating e2e child workspace BUILD files as packages +# When adding a new e2e test then `bazel run @rules_bazel_integration_test//tools:update_deleted_packages` +# needs to be executed +common --deleted_packages=e2e/bazel-bzlmod,e2e/bazel-bzlmod-lock-file,e2e/bazel-bzlmod-lock-file-from-args,e2e/bazel-bzlmod-toolchain-from-source,e2e/bazel-bzlmod-toolchain-from-source-lock-file,e2e/bazel-workspace,e2e/bzlmod-toolchain-circular-dependencies,e2e/repo-yaml + # Specific project flags go here if we have some + +# use prebuilt protoc common --incompatible_enable_proto_toolchain_resolution +common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc # inside the rules project we build from source common --extra_toolchains=//cmd:bazeldnf-host-toolchain @@ -15,6 +23,8 @@ common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc # make sure bazel doesn't complain on hosts without java common --java_runtime_version=remotejdk_21 +test --test_tag_filters=-allowed-to-fail + # Load any settings & overrides specific to the current user from `.bazelrc.user`. # This file should appear in `.gitignore` so that settings are not shared with team members. This # should be last statement in this config so the user configuration is able to overwrite flags from diff --git a/.gitattributes b/.gitattributes index e3d4e3b4..82aee033 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,6 +5,8 @@ docs/*.md linguist-generated=true # Exclude a bunch of paths to save some disk space e2e/bazel-bzlmod-* export-ignore e2e/bazel-workspace* export-ignore +e2e/.bazelrc export-ignore .github export-ignore pkg/*/testdata export-ignore tools/release export-ignore +REPO.bazel export-ignore diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index b3ed4e0b..d84281bc 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -17,8 +17,8 @@ jobs: build-and-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.8.5 + - uses: actions/checkout@v6.0.2 + - uses: bazel-contrib/setup-bazel@0.18.0 with: # Avoid downloading Bazel every time. bazelisk-cache: true @@ -28,159 +28,34 @@ jobs: repository-cache: true # enable some flags for CI bazelrc: | - import %workspace%/.aspect/bazelrc/ci.bazelrc - import %workspace%/.github/workflows/ci.bazelrc + try-import %workspace%/.aspect/bazelrc/ci.bazelrc + try-import %workspace%/.github/workflows/ci.bazelrc + try-import %workspace%/../../.aspect/bazelrc/ci.bazelrc + try-import %workspace%/../../.github/workflows/ci.bazelrc # keep a cache for MODULE.bazel repos external-cache: true - - run: bazelisk build //... && bazelisk test //... - - e2e-workspace-matrix: - strategy: - matrix: - version: - - version: 6.x - bazelrc: | - import %workspace%/../../.aspect/bazelrc/bazel6.bazelrc - - version: 7.x - bazelrc: | - import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc - import %workspace%/../../.aspect/bazelrc/bazel6.bazelrc - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.8.5 - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Keep a disk-cache - disk-cache: true - # Share repository cache between workflows. - repository-cache: true - # enable some flags for CI - bazelrc: | - import %workspace%/../../.aspect/bazelrc/ci.bazelrc - import %workspace%/../../.github/workflows/ci.bazelrc - ${{ matrix.version.bazelrc }} - - run: cd e2e/bazel-workspace && USE_BAZEL_VERSION=${{ matrix.version.version }} bazelisk build //... - - e2e-bzlmod-matrix: - strategy: - matrix: - version: [7.x, 8.x] - path: - - bazel-bzlmod - - bazel-bzlmod-lock-file - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.8.5 - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Keep a disk-cache - disk-cache: true - # Share repository cache between workflows. - repository-cache: true - # enable some flags for CI - bazelrc: | - import %workspace%/../../.aspect/bazelrc/ci.bazelrc - import %workspace%/../../.github/workflows/ci.bazelrc - - run: cd e2e/${{ matrix.path }} && USE_BAZEL_VERSION=${{ matrix.version }} bazelisk build //... - - e2e-bzlmod-build-toolchain-matrix: - strategy: - matrix: - version: [7.x, 8.x] - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.8.5 - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Keep a disk-cache - disk-cache: true - # Share repository cache between workflows. - repository-cache: true - # enable some flags for CI - bazelrc: | - import %workspace%/../../.aspect/bazelrc/ci.bazelrc - import %workspace%/../../.github/workflows/ci.bazelrc - - run: cd e2e/bazel-bzlmod-toolchain-from-source && USE_BAZEL_VERSION=${{ matrix.version }} bazelisk build //... - - e2e-repo-yaml: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.8.5 - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Keep a disk-cache - disk-cache: true - # Share repository cache between workflows. - repository-cache: true - # enable some flags for CI - bazelrc: | - import %workspace%/.aspect/bazelrc/ci.bazelrc - import %workspace%/.github/workflows/ci.bazelrc - - run: | - export USE_BAZEL_VERSION=7.x - bazelisk run //cmd -- init --fc 41 --output $(pwd)/repo.yaml - bazelisk run //cmd -- fetch --repofile $(pwd)/repo.yaml - bazelisk run //cmd -- resolve --repofile $(pwd)/repo.yaml bash - - e2e-bzlmod-lock-file-from-args: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.8.5 - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Keep a disk-cache - disk-cache: true - # Share repository cache between workflows. - repository-cache: true - # enable some flags for CI - bazelrc: | - import %workspace%/../../.aspect/bazelrc/ci.bazelrc - import %workspace%/../../.github/workflows/ci.bazelrc - - run: | - export USE_BAZEL_VERSION=8.x - cd e2e/bazel-bzlmod-lock-file-from-args && bazelisk run :bazeldnf -- fetch && bazelisk run @bazeldnf_rpms//:update-lock-file && bazelisk build ... - - e2e-bzlmod-toolchain-circular-dependencies: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: bazel-contrib/setup-bazel@0.8.5 - with: - # Avoid downloading Bazel every time. - bazelisk-cache: true - # Keep a disk-cache - disk-cache: true - # Share repository cache between workflows. - repository-cache: true - # enable some flags for CI - bazelrc: | - import %workspace%/../../.aspect/bazelrc/ci.bazelrc - import %workspace%/../../.github/workflows/ci.bazelrc - - id: prepare - run: | - export USE_BAZEL_VERSION=8.x - cd e2e/bzlmod-toolchain-circular-dependencies - bazelisk run @bazeldnf_rpms//:fetch-repo - bazelisk run @bazeldnf_rpms//:update-lock-file - - id: test + - id: build + name: building repository + run: bazelisk build //... + - id: unit-tests + name: running unit tests + run: bazelisk test //... + - id: prepare-e2e-runner + name: preparing for e2e + # workaround for https://github.com/bazel-contrib/setup-bazel/issues/108 + # together with our customized default_test_runner + run: cat ~/.bazelrc | grep -v output_base > ~/.bazelrc.clean + - id: e2e-that-should-pass + name: running mandatory e2e tests + run: bazelisk test e2e --notest_keep_going + - id: e2e-that-are-allowed-to-fail + name: running e2e tests that are allowed to fail run: | - export USE_BAZEL_VERSION=8.x - cd e2e/bzlmod-toolchain-circular-dependencies - bazelisk build //... || status=$? - if [ ${status} -ne 0 ]; then - echo "::warning::Optional job failed." - echo "optional_fail=true" >> "${GITHUB_OUTPUT}" - echo "optional_fail_status=${status}" >> "${GITHUB_OUTPUT}" - fi + ret_code=0 + bazel test //e2e --notest_keep_going --test_tag_filters=allowed-to-fail || ret_code=$? + case $ret_code in + 0) echo "All allowed-to-fail tests passed." ;; + 3) echo "::warning::Some allowed-to-fail e2e tests failed or timed out." ;; + 4) echo "No tests matched the allowed-to-fail filter." ;; + *) exit $ret_code ;; + esac diff --git a/BUILD.bazel b/BUILD.bazel index ba608e97..fa6997ef 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -15,6 +15,7 @@ gazelle_binary( ) # gazelle:exclude .bazelbsp +# gazelle:exclude e2e/*/* # gazelle:prefix github.com/rmohr/bazeldnf # gazelle:resolve go github.com/bazelbuild/buildtools/build @com_github_bazelbuild_buildtools//build:go_default_library # gazelle:resolve go github.com/bazelbuild/buildtools/edit @com_github_bazelbuild_buildtools//edit:go_default_library @@ -95,3 +96,23 @@ bzl_library( ) # gazelle:exclude deps.bzl + +# Aggregates all parent workspace files so that child workspaces using +# local_path_override(path = "../..") can resolve the full module. +filegroup( + name = "local_repository_files", + srcs = [ + "MODULE.bazel", + "WORKSPACE", + "//:.github/workflows/ci.bazelrc", + "//.aspect/bazelrc:all_files", + "//bazeldnf:all_files", + "//bazeldnf/private:all_files", + "//internal:all_files", + "//tools:all_files", + "//tools/e2e:toolchain", + ], + visibility = [ + "//e2e:__subpackages__", + ], +) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..23f5bc6a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,490 @@ +# Contributing to bazeldnf + +Thank you for your interest in contributing to bazeldnf! This guide covers the +development workflow for making changes to Go code, Starlark rules, dependency +management, and end-to-end tests. + +## Prerequisites + +- [Bazelisk](https://github.com/bazelbuild/bazelisk) (symlinked as `bazel`) +- Git + +## Project Layout + +``` +bazeldnf/ +├── cmd/ # CLI binary (cobra commands) +├── pkg/ # Go library packages +│ ├── api/ # Core API types +│ ├── bazel/ # BUILD file manipulation +│ ├── ldd/ # Shared library dependency analysis +│ ├── order/ # Package ordering +│ ├── reducer/ # SAT solver wrapper +│ ├── repo/ # DNF/RPM repo fetching and parsing +│ ├── rpm/ # RPM file handling +│ ├── sat/ # SAT solver integration +│ └── xattr/ # Extended attributes +├── bazeldnf/ # Public Starlark API (.bzl files) +│ └── private/ # Private Starlark helpers +├── internal/ # Starlark rule implementations +├── tools/ # Release tooling, version info, integrity checksums +├── e2e/ # End-to-end integration test workspaces +├── MODULE.bazel # Bazel module definition (bzlmod) +├── go.mod / go.sum # Go module dependencies +└── BUILD.bazel # Root build targets (gazelle, buildifier, etc.) +``` + +## Building and Testing + +```sh +# Build everything +bazel build //... + +# Run all unit tests +bazel test //... + +# Run all end-to-end tests that should pass +bazel test e2e + +# Run end-to-end tests that are allowed to fail +bazel test //e2e/... --test_tag_filters=allowed-to-fail +``` + +## Making Changes to Go Code + +The Go source lives in `cmd/` (CLI binary) and `pkg/` (library packages). + +### Workflow + +1. **Make your code changes** in the relevant `cmd/` or `pkg/` package. + +2. **Format your code**: + ```sh + bazel run @rules_go//go -- fmt ./... + ``` + +3. **Regenerate BUILD files** with Gazelle. Bazel BUILD files for Go packages + are managed by Gazelle, so any new files, packages, or import changes + require updating them: + ```sh + bazel run //:gazelle + ``` + +4. **Run unit tests** to verify your changes: + ```sh + bazel test //... + ``` + +### Adding a New Go Package + +If you add a new package under `pkg/` or `cmd/`: + +1. Create the directory and add your `.go` files. +2. Run Gazelle to auto-generate the `BUILD.bazel` file: + ```sh + bazel run //:gazelle + ``` + Gazelle will create the `go_library`, `go_test`, and/or `go_binary` targets + automatically based on your source files. + +### Unit Tests + +Go tests use [gomega](https://onsi.github.io/gomega/) for assertions. Place +test files (`*_test.go`) alongside the code they test. Gazelle will +automatically include them in the generated `go_test` targets. + +## Adding New Go Dependencies + +Go dependencies are managed with standard Go modules and synced to Bazel via +Gazelle and bzlmod. + +1. **Add the dependency**: + ```sh + bazel run @rules_go//go -- get github.com/example/newdep@latest + ``` + This updates `go.mod` and `go.sum`. + +2. **Sync bzlmod `use_repo` declarations**: + ```sh + bazel mod tidy + ``` + This automatically updates the `use_repo` calls in `MODULE.bazel`. + +3. **Regenerate BUILD files**: + ```sh + bazel run //:gazelle + ``` + +4. **Verify the build**: + ```sh + bazel build //... + bazel test //... + ``` + +## Adding New Bazel Dependencies + +Bazel module dependencies are managed in `MODULE.bazel` using bzlmod. + +1. **Add the `bazel_dep`** to `MODULE.bazel`: + ```python + # Use dev_dependency = True if only needed for development/testing + bazel_dep(name = "rules_foo", version = "1.2.3", dev_dependency = True) + ``` + +2. **Sync `use_repo` declarations**: + ```sh + bazel mod tidy + ``` + +3. **Run Gazelle** if the new dependency provides Starlark libraries that + Gazelle should be aware of: + ```sh + bazel run //:gazelle + ``` + +4. **Verify everything builds**: + ```sh + bazel build //... + ``` + +### Dependency Categories + +In `MODULE.bazel`, dependencies are organized as: + +- **Runtime dependencies** (not `dev_dependency`): required by users of + bazeldnf (e.g., `bazel_skylib`, `platforms`, `bazel_features`, `bazel_lib`). + Be conservative adding non-dev dependencies as they affect all consumers. +- **Toolchain build dependencies**: `gazelle` and `rules_go`, needed when + building the toolchain from source. +- **Dev dependencies** (`dev_dependency = True`): only used within this repo + for building, testing, and linting (e.g., `buildifier_prebuilt`, + `rules_bazel_integration_test`). + +## Making Starlark Changes + +Starlark (`.bzl`) files define the Bazel rules, macros, and extensions that +users interact with. + +### File Organization + +| Directory | Purpose | +|---|---| +| `bazeldnf/defs.bzl` | Public API facade (re-exports all user-facing rules) | +| `bazeldnf/extensions.bzl` | Bzlmod module extensions (`bazeldnf_toolchain`, `bazeldnf`) | +| `bazeldnf/toolchain.bzl` | Toolchain rule definition | +| `bazeldnf/repositories.bzl` | WORKSPACE-mode setup functions | +| `bazeldnf/private/` | Private implementation details (lock file helpers, repo rules) | +| `internal/` | Rule implementations (`rpm.bzl`, `rpmtree.bzl`, `bazeldnf.bzl`, `xattrs.bzl`) | + +### Workflow + +1. **Make your `.bzl` changes**. + +2. **Format with buildifier**: + ```sh + bazel run //:buildifier + ``` + +3. **Run Gazelle** to update any `bzl_library` targets if you added or renamed + `.bzl` files: + ```sh + bazel run //:gazelle + ``` + +4. **Run unit tests and e2e tests** to verify nothing is broken: + ```sh + bazel test //... + bazel test e2e + ``` + +### Tips + +- When modifying user-facing rules in `internal/`, update the re-exports in + `bazeldnf/defs.bzl` if adding new symbols. +- If you change the module extension in `bazeldnf/extensions.bzl`, test with + both the lock-file and non-lock-file e2e workspaces. +- The `internal/runner.bash.template` is used to generate runner scripts for + the `bazeldnf` runnable rule. + +## End-to-End Tests + +E2E tests use +[rules_bazel_integration_test](https://github.com/bazel-contrib/rules_bazel_integration_test) +to spin up isolated Bazel workspaces and verify that bazeldnf works correctly +across different Bazel versions and configurations. + +### Existing E2E Test Suites + +| Suite | Directory | Description | +|---|---|---| +| `e2e:bzlmod` | `e2e/bazel-bzlmod/` | Basic bzlmod with prebuilt toolchain | +| `e2e:bzlmod-lock-file` | `e2e/bazel-bzlmod-lock-file/` | Bzlmod with lock file workflow | +| `e2e:bzlmod-toolchain-from-source` | `e2e/bazel-bzlmod-toolchain-from-source/` | Toolchain built from Go source | +| `e2e:lock-file-from-args` | `e2e/bazel-bzlmod-lock-file-from-args/` | Lock file generated from CLI args | +| `e2e:circular-deps` | `e2e/bzlmod-toolchain-circular-dependencies/` | Circular RPM dependency handling | +| `e2e:repo-yaml` | `e2e/repo-yaml/` | CLI `init`/`fetch`/`resolve` workflow | + +### Running E2E Tests + +```sh +# Run all e2e tests +bazel test e2e + +# Run a specific suite +bazel test e2e:bzlmod +bazel test e2e:bzlmod-lock-file +``` + +### Adding a New E2E Test + +#### 1. Create the Workspace Directory + +Create a new directory under `e2e/` with the files for your test workspace: + +``` +e2e/my-new-test/ +├── MODULE.bazel # Module definition, references parent +├── BUILD.bazel # Build targets that exercise your scenario +└── .bazelrc # Required, see below +``` + +#### 2. Update `.bazelignore` and Deleted Packages + +Since e2e workspaces are nested Bazel projects, you must prevent the parent +workspace from traversing into their Bazel output directories, and update the +`--deleted_packages` flags so the parent doesn't treat child `BUILD` files as +its own packages. + +1. **Add `bazel-*` output symlinks to `.bazelignore`**. Append entries for your + new workspace (follow the pattern of existing entries): + ``` + e2e/my-new-test/bazel-bin + e2e/my-new-test/bazel-out + e2e/my-new-test/bazel-my-new-test + e2e/my-new-test/bazel-testlogs + ``` + +2. **Regenerate `--deleted_packages` flags**: + ```sh + bazel run @rules_bazel_integration_test//tools:update_deleted_packages + ``` + This updates the `.bazelrc` files with the correct `--deleted_packages` + entries so the parent workspace ignores `BUILD` files inside child + workspaces. + +#### 3. Create `.bazelrc` + +Every e2e workspace needs a `.bazelrc` that imports shared configs from the +parent repository: + +``` +# Import Aspect bazelrc presets +import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc + +# Include our e2e shared config +import %workspace%/../.bazelrc + +# Specific project flags go here if needed + +# Load any settings & overrides specific to the current user from `.bazelrc.user`. +# This file should appear in `.gitignore` so that settings are not shared with team members. This +# should be last statement in this config so the user configuration is able to overwrite flags from +# this file. See https://bazel.build/configure/best-practices#bazelrc-file. +try-import %workspace%/../../.bazelrc.user +``` + +#### 4. Set Up MODULE.bazel + +Your test workspace must reference the parent repository using +`local_path_override` so that it uses the local (in-development) version of +bazeldnf: + +```python +module(name = "my-new-test") + +bazel_dep(name = "bazeldnf") +local_path_override( + module_name = "bazeldnf", + path = "../..", +) + +# Use bazeldnf extensions as needed +bazeldnf = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf") +# ... configure RPMs, lock files, etc. +``` + +#### 5. Create BUILD Targets + +In your test workspace's `BUILD.bazel`, use the bazeldnf rules to set up the +scenario you want to test: + +```python +load("@bazeldnf//bazeldnf:defs.bzl", "bazeldnf", "rpmtree", "tar2files") + +bazeldnf(name = "bazeldnf") + +rpmtree( + name = "my_rpms", + rpms = ["@some-rpm//rpm"], +) +``` + +#### 6. Register the Test in `e2e/BUILD.bazel` + +Add the integration test definition to `e2e/BUILD.bazel`. Use the existing +`:test-runner` which runs `bazel --nohome_rc build //...` inside the workspace: + +```python +bazel_integration_tests( + name = "e2e_my_new_test", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = BZLMOD_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS, + test_runner = ":test-runner", + workspace_files = glob_workspace_files("my-new-test") + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "my-new-test", +) +``` + +If you're developing a new feature which isn't fully ready yet, but it doesn't +add regressions, then you can add `['allowed-to-fail']` to your tags, this will +allow your new feature to be merged incrementally and making the reviewing +process easier. + +If your test needs to run commands beyond `build //...` (e.g., running +`fetch` or `resolve` before building), define a custom test runner: + +```python +default_test_runner( + name = "my-test-runner", + bazel_cmds = [ + "run :bazeldnf -- fetch --cache-dir $(pwd)/.bazeldnf", + "build //...", + ], +) +``` + +#### 7. Add a Test Suite + +Add a test suite so the test can be run by name: + +```python +test_suite( + name = "my-new-test", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = integration_test_utils.bazel_integration_test_names( + "e2e_my_new_test", + BZLMOD_BAZEL_VERSIONS, + ), +) +``` + +In the case you needed to add `allowed-to-fail` to the test tags also add it here. + +And include it in the top-level `e2e` test suite: + +```python +test_suite( + name = "e2e", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = [ + # ... existing suites ... + ":my-new-test", + ], +) +``` + +#### 8. Expose Parent Files + +If your test workspace depends on parent files not already included in +`//:local_repository_files` (defined in the root `BUILD.bazel`), add them to +that filegroup. Each package that needs to be visible must have: + +```python +filegroup( + name = "all_files", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) +``` + +#### 9. Verify Everything + +Run your new test to make sure it passes: + +```sh +bazel test e2e:my-new-test +``` + +In the case your tests are allowed to fail then you do + +```sh +bazel test e2e:my-new-test --test_tag_filters=allowed-to-fail +``` + +### Key Concepts for E2E Tests + +- **`local_path_override`**: each child workspace references the parent repo at + `../..`, so it always tests the local development version of bazeldnf. +- **`//:local_repository_files`**: a filegroup in the root `BUILD.bazel` that + aggregates all parent workspace files needed by e2e workspaces. The + integration test framework copies these into the test sandbox. +- **`glob_workspace_files`**: a helper in `e2e/helpers.bzl` that globs all + files in a workspace directory, excluding Bazel output directories + (`bazel-*`) and `MODULE.bazel.lock` files. +- **`--nohome_rc`**: all test runners automatically prepend this flag to + prevent the host's `~/.bazelrc` from interfering with tests. +- **Bazel versions**: bzlmod tests run against `BZLMOD_BAZEL_VERSIONS` (7.6.0, + 8.1.0). + +## Formatting and Linting + +All formatting checks run in CI. Make sure they pass before submitting: + +```sh +# Check Starlark/BUILD formatting (CI runs this) +bazel run //:buildifier.check + +# Check BUILD files are up-to-date (CI runs this) +bazel run //:gazelle.check + +# Auto-fix Starlark formatting +bazel run //:buildifier + +# Regenerate BUILD files +bazel run //:gazelle + +# Format Go code +bazel run @rules_go//go -- fmt ./... +``` + +## CI + +GitHub Actions runs on every push and PR to `main`: + +1. **Linter** (`linter.yaml`): checks buildifier and gazelle formatting. +2. **Main CI** (`action.yml`): builds everything, runs unit tests, then runs + all e2e test suites. +3. **Allowed-to-fail** (`allowed-to-fail.yml`): runs e2e tests tagged as + `allowed-to-fail` (currently the circular dependency tests) and posts a PR + comment if they fail, without blocking the PR. + +## Quick Reference + +| Task | Command | +|---|---| +| Build everything | `bazel build //...` | +| Run unit tests | `bazel test //...` | +| Run all e2e tests | `bazel test e2e` | +| Run specific e2e suite | `bazel test e2e:` | +| Format Go code | `bazel run @rules_go//go -- fmt ./...` | +| Add Go dependency | `bazel run @rules_go//go -- get github.com/...@latest` | +| Sync module repos | `bazel mod tidy` | +| Format Starlark/BUILD | `bazel run //:buildifier` | +| Regenerate BUILD files | `bazel run //:gazelle` | +| Check Starlark formatting | `bazel run //:buildifier.check` | +| Check BUILD files | `bazel run //:gazelle.check` | diff --git a/MODULE.bazel b/MODULE.bazel index 668ced83..f575ad6c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -88,11 +88,31 @@ use_repo( "bazeldnf_internal_libvirt-libs", ) -bazel_dep(name = "protobuf", version = "33.5", dev_dependency = True) - # deps only needed for the repo internals +bazel_dep(name = "protobuf", version = "33.5", dev_dependency = True) bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.9.0", dev_dependency = True) bazel_dep(name = "aspect_bazel_lib", version = "2.22.5", dev_dependency = True) bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.2", dev_dependency = True) bazel_dep(name = "rules_pkg", version = "1.2.0", dev_dependency = True) bazel_dep(name = "rules_cc", version = "0.2.16", dev_dependency = True) + +# e2e / integration testing +bazel_dep(name = "rules_shell", version = "0.6.1", dev_dependency = True) +bazel_dep(name = "rules_bazel_integration_test", version = "0.37.1", dev_dependency = True) + +bazel_binaries = use_extension( + "@rules_bazel_integration_test//:extensions.bzl", + "bazel_binaries", + dev_dependency = True, +) +bazel_binaries.download(version = "6.5.0") +bazel_binaries.download(version = "7.6.0") +bazel_binaries.download(version = "8.1.0") +use_repo( + bazel_binaries, + "bazel_binaries", + "bazel_binaries_bazelisk", + "build_bazel_bazel_6_5_0", + "build_bazel_bazel_7_6_0", + "build_bazel_bazel_8_1_0", +) diff --git a/Makefile b/Makefile index 5904670d..df20d4a1 100644 --- a/Makefile +++ b/Makefile @@ -16,66 +16,25 @@ gofmt: gofmt -w pkg/.. cmd/.. e2e-workspace: - @for version in 6.x 7.x; do \ - ( \ - cd e2e/bazel-workspace && \ - echo "Testing $$version in workspace mode" > /dev/stderr && \ - USE_BAZEL_VERSION=$$version bazelisk --batch build //...\ - ) \ - done + bazel test e2e:workspace e2e-bzlmod: - @for version in 7.x 8.x; do \ - ( \ - cd e2e/bazel-bzlmod && \ - echo "Testing $$version with bzlmod" > /dev/stderr && \ - USE_BAZEL_VERSION=$$version bazelisk --batch build //...\ - ) \ - done + bazel test e2e:bzlmod e2e-bazel-bzlmod-lock-file: - @for version in 7.x 8.x; do \ - ( \ - cd e2e/bazel-bzlmod-lock-file && \ - echo "Testing $$version with bzlmod with lock file" > /dev/stderr && \ - USE_BAZEL_VERSION=$$version bazelisk --batch build //...\ - ) \ - done + bazel test e2e:bzlmod-lock-file e2e-bzlmod-build-toolchain: - @for version in 7.x 8.x; do \ - ( \ - cd e2e/bazel-bzlmod-toolchain-from-source && \ - echo "Testing $$version with bzlmod build toolchain" > /dev/stderr && \ - USE_BAZEL_VERSION=$$version bazelisk --batch build //... --incompatible_enable_proto_toolchain_resolution \ - ) \ - done + bazel test e2e:bzlmod-toolchain-from-source e2e-bazel-bzlmod-lock-file-from-args: - @for version in 7.x 8.x; do \ - ( \ - cd e2e/bazel-bzlmod-lock-file-from-args && \ - echo "Testing $$version bzlmod lock file from args" > /dev/stderr && \ - USE_BAZEL_VERSION=$$version bazelisk --batch build //... --incompatible_enable_proto_toolchain_resolution \ - ) \ - done + bazel test e2e:lock-file-from-args e2e-bzlmod-toolchain-circular-dependencies: - @for version in 7.x 8.x; do \ - ( \ - cd e2e/bzlmod-toolchain-circular-dependencies && \ - echo "Testing $$version bzlmod lock file from args" > /dev/stderr && \ - USE_BAZEL_VERSION=$$version bazelisk --batch build //... --incompatible_enable_proto_toolchain_resolution \ - ) \ - done + bazel test e2e:circular-deps - -e2e: e2e-workspace \ - e2e-bzlmod \ - e2e-bzlmod-build-toolchain \ - e2e-bazel-bzlmod-lock-file \ - e2e-bazel-bzlmod-lock-file-from-args \ - e2e-bzlmod-toolchain-circular-dependencies +e2e: + bazel test e2e fmt: gofmt buildifier diff --git a/REPO.bazel b/REPO.bazel new file mode 100644 index 00000000..5a2968d0 --- /dev/null +++ b/REPO.bazel @@ -0,0 +1,6 @@ +"list of directories the top level bazel shouldn't dive into" + +ignore_directories([ + ".git", + "e2e/*/bazel-*", +]) diff --git a/bazeldnf/BUILD.bazel b/bazeldnf/BUILD.bazel index 9095fd50..cdc0950f 100644 --- a/bazeldnf/BUILD.bazel +++ b/bazeldnf/BUILD.bazel @@ -1,6 +1,12 @@ load("@bazel_lib//:bzl_library.bzl", "bzl_library") load("//bazeldnf/private:resolved_bazeldnf_toolchain.bzl", "resolved_bazeldnf_toolchain") +filegroup( + name = "all_files", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) + # this directory contains the public API from bazeldnf, anything on this directory # should be buildable withtout dev dependencies # diff --git a/bazeldnf/private/BUILD.bazel b/bazeldnf/private/BUILD.bazel index c7026ace..d6011e9b 100644 --- a/bazeldnf/private/BUILD.bazel +++ b/bazeldnf/private/BUILD.bazel @@ -1,5 +1,11 @@ load("@bazel_lib//:bzl_library.bzl", "bzl_library") +filegroup( + name = "all_files", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) + bzl_library( name = "toolchains_repo", srcs = ["toolchains_repo.bzl"], diff --git a/e2e/.bazelrc b/e2e/.bazelrc new file mode 100644 index 00000000..f17acd97 --- /dev/null +++ b/e2e/.bazelrc @@ -0,0 +1,12 @@ +# if running in GitHub actions with setup-bazel then we need to ignore output_base +# our workflow creates this clean bazelrc file for us +try-import ~/.bazelrc.clean + +# make sure all our tests use the prebuilt toolchain +common --extra_toolchains=@bazeldnf//tools/e2e/output:toolchain + +# Include most of the suggested flags from aspect +import %workspace%/../../.aspect/bazelrc/convenience.bazelrc +import %workspace%/../../.aspect/bazelrc/correctness.bazelrc +import %workspace%/../../.aspect/bazelrc/debug.bazelrc +import %workspace%/../../.aspect/bazelrc/performance.bazelrc diff --git a/e2e/BUILD.bazel b/e2e/BUILD.bazel new file mode 100644 index 00000000..6effc98f --- /dev/null +++ b/e2e/BUILD.bazel @@ -0,0 +1,276 @@ +load("@bazel_binaries//:defs.bzl", "bazel_binaries") +load( + "@rules_bazel_integration_test//bazel_integration_test:defs.bzl", + "bazel_integration_tests", + "integration_test_utils", +) +load("helpers.bzl", "default_test_runner", "glob_workspace_files") + +WORKSPACE_BAZEL_VERSIONS = [ + "6.5.0", + "7.6.0", +] + +BZLMOD_BAZEL_VERSIONS = [ + "7.6.0", + "8.1.0", +] + +DEFAULT_TIMEOUT = "moderate" + +default_test_runner( + name = "test-runner", + bazel_cmds = ["build //..."], +) + +DEFAULT_TEST_TAGS = [ + "manual", + "requires-network", +] + +# bazel-workspace: legacy WORKSPACE mode (Bazel 6.x, 7.x) +bazel_integration_tests( + name = "e2e_workspace", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = WORKSPACE_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS, + test_runner = ":test-runner", + workspace_files = glob_workspace_files( + "bazel-workspace", + extra_excludes = ["*/*.json"], + ) + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "bazel-workspace", +) + +# bazel-bzlmod: basic bzlmod with prebuilt toolchain +bazel_integration_tests( + name = "e2e_bzlmod", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = BZLMOD_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS, + test_runner = ":test-runner", + workspace_files = glob_workspace_files( + "bazel-bzlmod", + extra_excludes = ["*/*.json"], + ) + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "bazel-bzlmod", +) + +# bazel-bzlmod-lock-file: bzlmod with lock files +bazel_integration_tests( + name = "e2e_bzlmod_lock_file", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = BZLMOD_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS, + test_runner = ":test-runner", + workspace_files = glob_workspace_files("bazel-bzlmod-lock-file") + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "bazel-bzlmod-lock-file", +) + +# bazel-bzlmod-toolchain-from-source: toolchain built from source +bazel_integration_tests( + name = "e2e_bzlmod_toolchain_from_source", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = BZLMOD_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS, + test_runner = ":test-runner", + workspace_files = glob_workspace_files( + "bazel-bzlmod-toolchain-from-source", + extra_excludes = ["*/*.json"], + ) + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "bazel-bzlmod-toolchain-from-source", +) + +# bazel-bzlmod-toolchain-from-source-lock-file: toolchain from source with lock file +bazel_integration_tests( + name = "e2e_bzlmod_toolchain_from_source_lock_file", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = BZLMOD_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS, + test_runner = ":test-runner", + workspace_files = glob_workspace_files( + "bazel-bzlmod-toolchain-from-source-lock-file", + extra_excludes = ["*/*.json"], + ) + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "bazel-bzlmod-toolchain-from-source-lock-file", +) + +default_test_runner( + name = "lock-file-from-args-runner", + bazel_cmds = [ + "run :bazeldnf -- fetch --cache-dir $(pwd)/.bazeldnf", + "run @bazeldnf_rpms//:update-lock-file -- --cache-dir $(pwd)/.bazeldnf", + "build //...", + ], +) + +bazel_integration_tests( + name = "e2e_lock_file_from_args", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = BZLMOD_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS, + test_runner = ":lock-file-from-args-runner", + workspace_files = glob_workspace_files( + "bazel-bzlmod-lock-file-from-args", + extra_excludes = ["*/*.json"], + ) + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "bazel-bzlmod-lock-file-from-args", +) + +default_test_runner( + name = "test-runner-circular-deps", + bazel_cmds = [ + "run @bazeldnf_rpms//:fetch-repo -- --cache-dir $(pwd)/.bazeldnf", + "run @bazeldnf_rpms//:update-lock-file -- --cache-dir $(pwd)/.bazeldnf", + "build //...", + ], +) + +bazel_integration_tests( + name = "e2e_circular_deps", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = BZLMOD_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS + [ + "allowed-to-fail", # TODO: drop once the circular dependencies passes + ], + test_runner = ":test-runner-circular-deps", + workspace_files = glob_workspace_files( + "bzlmod-toolchain-circular-dependencies", + extra_excludes = ["*/*.json"], + ) + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "bzlmod-toolchain-circular-dependencies", +) + +default_test_runner( + name = "test-runner-repo-yaml", + bazel_cmds = [ + "run :bazeldnf -- init --fc 44 --output $(pwd)/repo.yaml", + "run :bazeldnf -- fetch --repofile $(pwd)/repo.yaml --cache-dir $(pwd)/.bazeldnf", + "run :bazeldnf -- resolve --repofile $(pwd)/repo.yaml --cache-dir $(pwd)/.bazeldnf bash", + ], +) + +bazel_integration_tests( + name = "e2e_repo_yaml", + timeout = DEFAULT_TIMEOUT, + bazel_binaries = bazel_binaries, + bazel_versions = BZLMOD_BAZEL_VERSIONS, + tags = DEFAULT_TEST_TAGS, + test_runner = ":test-runner-repo-yaml", + workspace_files = glob_workspace_files("repo-yaml") + [ + ".bazelrc", + "//:local_repository_files", + ], + workspace_path = "repo-yaml", +) + +DEFAULT_TEST_SUITE_TAGS = ["manual"] + +test_suite( + name = "workspace", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = integration_test_utils.bazel_integration_test_names( + "e2e_workspace", + WORKSPACE_BAZEL_VERSIONS, + ), +) + +test_suite( + name = "bzlmod", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = integration_test_utils.bazel_integration_test_names( + "e2e_bzlmod", + BZLMOD_BAZEL_VERSIONS, + ), +) + +test_suite( + name = "bzlmod-lock-file", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = integration_test_utils.bazel_integration_test_names( + "e2e_bzlmod_lock_file", + BZLMOD_BAZEL_VERSIONS, + ), +) + +test_suite( + name = "bzlmod-toolchain-from-source", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = integration_test_utils.bazel_integration_test_names( + "e2e_bzlmod_toolchain_from_source", + BZLMOD_BAZEL_VERSIONS, + ), +) + +test_suite( + name = "circular-deps", + tags = DEFAULT_TEST_SUITE_TAGS + [ + "allowed-to-fail", # TODO: drop once the circular dependencies passes + ], + tests = integration_test_utils.bazel_integration_test_names( + "e2e_circular_deps", + BZLMOD_BAZEL_VERSIONS, + ), +) + +test_suite( + name = "lock-file-from-args", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = integration_test_utils.bazel_integration_test_names( + "e2e_lock_file_from_args", + BZLMOD_BAZEL_VERSIONS, + ), +) + +test_suite( + name = "repo-yaml", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = integration_test_utils.bazel_integration_test_names( + "e2e_repo_yaml", + BZLMOD_BAZEL_VERSIONS, + ), +) + +test_suite( + name = "e2e", + tags = DEFAULT_TEST_SUITE_TAGS, + tests = [ + ":bzlmod", + ":bzlmod-lock-file", + ":bzlmod-toolchain-from-source", + ":circular-deps", + ":lock-file-from-args", + ":repo-yaml", + ":workspace", + ], +) + +# gazelle:exclude helpers.bzl diff --git a/e2e/bazel-bzlmod-lock-file-from-args/.bazelrc b/e2e/bazel-bzlmod-lock-file-from-args/.bazelrc index 6b6c94e8..f9d74810 100644 --- a/e2e/bazel-bzlmod-lock-file-from-args/.bazelrc +++ b/e2e/bazel-bzlmod-lock-file-from-args/.bazelrc @@ -1,16 +1,11 @@ # Import Aspect bazelrc presets -try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc -import %workspace%/../../.aspect/bazelrc/convenience.bazelrc -import %workspace%/../../.aspect/bazelrc/correctness.bazelrc -import %workspace%/../../.aspect/bazelrc/debug.bazelrc -import %workspace%/../../.aspect/bazelrc/performance.bazelrc +import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc + +# Include our e2e shared config +try-import %workspace%/../.bazelrc # Specific project flags go here if we have some common --enable_bzlmod -common --extra_toolchains=@bazeldnf//cmd:bazeldnf-host-toolchain - -# prebuilt protoc -common --incompatible_enable_proto_toolchain_resolution # Load any settings & overrides specific to the current user from `.bazelrc.user`. # This file should appear in `.gitignore` so that settings are not shared with team members. This diff --git a/e2e/bazel-bzlmod-lock-file-from-args/MODULE.bazel b/e2e/bazel-bzlmod-lock-file-from-args/MODULE.bazel index e5b1f6ba..2c4e7cee 100644 --- a/e2e/bazel-bzlmod-lock-file-from-args/MODULE.bazel +++ b/e2e/bazel-bzlmod-lock-file-from-args/MODULE.bazel @@ -9,32 +9,6 @@ local_path_override( ) bazel_dep(name = "rules_pkg", version = "1.1.0") -bazel_dep(name = "rules_go", version = "0.59.0", repo_name = "rules_go") - -go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") -go_sdk.download(version = "1.24.1") - -bazel_dep(name = "gazelle", version = "0.47.0") - -go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") -go_deps.from_file(go_mod = "@bazeldnf//:go.mod") -use_repo( - go_deps, - "com_github_adrg_xdg", - "com_github_bazelbuild_buildtools", - "com_github_crillab_gophersat", - "com_github_hashicorp_go_retryablehttp", - "com_github_jdx_go_netrc", - "com_github_klauspost_compress", - "com_github_onsi_gomega", - "com_github_sassoftware_go_rpmutils", - "com_github_sirupsen_logrus", - "com_github_spf13_cobra", - "com_github_ulikunitz_xz", - "io_k8s_sigs_yaml", - "org_golang_x_crypto", - "org_golang_x_exp", -) bazeldnf_toolchain = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf_toolchain") bazeldnf_toolchain.register(disable = True) @@ -64,13 +38,3 @@ use_repo( bazeldnf, "bazeldnf_rpms", ) - -bazel_dep(name = "toolchains_protoc", version = "0.6.0", dev_dependency = True) - -protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc", dev_dependency = True) -use_repo(protoc, "toolchains_protoc_hub") - -register_toolchains( - "@toolchains_protoc_hub//:all", - dev_dependency = True, -) diff --git a/e2e/bazel-bzlmod-lock-file-from-args/repo.yaml b/e2e/bazel-bzlmod-lock-file-from-args/repo.yaml index 5948bff3..b5e68978 100644 --- a/e2e/bazel-bzlmod-lock-file-from-args/repo.yaml +++ b/e2e/bazel-bzlmod-lock-file-from-args/repo.yaml @@ -1,9 +1,9 @@ repositories: - arch: x86_64 - metalink: https://mirrors.fedoraproject.org/metalink?repo=fedora-40&arch=x86_64 - name: 40-x86_64-primary-repo + metalink: https://mirrors.fedoraproject.org/metalink?repo=fedora-44&arch=x86_64 + name: 44-x86_64-primary-repo - arch: x86_64 metalink: https://mirrors.fedoraproject.org/metalink?repo=updates-released-f40&arch=x86_64 name: 40-x86_64-update-repo exclude: - - ^libzstd \ No newline at end of file + - ^libzstd diff --git a/e2e/bazel-bzlmod-lock-file/.bazelrc b/e2e/bazel-bzlmod-lock-file/.bazelrc index 0b8b0486..154119a1 100644 --- a/e2e/bazel-bzlmod-lock-file/.bazelrc +++ b/e2e/bazel-bzlmod-lock-file/.bazelrc @@ -1,12 +1,10 @@ # Import Aspect bazelrc presets -try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc -import %workspace%/../../.aspect/bazelrc/convenience.bazelrc -import %workspace%/../../.aspect/bazelrc/correctness.bazelrc -import %workspace%/../../.aspect/bazelrc/debug.bazelrc -import %workspace%/../../.aspect/bazelrc/performance.bazelrc +import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc + +# Include our e2e shared config +try-import %workspace%/../.bazelrc common --enable_bzlmod -common --extra_toolchains=@bazeldnf//cmd:bazeldnf-host-toolchain # Specific project flags go here if we have some diff --git a/e2e/bazel-bzlmod-lock-file/MODULE.bazel b/e2e/bazel-bzlmod-lock-file/MODULE.bazel index 8774e88a..2b81ef9d 100644 --- a/e2e/bazel-bzlmod-lock-file/MODULE.bazel +++ b/e2e/bazel-bzlmod-lock-file/MODULE.bazel @@ -9,46 +9,9 @@ local_path_override( ) bazel_dep(name = "rules_pkg", version = "1.1.0") -bazel_dep(name = "rules_go", version = "0.59.0", repo_name = "rules_go") -go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") -go_sdk.download(version = "1.24.1") - -bazel_dep(name = "gazelle", version = "0.47.0") - -go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") -go_deps.from_file(go_mod = "@bazeldnf//:go.mod") -use_repo( - go_deps, - "com_github_adrg_xdg", - "com_github_bazelbuild_buildtools", - "com_github_crillab_gophersat", - "com_github_hashicorp_go_retryablehttp", - "com_github_jdx_go_netrc", - "com_github_klauspost_compress", - "com_github_onsi_gomega", - "com_github_sassoftware_go_rpmutils", - "com_github_sirupsen_logrus", - "com_github_spf13_cobra", - "com_github_ulikunitz_xz", - "io_k8s_sigs_yaml", - "org_golang_x_crypto", - "org_golang_x_exp", -) - -bazel_dep(name = "toolchains_protoc", version = "0.6.0") - -protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc") -protoc.toolchain( - google_protobuf = "com_google_protobuf", - version = "v27.3", -) -use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub") - -register_toolchains( - "@toolchains_protoc_hub//:all", - dev_dependency = True, -) +bazeldnf_toolchain = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf_toolchain") +bazeldnf_toolchain.register(disable = True) bazeldnf = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf") bazeldnf.config( diff --git a/e2e/bazel-bzlmod-toolchain-from-source-lock-file/.bazelrc b/e2e/bazel-bzlmod-toolchain-from-source-lock-file/.bazelrc index b54eb05e..f9d74810 100644 --- a/e2e/bazel-bzlmod-toolchain-from-source-lock-file/.bazelrc +++ b/e2e/bazel-bzlmod-toolchain-from-source-lock-file/.bazelrc @@ -1,17 +1,11 @@ # Import Aspect bazelrc presets -try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc -import %workspace%/../../.aspect/bazelrc/bazel6.bazelrc -import %workspace%/../../.aspect/bazelrc/convenience.bazelrc -import %workspace%/../../.aspect/bazelrc/correctness.bazelrc -import %workspace%/../../.aspect/bazelrc/debug.bazelrc -import %workspace%/../../.aspect/bazelrc/performance.bazelrc +import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc + +# Include our e2e shared config +try-import %workspace%/../.bazelrc # Specific project flags go here if we have some common --enable_bzlmod -common --extra_toolchains=@bazeldnf//cmd:bazeldnf-host-toolchain - -# prebuilt protoc -common --incompatible_enable_proto_toolchain_resolution # Load any settings & overrides specific to the current user from `.bazelrc.user`. # This file should appear in `.gitignore` so that settings are not shared with team members. This diff --git a/e2e/bazel-bzlmod-toolchain-from-source-lock-file/MODULE.bazel b/e2e/bazel-bzlmod-toolchain-from-source-lock-file/MODULE.bazel index a474b152..feb786db 100644 --- a/e2e/bazel-bzlmod-toolchain-from-source-lock-file/MODULE.bazel +++ b/e2e/bazel-bzlmod-toolchain-from-source-lock-file/MODULE.bazel @@ -9,7 +9,6 @@ local_path_override( ) bazel_dep(name = "rules_pkg", version = "1.1.0") -bazel_dep(name = "toolchains_protoc", version = "0.6.0") bazeldnf = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf") bazeldnf.toolchain(disable = True) diff --git a/e2e/bazel-bzlmod-toolchain-from-source/.bazelrc b/e2e/bazel-bzlmod-toolchain-from-source/.bazelrc index 449a334f..f9d74810 100644 --- a/e2e/bazel-bzlmod-toolchain-from-source/.bazelrc +++ b/e2e/bazel-bzlmod-toolchain-from-source/.bazelrc @@ -1,14 +1,11 @@ # Import Aspect bazelrc presets -try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc -import %workspace%/../../.aspect/bazelrc/convenience.bazelrc -import %workspace%/../../.aspect/bazelrc/correctness.bazelrc -import %workspace%/../../.aspect/bazelrc/debug.bazelrc -import %workspace%/../../.aspect/bazelrc/performance.bazelrc +import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc + +# Include our e2e shared config +try-import %workspace%/../.bazelrc # Specific project flags go here if we have some common --enable_bzlmod -common --extra_toolchains=@bazeldnf//cmd:bazeldnf-host-toolchain -common --incompatible_enable_proto_toolchain_resolution # Load any settings & overrides specific to the current user from `.bazelrc.user`. # This file should appear in `.gitignore` so that settings are not shared with team members. This diff --git a/e2e/bazel-bzlmod-toolchain-from-source/MODULE.bazel b/e2e/bazel-bzlmod-toolchain-from-source/MODULE.bazel index f2d58a37..79a366f7 100644 --- a/e2e/bazel-bzlmod-toolchain-from-source/MODULE.bazel +++ b/e2e/bazel-bzlmod-toolchain-from-source/MODULE.bazel @@ -9,45 +9,6 @@ local_path_override( ) bazel_dep(name = "rules_pkg", version = "1.1.0") -bazel_dep(name = "rules_go", version = "0.59.0", repo_name = "rules_go") - -go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") -go_sdk.download(version = "1.24.1") - -bazel_dep(name = "gazelle", version = "0.47.0") -bazel_dep(name = "toolchains_protoc", version = "0.6.0") - -protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc") -protoc.toolchain( - google_protobuf = "com_google_protobuf", - version = "v27.3", -) -use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub") - -register_toolchains( - "@toolchains_protoc_hub//:all", - dev_dependency = True, -) - -go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") -go_deps.from_file(go_mod = "@bazeldnf//:go.mod") -use_repo( - go_deps, - "com_github_adrg_xdg", - "com_github_bazelbuild_buildtools", - "com_github_crillab_gophersat", - "com_github_hashicorp_go_retryablehttp", - "com_github_jdx_go_netrc", - "com_github_klauspost_compress", - "com_github_onsi_gomega", - "com_github_sassoftware_go_rpmutils", - "com_github_sirupsen_logrus", - "com_github_spf13_cobra", - "com_github_ulikunitz_xz", - "io_k8s_sigs_yaml", - "org_golang_x_crypto", - "org_golang_x_exp", -) bazeldnf_toolchain = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf_toolchain") bazeldnf_toolchain.register(disable = True) diff --git a/e2e/bazel-bzlmod/.bazelrc b/e2e/bazel-bzlmod/.bazelrc index 6d22ade3..154119a1 100644 --- a/e2e/bazel-bzlmod/.bazelrc +++ b/e2e/bazel-bzlmod/.bazelrc @@ -1,9 +1,8 @@ # Import Aspect bazelrc presets -try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc -import %workspace%/../../.aspect/bazelrc/convenience.bazelrc -import %workspace%/../../.aspect/bazelrc/correctness.bazelrc -import %workspace%/../../.aspect/bazelrc/debug.bazelrc -import %workspace%/../../.aspect/bazelrc/performance.bazelrc +import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc + +# Include our e2e shared config +try-import %workspace%/../.bazelrc common --enable_bzlmod diff --git a/e2e/bazel-bzlmod/MODULE.bazel b/e2e/bazel-bzlmod/MODULE.bazel index 7fa1d898..ab2e8fae 100644 --- a/e2e/bazel-bzlmod/MODULE.bazel +++ b/e2e/bazel-bzlmod/MODULE.bazel @@ -8,6 +8,9 @@ local_path_override( path = "../..", ) +bazeldnf_toolchain = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf_toolchain") +bazeldnf_toolchain.register(disable = True) + bazel_dep(name = "rules_pkg", version = "1.1.0") bazeldnf = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf") diff --git a/e2e/bazel-workspace/.bazelrc b/e2e/bazel-workspace/.bazelrc index 33dee036..a85f3c8a 100644 --- a/e2e/bazel-workspace/.bazelrc +++ b/e2e/bazel-workspace/.bazelrc @@ -1,8 +1,5 @@ -# Import Aspect bazelrc presets -import %workspace%/../../.aspect/bazelrc/convenience.bazelrc -import %workspace%/../../.aspect/bazelrc/correctness.bazelrc -import %workspace%/../../.aspect/bazelrc/debug.bazelrc -import %workspace%/../../.aspect/bazelrc/performance.bazelrc +# Include our e2e shared config +try-import %workspace%/../.bazelrc # Specific project flags go here if we have some diff --git a/e2e/bazel-workspace/WORKSPACE b/e2e/bazel-workspace/WORKSPACE index 2a61e67f..cafc994f 100644 --- a/e2e/bazel-workspace/WORKSPACE +++ b/e2e/bazel-workspace/WORKSPACE @@ -22,15 +22,10 @@ load("@bazeldnf//bazeldnf:defs.bzl", "rpm") load( "@bazeldnf//bazeldnf:repositories.bzl", "bazeldnf_dependencies", - "bazeldnf_register_toolchains", ) bazeldnf_dependencies() -bazeldnf_register_toolchains( - name = "bazeldnf_prebuilt", -) - rpm( name = "libvirt-devel-11.0.0-1.fc42.x86_64.rpm", sha256 = "dba37bbe57903afe49b5666f1781eb50001baa81af4584b355db0b6a2afad9fa", diff --git a/e2e/bzlmod-toolchain-circular-dependencies/.bazelrc b/e2e/bzlmod-toolchain-circular-dependencies/.bazelrc index 6b6c94e8..f9d74810 100644 --- a/e2e/bzlmod-toolchain-circular-dependencies/.bazelrc +++ b/e2e/bzlmod-toolchain-circular-dependencies/.bazelrc @@ -1,16 +1,11 @@ # Import Aspect bazelrc presets -try-import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc -import %workspace%/../../.aspect/bazelrc/convenience.bazelrc -import %workspace%/../../.aspect/bazelrc/correctness.bazelrc -import %workspace%/../../.aspect/bazelrc/debug.bazelrc -import %workspace%/../../.aspect/bazelrc/performance.bazelrc +import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc + +# Include our e2e shared config +try-import %workspace%/../.bazelrc # Specific project flags go here if we have some common --enable_bzlmod -common --extra_toolchains=@bazeldnf//cmd:bazeldnf-host-toolchain - -# prebuilt protoc -common --incompatible_enable_proto_toolchain_resolution # Load any settings & overrides specific to the current user from `.bazelrc.user`. # This file should appear in `.gitignore` so that settings are not shared with team members. This diff --git a/e2e/bzlmod-toolchain-circular-dependencies/MODULE.bazel b/e2e/bzlmod-toolchain-circular-dependencies/MODULE.bazel index 66d0a26a..89519b22 100644 --- a/e2e/bzlmod-toolchain-circular-dependencies/MODULE.bazel +++ b/e2e/bzlmod-toolchain-circular-dependencies/MODULE.bazel @@ -9,45 +9,6 @@ local_path_override( ) bazel_dep(name = "rules_pkg", version = "1.1.0") -bazel_dep(name = "rules_go", version = "0.59.0", repo_name = "rules_go") - -go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") -go_sdk.download(version = "1.24.1") - -bazel_dep(name = "gazelle", version = "0.47.0") -bazel_dep(name = "toolchains_protoc", version = "0.6.0") - -protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc") -protoc.toolchain( - google_protobuf = "com_google_protobuf", - version = "v27.3", -) -use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub") - -register_toolchains( - "@toolchains_protoc_hub//:all", - dev_dependency = True, -) - -go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") -go_deps.from_file(go_mod = "@bazeldnf//:go.mod") -use_repo( - go_deps, - "com_github_adrg_xdg", - "com_github_bazelbuild_buildtools", - "com_github_crillab_gophersat", - "com_github_hashicorp_go_retryablehttp", - "com_github_jdx_go_netrc", - "com_github_klauspost_compress", - "com_github_onsi_gomega", - "com_github_sassoftware_go_rpmutils", - "com_github_sirupsen_logrus", - "com_github_spf13_cobra", - "com_github_ulikunitz_xz", - "io_k8s_sigs_yaml", - "org_golang_x_crypto", - "org_golang_x_exp", -) bazeldnf_toolchain = use_extension("@bazeldnf//bazeldnf:extensions.bzl", "bazeldnf_toolchain") bazeldnf_toolchain.register(disable = True) diff --git a/e2e/helpers.bzl b/e2e/helpers.bzl new file mode 100644 index 00000000..16a38bf5 --- /dev/null +++ b/e2e/helpers.bzl @@ -0,0 +1,44 @@ +"A series of helpers for our e2e infrastructure" + +load("@bazel_skylib//lib:paths.bzl", "paths") +load( + "@rules_bazel_integration_test//bazel_integration_test:defs.bzl", + _default_test_runner = "default_test_runner", +) + +def glob_workspace_files(workspace_path, extra_excludes = []): + """Recursively globs the Bazel workspace files at the specified path. + + Improved from integration_test_utils.glob_workspace_files + + Args: + workspace_path: A `string` representing the path to glob. + extra_excludes: Other glob patterns to ignore + + Returns: + A `list` of the files under the specified path ignoring certain Bazel + artifacts (e.g. `bazel-*`). + """ + return native.glob( + [paths.join(workspace_path, "**", "*")], + exclude = [ + paths.join(workspace_path, "bazel-*", "**"), + paths.join(workspace_path, "MODULE.bazel.lock"), + ] + extra_excludes, + ) + +def default_test_runner(name, bazel_cmds = [], **kwargs): + """GitHub bazel-contrib/setup-bazel action compatible runner + + Args: + name: name of the target + bazel_cmds: list of commands to execute + **kwargs: other arguments to pass to upstream default_test_runner + """ + + bazel_cmds = [ + "--nohome_rc {}".format(x) + for x in bazel_cmds + ] + + _default_test_runner(name = name, bazel_cmds = bazel_cmds, **kwargs) diff --git a/e2e/repo-yaml/.bazelrc b/e2e/repo-yaml/.bazelrc new file mode 100644 index 00000000..f9d74810 --- /dev/null +++ b/e2e/repo-yaml/.bazelrc @@ -0,0 +1,14 @@ +# Import Aspect bazelrc presets +import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc + +# Include our e2e shared config +try-import %workspace%/../.bazelrc + +# Specific project flags go here if we have some +common --enable_bzlmod + +# Load any settings & overrides specific to the current user from `.bazelrc.user`. +# This file should appear in `.gitignore` so that settings are not shared with team members. This +# should be last statement in this config so the user configuration is able to overwrite flags from +# this file. See https://bazel.build/configure/best-practices#bazelrc-file. +try-import %workspace%/../../.bazelrc.user diff --git a/e2e/repo-yaml/BUILD.bazel b/e2e/repo-yaml/BUILD.bazel new file mode 100644 index 00000000..7be258c3 --- /dev/null +++ b/e2e/repo-yaml/BUILD.bazel @@ -0,0 +1,5 @@ +load("@bazeldnf//bazeldnf:defs.bzl", "bazeldnf") + +bazeldnf( + name = "bazeldnf", +) diff --git a/e2e/repo-yaml/MODULE.bazel b/e2e/repo-yaml/MODULE.bazel new file mode 100644 index 00000000..1fc34e95 --- /dev/null +++ b/e2e/repo-yaml/MODULE.bazel @@ -0,0 +1,9 @@ +"example MODULE.bazel to test repo.yaml initialization" + +module(name = "repo-yaml") + +bazel_dep(name = "bazeldnf") +local_path_override( + module_name = "bazeldnf", + path = "../..", +) diff --git a/go.mod b/go.mod index 9c417d7e..4e0ee8a7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/rmohr/bazeldnf -go 1.23.0 +go 1.24.0 toolchain go1.24.1 @@ -12,12 +12,12 @@ require ( github.com/sassoftware/go-rpmutils v0.2.0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.9.1 - golang.org/x/crypto v0.36.0 + golang.org/x/crypto v0.39.0 sigs.k8s.io/yaml v1.4.0 ) require ( - github.com/bazelbuild/rules_go v0.59.0 + github.com/bazelbuild/rules_go v0.60.0 github.com/jdx/go-netrc v1.0.0 ) @@ -30,29 +30,30 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/mock v1.7.0-rc.1 // indirect github.com/segmentio/fasthash v1.0.3 // indirect - golang.org/x/mod v0.24.0 // indirect - golang.org/x/sync v0.12.0 // indirect - golang.org/x/tools v0.31.0 // indirect + golang.org/x/mod v0.25.0 // indirect + golang.org/x/sync v0.15.0 // indirect + golang.org/x/tools v0.34.0 // indirect google.golang.org/genproto v0.0.0-20250115164207-1a7da9e5054f // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422 // indirect - google.golang.org/grpc v1.67.3 // indirect + google.golang.org/genproto/googleapis/bytestream v0.0.0-20251124214823-79d6a2a48846 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 // indirect + google.golang.org/grpc v1.71.0 // indirect google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect ) require ( github.com/adrg/xdg v0.5.3 github.com/golang/protobuf v1.5.4 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/klauspost/compress v1.18.0 github.com/spf13/pflag v1.0.6 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 - golang.org/x/net v0.37.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/text v0.23.0 // indirect - google.golang.org/protobuf v1.36.3 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.26.0 // indirect + google.golang.org/protobuf v1.36.10 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index c16a642c..44514b2c 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ github.com/bazelbuild/rules_go v0.53.0 h1:u160DT+RRb+Xb2aSO4piN8xhs4aZvWz2UDXCq4 github.com/bazelbuild/rules_go v0.53.0/go.mod h1:xB1jfsYHWlnZyPPxzlOSst4q2ZAwS251Mp9Iw6TPuBc= github.com/bazelbuild/rules_go v0.59.0 h1:RLhOwYIqeMgBpKelHEWTfIPjA37so3oa/rX+/qqq/P4= github.com/bazelbuild/rules_go v0.59.0/go.mod h1:Pn30cb4M513fe2rQ6GiJ3q8QyrRsgC7zhuDvi50Lw4Y= +github.com/bazelbuild/rules_go v0.60.0 h1:apGSxTTrFUyLNvX9NQmF4CbntWAO0/S5eALeVgB/6Qk= +github.com/bazelbuild/rules_go v0.60.0/go.mod h1:CYcohJVxs4n7eftbC39GCqaEJm3E1EME+6QAkGguKoI= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/crillab/gophersat v1.4.0 h1:irf9ajKmNnEURjgPU4oz+ouqIXXLQ59ZNd3NC+hULMc= github.com/crillab/gophersat v1.4.0/go.mod h1:gDzeMEBrqJR20IL9JW25tFHNGLU5+GDeJzr0zpi3mxs= @@ -29,6 +31,7 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6 github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -90,6 +93,8 @@ golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -97,6 +102,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -104,12 +111,16 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -119,6 +130,8 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -126,6 +139,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -133,20 +148,30 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20250115164207-1a7da9e5054f h1:387Y+JbxF52bmesc8kq1NyYIp33dnxCw6eiA7JMsTmw= google.golang.org/genproto v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:0joYwWwLQh18AOj8zMYeZLjzuqcYTU3/nC5JdCvC3JI= +google.golang.org/genproto/googleapis/bytestream v0.0.0-20251124214823-79d6a2a48846 h1:7FlucM2tFADtEDnIlDrR12KdRqV48B1GSTU1U6uKSiY= +google.golang.org/genproto/googleapis/bytestream v0.0.0-20251124214823-79d6a2a48846/go.mod h1:G3Q0qS3k/oFEmVMddPsSYcFnm2+Mq2XRmxujrtu5hr0= google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422 h1:3UsHvIr4Wc2aW4brOaSCmcxh9ksica6fHEr8P1XhkYw= google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 h1:iK2jbkWL86DXjEx0qiHcRE9dE4/Ahua5k6V8OWFb//c= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I= google.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8= google.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s= +google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg= +google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU= google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/internal/BUILD.bazel b/internal/BUILD.bazel index 815a82a5..0908abbe 100644 --- a/internal/BUILD.bazel +++ b/internal/BUILD.bazel @@ -1,5 +1,11 @@ load("@bazel_lib//:bzl_library.bzl", "bzl_library") +filegroup( + name = "all_files", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) + exports_files(["runner.bash.template"]) bzl_library( diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index 7eadf2aa..d67c7fc4 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -1,5 +1,11 @@ load("@bazel_lib//:bzl_library.bzl", "bzl_library") +filegroup( + name = "all_files", + srcs = glob(["**"]), + visibility = ["//:__pkg__"], +) + bzl_library( name = "integrity", srcs = ["integrity.bzl"], diff --git a/tools/e2e/BUILD.bazel b/tools/e2e/BUILD.bazel new file mode 100644 index 00000000..89476332 --- /dev/null +++ b/tools/e2e/BUILD.bazel @@ -0,0 +1,44 @@ +"Create a toolchain tar archive we can pass as input to the e2e tests" + +load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file") + +# copy the binary into our target folder +copy_file( + name = "binary-non-win", + src = "//cmd", + out = "output/cmd", + is_executable = True, +) + +copy_file( + name = "binary-win", + src = "//cmd", + out = "output/cmd.exe", + is_executable = True, + target_compatible_with = [ + "@platforms//os:windows", + ], +) + +alias( + name = "binary", + actual = select({ + "@platforms//os:windows": ":binary-win", + "//conditions:default": "binary-non-win", + }), +) + +copy_file( + name = "toolchain-build", + src = "toolchain.BUILD.bazel", + out = "output/BUILD.bazel", +) + +filegroup( + name = "toolchain", + srcs = [ + ":binary", + ":toolchain-build", + ], + visibility = ["//:__pkg__"], +) diff --git a/tools/e2e/toolchain.BUILD.bazel b/tools/e2e/toolchain.BUILD.bazel new file mode 100644 index 00000000..a98ee460 --- /dev/null +++ b/tools/e2e/toolchain.BUILD.bazel @@ -0,0 +1,22 @@ +"Fake BUILD.bazel we will have in the prebuilt toolchain" + +load("@bazeldnf//bazeldnf:toolchain.bzl", "bazeldnf_toolchain") + +alias( + name = "cmd.binary", + actual = select({ + "@platforms//os:windows": "cmd.exe", + "//conditions:default": "cmd", + }), +) + +bazeldnf_toolchain( + name = "bazeldnf_toolchain", + tool = ":cmd.binary", +) + +toolchain( + name = "toolchain", + toolchain = ":bazeldnf_toolchain", + toolchain_type = "@bazeldnf//bazeldnf:toolchain_type", +)