wooden-thailand-8386
09/24/2020, 6:03 PM.ci
folder and I can’t get it to show up when I run list
or any other goal. I have this bad feeling that if it’s a hidden folder pants ignores it but just checking here first.hundreds-father-404
09/24/2020, 6:10 PM./pants help-advanced | grep -A 10 'pants_ignore'
It defaults to ignoring files/folders that start with .
, in addition to reading from your .gitignore
. You can add back the value by setting:
[GLOBAL]
pants_ignore.add = ["!.ci/*"]
wooden-thailand-8386
09/24/2020, 6:20 PMpants_ignore
which is now like this:
default: [
".*/",
"/dist/"
]
current value: [
"/dist/"
] (from pants.toml)
but can’t find the .ci
folder (it’s not on my .gitignore)wooden-thailand-8386
09/24/2020, 6:21 PMservices
folder but DevOps folks want me to use their “standard” which are: .terraform
and .helm
together with that .ci
folder so I’m not sure what to do hahahundreds-father-404
09/24/2020, 6:30 PM./pants list
, to confirm, do you have BUILD files in those directories? Pants will only output things with ./pants list
if there is a target that refers to those source fileswooden-thailand-8386
09/24/2020, 6:31 PM.ci
folder and ./pants list ::
isnt showing it.. and when I try ./pants list .ci::
it throws an errorhundreds-father-404
09/24/2020, 6:32 PM./pants --pants-ignore='[]' --no-pants-ignore-use-gitignore list .ci::
Also at the risk of being pedantic, double check that there are targets in the BUILD filehundreds-breakfast-49010
09/24/2020, 6:34 PMhundreds-breakfast-49010
09/24/2020, 6:35 PMzzz
with a BUILD
file with the contents python_library()
and nothing elsehundreds-breakfast-49010
09/24/2020, 6:35 PM./pants list ::
will display a zzz
entrywooden-thailand-8386
09/24/2020, 6:35 PMEngine traceback:
in select
in `list` goal
in pants.engine.internals.build_files.strip_address_origins
in Find targets from input specs
in pants.engine.internals.build_files.addresses_with_origins_from_address_specs
Traceback (most recent call last):
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/engine/internals/native.py", line 69, in generator_send
res = func.send(arg)
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/engine/internals/build_files.py", line 214, in addresses_with_origins_from_address_specs
addr_target_pairs_for_spec = glob_spec.matching_addresses(addr_families_for_spec)
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/base/specs.py", line 130, in matching_addresses
raise ResolveError(f"Address spec '{self}' does not match any targets.")
pants.base.exceptions.ResolveError: Address spec '.ci::' does not match any targets.
Traceback (most recent call last):
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 253, in run
engine_result = self._run_v2()
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 164, in _run_v2
return self._maybe_run_v2_body(goals, poll=False)
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 187, in _maybe_run_v2_body
poll_delay=(0.1 if poll else None),
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/init/engine_initializer.py", line 142, in run_goal_rules
goal_product, params, poll=poll, poll_delay=poll_delay
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/engine/internals/scheduler.py", line 568, in run_goal_rule
self._raise_on_error([t for _, t in throws])
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/engine/internals/scheduler.py", line 532, in _raise_on_error
wrapped_exceptions=tuple(t.exc for t in throws),
pants.engine.internals.scheduler.ExecutionError: 1 Exception encountered:
Engine traceback:
in select
in `list` goal
in pants.engine.internals.build_files.strip_address_origins
in Find targets from input specs
in pants.engine.internals.build_files.addresses_with_origins_from_address_specs
Traceback (most recent call last):
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/engine/internals/native.py", line 69, in generator_send
res = func.send(arg)
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/engine/internals/build_files.py", line 214, in addresses_with_origins_from_address_specs
addr_target_pairs_for_spec = glob_spec.matching_addresses(addr_families_for_spec)
File "/Users/lzfnyy/.cache/pants/setup/bootstrap-Darwin-x86_64/2.0.0b1_py37/lib/python3.7/site-packages/pants/base/specs.py", line 130, in matching_addresses
raise ResolveError(f"Address spec '{self}' does not match any targets.")
pants.base.exceptions.ResolveError: Address spec '.ci::' does not match any targets.
hundreds-breakfast-49010
09/24/2020, 6:35 PM.zzz
it disappears, even if I add a line in pants_ignroe.add
"!/.zzz/*",
hundreds-breakfast-49010
09/24/2020, 6:36 PMwooden-thailand-8386
09/24/2020, 6:36 PMhundreds-father-404
09/24/2020, 6:36 PMhundreds-breakfast-49010
09/24/2020, 6:38 PMhundreds-father-404
09/24/2020, 6:40 PMhundreds-breakfast-49010
09/24/2020, 8:26 PMhundreds-breakfast-49010
09/24/2020, 8:26 PM".*/"
as a default for the --pants-ignore
option in global_options.pyhundreds-breakfast-49010
09/24/2020, 8:27 PMpants.toml
hundreds-father-404
09/24/2020, 8:33 PMpants_ignore
in pants.toml
, then print what we pass to Rust, I get
['/build-support/virtualenvs/', '/.pants.d', '/dist', '/.pids']
Given this diff:
diff --git a/pants.toml b/pants.toml
index f014b0c47..965aad8cf 100644
--- a/pants.toml
+++ b/pants.toml
@@ -27,18 +27,18 @@ pantsd_invalidation_globs.add = [
"src/rust/engine/**/*.toml",
]
# Path patterns to ignore for filesystem operations on top of the builtin patterns.
-pants_ignore.add = [
+pants_ignore = [
# venv directories under build-support.
"/build-support/virtualenvs/",
- "/build-support/*.venv/",
+# "/build-support/*.venv/",
# An absolute symlink to the Pants Rust toolchain sources.
- "/build-support/bin/native/src",
+# "/build-support/bin/native/src",
# We shouldn't walk or watch the rust compiler artifacts because it is slow.
- "/src/rust/engine/target",
+# "/src/rust/engine/target",
# We want to .gitignore Java .class files, but pants should pay attention to them.
- "!*.class",
+# "!*.class",
# We also want to override the .gitignore'd pants.pex file
- "!/pants.pex",
+# "!/pants.pex",
]
[source]
diff --git a/src/python/pants/init/options_initializer.py b/src/python/pants/init/options_initializer.py
index c94c47709..752eeb2c3 100644
--- a/src/python/pants/init/options_initializer.py
+++ b/src/python/pants/init/options_initializer.py
@@ -107,6 +107,7 @@ class OptionsInitializer:
add(global_options.pants_distdir)
add(global_options.pants_subprocessdir)
+ print(pants_ignore)
return pants_ignore
@staticmethod
hundreds-breakfast-49010
09/24/2020, 8:36 PM.*/
from pants-ignore?hundreds-breakfast-49010
09/24/2020, 8:36 PMhundreds-breakfast-49010
09/24/2020, 8:39 PM.*
to the ignore struct, even if that pants option is unsethundreds-breakfast-49010
09/24/2020, 8:50 PMGitIgnoreStyleExcludes::create_with_gitignore_file
a lothundreds-breakfast-49010
09/24/2020, 8:50 PMhundreds-breakfast-49010
09/24/2020, 9:39 PMhundreds-breakfast-49010
09/24/2020, 9:42 PM--build-ignore
option instead of the --pants-ignore
optionhundreds-breakfast-49010
09/24/2020, 9:43 PMwooden-thailand-8386
09/24/2020, 9:48 PMhundreds-breakfast-49010
09/24/2020, 9:53 PMhundreds-father-404
09/24/2020, 10:20 PMbuild_ignore
is to ignore BUILD
files in particular. It’s useful, for example, if you are still using Pants v1 for JVM and have a v1 config file that says ignore src/python
and a v2 config file that says ignore src/java
hundreds-father-404
09/24/2020, 10:20 PMpants_ignore
hundreds-breakfast-49010
09/24/2020, 11:43 PMpants_ignore.add
, and not every file in that subdir, I believe that will workhundreds-breakfast-49010
09/24/2020, 11:43 PM!/.ci
, rather than !/.ci/*
hundreds-breakfast-49010
09/24/2020, 11:44 PMhundreds-father-404
09/24/2020, 11:45 PM./pants count-loc '.ci/*'
. This will check the behavior of --pants-ignore
Greg and I realized --build-ignore
is relevant, indeed. Even if --pants-ignore
is correct, if --build-ignore
is saying to ignore BUILD files, it will look to Pants like there are no targets in that directory.
The above command will help to better isolate if either one or both of the options are the issuehundreds-breakfast-49010
09/24/2020, 11:47 PM./pants count-loc '.ci/*'
will work, but .ci
won't show up in ./pants list ::
hundreds-breakfast-49010
09/24/2020, 11:48 PMpants_ignore.add
has !/.ci
but build_ignore
isn't touchedhundreds-breakfast-49010
09/24/2020, 11:49 PMbuild_ignore.add = ["!/.ci"]
, the default build_ignore
.*/
is getting applied after the custom .add
, so the explicit allow of .ci
doesn't affect the final matching behaviorhundreds-breakfast-49010
09/24/2020, 11:49 PMhundreds-father-404
09/24/2020, 11:50 PMit’s also the case that if you have build_ignore.add = [“!/.ci”], the default build_ignore .*/ is getting applied after the custom .addDoes the ordering impact things? That’s generic options code, that
my_opt.add
appends to the end of the prior valueshundreds-breakfast-49010
09/24/2020, 11:52 PMhundreds-breakfast-49010
09/24/2020, 11:52 PMhundreds-breakfast-49010
09/24/2020, 11:52 PMgitignore
file specifies a pattern. When deciding whether to ignore a path, Git normally checks gitignore
patterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome):"hundreds-breakfast-49010
09/24/2020, 11:53 PMhundreds-breakfast-49010
09/25/2020, 12:13 AM!/.ci/
to pants_ignore.add
and 2) to remove the default ".*/"
glob from the build-ignore
option by adding build_ignore.remove = [".*/"]
to your cargo.toml. that should make it possible to see .ci
show up in pants goalshundreds-breakfast-49010
09/25/2020, 12:13 AM.*/
as a default glob in the --build-ignore
option, so in the next release that has that change, 2) will no longer be necessarywooden-thailand-8386
09/25/2020, 12:20 AMwooden-thailand-8386
09/25/2020, 12:20 AMwooden-thailand-8386
09/25/2020, 12:21 AMhundreds-breakfast-49010
09/25/2020, 12:21 AMwooden-thailand-8386
09/25/2020, 12:22 AMhundreds-breakfast-49010
09/25/2020, 12:23 AMwooden-thailand-8386
09/25/2020, 12:23 AMhundreds-father-404
09/25/2020, 12:24 AMhundreds-breakfast-49010
09/25/2020, 12:24 AMhundreds-father-404
09/25/2020, 12:24 AMwooden-thailand-8386
09/25/2020, 12:26 AM❯ ./pants list .ci::
.ci:its_alive
wooden-thailand-8386
09/25/2020, 12:26 AMhundreds-father-404
09/25/2020, 12:27 AMwooden-thailand-8386
09/25/2020, 12:27 AMwooden-thailand-8386
09/25/2020, 12:27 AMpants
not even bazel
hundreds-breakfast-49010
09/25/2020, 12:28 AMhundreds-breakfast-49010
09/25/2020, 12:28 AMwooden-thailand-8386
09/25/2020, 12:28 AMhundreds-father-404
09/25/2020, 12:29 AMwooden-thailand-8386
09/25/2020, 12:30 AMwooden-thailand-8386
09/25/2020, 12:31 AMwooden-thailand-8386
09/25/2020, 12:32 AMhundreds-father-404
09/28/2020, 7:02 PMbuild_ignore
is now empty by default. I’m not sure if you ended up setting that, but if so, you can remove it.
You likely still need !.ci
in pants_ignore
though.wooden-thailand-8386
09/28/2020, 7:02 PMhundreds-father-404
09/28/2020, 7:03 PM