pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.3k stars 634 forks source link

Unmatched glob from CLI arguments error when running `./build-support/githooks/pre-commit`. #15655

Closed kaos closed 2 years ago

kaos commented 2 years ago

Describe the bug

$ ./build-support/githooks/pre-commit 
* Typechecking
15:05:04.51 [INFO] waiting for pantsd to start...
15:05:04.92 [INFO] pantsd started
15:05:07.13 [INFO] Initializing scheduler...
15:05:18.70 [INFO] Scheduler initialized.
15:06:07.87 [INFO] Completed: Typecheck using MyPy - mypy succeeded.
Success: no issues found in 729 source files

✓ mypy succeeded.
* Checking linters, formatters, and headers
15:06:10.23 [ERROR] 1 Exception encountered:

Engine traceback:
  in select
  in pants.core.goals.lint.lint
  in pants.engine.internals.specs_rules.resolve_specs_paths
  in paths
Traceback (no traceback):
  <pants native internals>
Exception: Unmatched glob from CLI arguments: ".github/workflows/test.yaml"

Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to https://www.pantsbuild.org/v2.13/docs/troubleshooting#pants-cannot-find-a-file-in-your-project.

If there were formatting errors, run `./pants --changed-since=origin/changed_since fmt`

Pants version On main

OS Mac

Additional info To repro, edit .github/workflows/test.yaml and then run the pre-commit hook.

Attempt at fixing this in #15654, but it is incomplete.

Eric-Arellano commented 2 years ago

Duplicate of https://github.com/pantsbuild/pants/issues/15636

kaos commented 2 years ago

Duplicate of https://github.com/pantsbuild/pants/issues/15636

OK, cool. The symptom (and remedy) may be the same, but how the get there was not ;)

kaos commented 2 years ago

I still have issues when running the pre-commit script.

* Typechecking
00:31:01.50 [ERROR] 1 Exception encountered:

Engine traceback:
  in select
  in pants.vcs.changed.find_changed_owners
  in pants.engine.internals.graph.find_owners
  in pants.engine.internals.graph.resolve_unexpanded_targets
  in pants.engine.internals.specs_rules.addresses_from_raw_specs_without_file_owners
  in paths
Traceback (no traceback):
  <pants native internals>
Exception: Unmatched globs from CLI arguments: [".github/*", ".github/workflows/*", "3rdparty/python/lockfiles/*", "testprojects/src/python/python_targets/*"]

Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to https://www.pantsbuild.org/v2.13/docs/troubleshooting#pants-cannot-find-a-file-in-your-project.
Traceback (most recent call last):
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/bin/daemon_pants_runner.py", line 131, in single_daemonized_run
    runner = LocalPantsRunner.create(
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/bin/local_pants_runner.py", line 159, in create
    specs = calculate_specs(
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/init/specs_calculator.py", line 93, in calculate_specs
    (changed_addresses,) = session.product_request(
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/engine/internals/scheduler.py", line 575, in product_request
    self._raise_on_error([t for _, t in throws])
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/engine/internals/scheduler.py", line 510, in _raise_on_error
    raise ExecutionError(
pants.engine.internals.scheduler.ExecutionError: 1 Exception encountered:

Engine traceback:
  in select
  in pants.vcs.changed.find_changed_owners
  in pants.engine.internals.graph.find_owners
  in pants.engine.internals.graph.resolve_unexpanded_targets
  in pants.engine.internals.specs_rules.addresses_from_raw_specs_without_file_owners
  in paths
Traceback (no traceback):
  <pants native internals>
Exception: Unmatched globs from CLI arguments: [".github/*", ".github/workflows/*", "3rdparty/python/lockfiles/*", "testprojects/src/python/python_targets/*"]

Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to https://www.pantsbuild.org/v2.13/docs/troubleshooting#pants-cannot-find-a-file-in-your-project.

Use -ldebug for more logs. 
See https://www.pantsbuild.org/v2.13/docs/troubleshooting for common issues.
Consider reaching out for help: https://www.pantsbuild.org/v2.13/docs/getting-help
kaos commented 2 years ago

To reproduce:

$ echo >> .github/workflows/test.yaml
$ ./build-support/githooks/pre-commit
Eric-Arellano commented 2 years ago

Thanks for the report! This one is a different codepath.

Eric-Arellano commented 2 years ago

Closed by https://github.com/pantsbuild/pants/pull/15714

kaos commented 2 years ago

Apologies for being a pain here now, but it's still an issue for me. Did you try to run my repro above ?

$ echo >> .github/workflows/test.yaml
$ ./build-support/githooks/pre-commit

On: bce58ff356ea1c098cb1a00fdf9e99124dab85d5 I still get:

$ ./build-support/githooks/pre-commit 
* Running `./cargo clippy --all`
    Finished dev [unoptimized + debuginfo] target(s) in 0.82s
* Checking formatting of Rust files
* Checking Rust target headers
    Updating crates.io index
     Ignored package `cargo-ensure-prefix v0.1.7` is already installed, use --force to override
error: could not find `=0.1.7` in registry `crates-io` with version `*`
     Summary Successfully installed cargo-ensure-prefix! Failed to install =0.1.7 (see error(s) above).
error: some crates failed to install
* Typechecking
14:03:21.54 [ERROR] 1 Exception encountered:

Engine traceback:
  in select
  in pants.vcs.changed.find_changed_owners
  in pants.engine.internals.graph.find_owners
  in pants.engine.internals.graph.resolve_unexpanded_targets
  in pants.engine.internals.specs_rules.addresses_from_raw_specs_without_file_owners
  in paths
Traceback (no traceback):
  <pants native internals>
Exception: Unmatched glob from CLI arguments: ".github/workflows/*"

Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to https://www.pantsbuild.org/v2.13/docs/troubleshooting#pants-cannot-find-a-file-in-your-project.
Traceback (most recent call last):
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/bin/daemon_pants_runner.py", line 131, in single_daemonized_run
    runner = LocalPantsRunner.create(
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/bin/local_pants_runner.py", line 159, in create
    specs = calculate_specs(
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/init/specs_calculator.py", line 93, in calculate_specs
    (changed_addresses,) = session.product_request(
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/engine/internals/scheduler.py", line 575, in product_request
    self._raise_on_error([t for _, t in throws])
  File "/Users/aadt/src/github/kaos/pants/src/python/pants/engine/internals/scheduler.py", line 510, in _raise_on_error
    raise ExecutionError(
pants.engine.internals.scheduler.ExecutionError: 1 Exception encountered:

Engine traceback:
  in select
  in pants.vcs.changed.find_changed_owners
  in pants.engine.internals.graph.find_owners
  in pants.engine.internals.graph.resolve_unexpanded_targets
  in pants.engine.internals.specs_rules.addresses_from_raw_specs_without_file_owners
  in paths
Traceback (no traceback):
  <pants native internals>
Exception: Unmatched glob from CLI arguments: ".github/workflows/*"

Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to https://www.pantsbuild.org/v2.13/docs/troubleshooting#pants-cannot-find-a-file-in-your-project.

Use -ldebug for more logs. 
See https://www.pantsbuild.org/v2.13/docs/troubleshooting for common issues.
Consider reaching out for help: https://www.pantsbuild.org/v2.13/docs/getting-help

With this change:

$ git diff
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 66806d048..3672399bb 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -870,3 +870,4 @@ name: Pull Request CI
   push:
     branches-ignore:
     - dependabot/**
+
Eric-Arellano commented 2 years ago

Not a pain, I would so much rather fix this from your report than an end user :)

Ah ha, I reproduce. Looks like I fixed --changed-dependees=none but not yet --changed-dependees=transitive. Coming right up.