Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bzlmod): fail on unused overrides #1669

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

tyler-french
Copy link
Contributor

@tyler-french tyler-french commented Nov 21, 2023

What does this PR do?

We should not allow users to specify overrides to Go dependencies which aren't defined. This adds a failure case for scenarios when overrides are declared by a user for a path that isn't loaded by the go_deps extension.

Fixes #1668

Test Plan

tfrench@tfrench-go ~/bazel-gazelle/tests/bcr
 % git diff
diff --git a/tests/bcr/MODULE.bazel b/tests/bcr/MODULE.bazel
index 19c0c7e..a37b882 100644
--- a/tests/bcr/MODULE.bazel
+++ b/tests/bcr/MODULE.bazel
@@ -48,6 +48,14 @@ go_deps.module_override(
     path = "github.com/stretchr/testify",
 )
 
+go_deps.module_override(
+    patch_strip = 1,
+    patches = [
+        "//patches:testify.patch",
+    ],
+    path = "doesn't exist",
+)
+
 # Test an archive override from a known archive.
 go_deps.gazelle_override(
     directives = [
tfrench@tfrench-go ~/bazel-gazelle/tests/bcr
 % bazel-6.4.0 test //...                          
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 21cb2db5-6b11-45dc-8408-691d3ac55897
ERROR: Traceback (most recent call last):
        File "/home/user/.cache/bazel/_bazel_tfrench/d4c0c5951b0da2028e754ca4d0c138af/external/gazelle~override/internal/bzlmod/go_deps.bzl", line 325, column 33, in _go_deps_impl
                _fail_on_unmatched_overrides(module_overrides.keys(), module_resolutions, "module_overrides")
        File "/home/user/.cache/bazel/_bazel_tfrench/d4c0c5951b0da2028e754ca4d0c138af/external/gazelle~override/internal/bzlmod/go_deps.bzl", line 70, column 13, in _fail_on_unmatched_overrides
                fail("Some {} did not target a Go module with a matching path: {}".format(
Error in fail: Some module_overrides did not target a Go module with a matching path: doesn't exist
ERROR: Analysis of target '//pkg/data:data' failed; build aborted: error evaluating module extension go_deps in @gazelle~override//:extensions.bzl
INFO: Elapsed time: 4.796s
INFO: 0 processes.
ERROR: Couldn't start the build. Unable to run tests
FAILED: Build did NOT complete successfully (64 packages loaded, 499 targets configured)
    Fetching ...es_go~0.42.0~go_sdk~go_default_sdk; Downloading and extracting Go toolchain
tfrench@tfrench-go ~/bazel-gazelle/tests/bcr

@fmeum fmeum merged commit 0205c20 into bazelbuild:master Nov 21, 2023
8 checks passed
renovate bot added a commit to kreempuff/rules_unreal_engine that referenced this pull request Dec 21, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) |
http_archive | minor | `v0.34.0` -> `v0.35.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>bazelbuild/bazel-gazelle (bazel_gazelle)</summary>

###
[`v0.35.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.35.0)

[Compare
Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.34.0...v0.35.0)

#### What's Changed

- Don't run on centos7 in BCR presubmit and add maintainers by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1663
- update readme for v0.34.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1662
- nit: doc `gazelle_generation_test` use of `arguments.txt` by
[@&#8203;vpanta](https://togithub.com/vpanta) in
[bazelbuild/bazel-gazelle#1660
- feat(bzlmod): allow patches in `archive_override`s by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1665
- fix(bzlmod): fail on unused overrides by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1669
- Annotate more globs with `allow_empty = True` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1674
- Generate BUILD files for grpc compiler by
[@&#8203;mering](https://togithub.com/mering) in
[bazelbuild/bazel-gazelle#1672
- Disable lockfile check for BCR test module by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1673
- Make isolated extensions usable for Go tools by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1678
- bzlmod: support go.mod replace directives with a version qualifier on
the left by [@&#8203;andyscott](https://togithub.com/andyscott) in
[bazelbuild/bazel-gazelle#1679
- fix CI by running both WORKSPACE and Bzlmod on select packages by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1690
- disable lockfile by default by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1692
- feat(resolve): optimize applying overrides to be efficient by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1687
- feat(fix-update): allow user to profile commands with `pprof` by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1685
- Fix partial execution with mapped kinds by
[@&#8203;HALtheWise](https://togithub.com/HALtheWise) in
[bazelbuild/bazel-gazelle#1680
- prepare release 0.35.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1693

#### New Contributors

- [@&#8203;mering](https://togithub.com/mering) made their first
contribution in
[bazelbuild/bazel-gazelle#1672

**Full Changelog**:
bazelbuild/bazel-gazelle@v0.34.0...v0.35.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/kreempuff/rules_unreal_engine).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEwMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
cgrindel-self-hosted-renovate bot added a commit to cgrindel/bazel-starlib that referenced this pull request Dec 21, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) |
http_archive | minor | `v0.34.0` -> `v0.35.0` |

---

### Release Notes

<details>
<summary>bazelbuild/bazel-gazelle (bazel_gazelle)</summary>

###
[`v0.35.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.35.0)

[Compare
Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.34.0...v0.35.0)

#### What's Changed

- Don't run on centos7 in BCR presubmit and add maintainers by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1663
- update readme for v0.34.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1662
- nit: doc `gazelle_generation_test` use of `arguments.txt` by
[@&#8203;vpanta](https://togithub.com/vpanta) in
[bazelbuild/bazel-gazelle#1660
- feat(bzlmod): allow patches in `archive_override`s by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1665
- fix(bzlmod): fail on unused overrides by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1669
- Annotate more globs with `allow_empty = True` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1674
- Generate BUILD files for grpc compiler by
[@&#8203;mering](https://togithub.com/mering) in
[bazelbuild/bazel-gazelle#1672
- Disable lockfile check for BCR test module by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1673
- Make isolated extensions usable for Go tools by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1678
- bzlmod: support go.mod replace directives with a version qualifier on
the left by [@&#8203;andyscott](https://togithub.com/andyscott) in
[bazelbuild/bazel-gazelle#1679
- fix CI by running both WORKSPACE and Bzlmod on select packages by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1690
- disable lockfile by default by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1692
- feat(resolve): optimize applying overrides to be efficient by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1687
- feat(fix-update): allow user to profile commands with `pprof` by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1685
- Fix partial execution with mapped kinds by
[@&#8203;HALtheWise](https://togithub.com/HALtheWise) in
[bazelbuild/bazel-gazelle#1680
- prepare release 0.35.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1693

#### New Contributors

- [@&#8203;mering](https://togithub.com/mering) made their first
contribution in
[bazelbuild/bazel-gazelle#1672

**Full Changelog**:
bazelbuild/bazel-gazelle@v0.34.0...v0.35.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
cgrindel-self-hosted-renovate bot added a commit to cgrindel/rules_swift_package_manager that referenced this pull request Dec 22, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) |
http_archive | minor | `v0.34.0` -> `v0.35.0` |

---

### Release Notes

<details>
<summary>bazelbuild/bazel-gazelle (bazel_gazelle)</summary>

###
[`v0.35.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.35.0)

[Compare
Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.34.0...v0.35.0)

#### What's Changed

- Don't run on centos7 in BCR presubmit and add maintainers by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1663
- update readme for v0.34.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1662
- nit: doc `gazelle_generation_test` use of `arguments.txt` by
[@&#8203;vpanta](https://togithub.com/vpanta) in
[bazelbuild/bazel-gazelle#1660
- feat(bzlmod): allow patches in `archive_override`s by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1665
- fix(bzlmod): fail on unused overrides by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1669
- Annotate more globs with `allow_empty = True` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1674
- Generate BUILD files for grpc compiler by
[@&#8203;mering](https://togithub.com/mering) in
[bazelbuild/bazel-gazelle#1672
- Disable lockfile check for BCR test module by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1673
- Make isolated extensions usable for Go tools by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1678
- bzlmod: support go.mod replace directives with a version qualifier on
the left by [@&#8203;andyscott](https://togithub.com/andyscott) in
[bazelbuild/bazel-gazelle#1679
- fix CI by running both WORKSPACE and Bzlmod on select packages by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1690
- disable lockfile by default by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1692
- feat(resolve): optimize applying overrides to be efficient by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1687
- feat(fix-update): allow user to profile commands with `pprof` by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1685
- Fix partial execution with mapped kinds by
[@&#8203;HALtheWise](https://togithub.com/HALtheWise) in
[bazelbuild/bazel-gazelle#1680
- prepare release 0.35.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1693

#### New Contributors

- [@&#8203;mering](https://togithub.com/mering) made their first
contribution in
[bazelbuild/bazel-gazelle#1672

**Full Changelog**:
bazelbuild/bazel-gazelle@v0.34.0...v0.35.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMDAuMCIsInVwZGF0ZWRJblZlciI6IjM2LjEwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
@tyler-french tyler-french deleted the bad-overrides branch December 23, 2023 18:42
alexeagle pushed a commit to aspect-build/rules_py that referenced this pull request Feb 2, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) |
http_archive | minor | `v0.34.0` -> `v0.35.0` |

---

### Release Notes

<details>
<summary>bazelbuild/bazel-gazelle (bazel_gazelle)</summary>

###
[`v0.35.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.35.0)

[Compare
Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.34.0...v0.35.0)

#### What's Changed

- Don't run on centos7 in BCR presubmit and add maintainers by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1663
- update readme for v0.34.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1662
- nit: doc `gazelle_generation_test` use of `arguments.txt` by
[@&#8203;vpanta](https://togithub.com/vpanta) in
[bazelbuild/bazel-gazelle#1660
- feat(bzlmod): allow patches in `archive_override`s by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1665
- fix(bzlmod): fail on unused overrides by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1669
- Annotate more globs with `allow_empty = True` by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1674
- Generate BUILD files for grpc compiler by
[@&#8203;mering](https://togithub.com/mering) in
[bazelbuild/bazel-gazelle#1672
- Disable lockfile check for BCR test module by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1673
- Make isolated extensions usable for Go tools by
[@&#8203;fmeum](https://togithub.com/fmeum) in
[bazelbuild/bazel-gazelle#1678
- bzlmod: support go.mod replace directives with a version qualifier on
the left by [@&#8203;andyscott](https://togithub.com/andyscott) in
[bazelbuild/bazel-gazelle#1679
- fix CI by running both WORKSPACE and Bzlmod on select packages by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1690
- disable lockfile by default by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1692
- feat(resolve): optimize applying overrides to be efficient by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1687
- feat(fix-update): allow user to profile commands with `pprof` by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1685
- Fix partial execution with mapped kinds by
[@&#8203;HALtheWise](https://togithub.com/HALtheWise) in
[bazelbuild/bazel-gazelle#1680
- prepare release 0.35.0 by
[@&#8203;tyler-french](https://togithub.com/tyler-french) in
[bazelbuild/bazel-gazelle#1693

#### New Contributors

- [@&#8203;mering](https://togithub.com/mering) made their first
contribution in
[bazelbuild/bazel-gazelle#1672

**Full Changelog**:
bazelbuild/bazel-gazelle@v0.34.0...v0.35.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/aspect-build/rules_py).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEyMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
jeromep-stripe pushed a commit to jeromep-stripe/bazel-gazelle that referenced this pull request Mar 22, 2024
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.

None yet

2 participants