https://pantsbuild.org/ logo
#general
Title
# general
c

curved-microphone-39455

02/09/2023, 6:30 PM
Hi there, we are facing an issue on the tailor command, it is not generating BUILD file correctly, after multiple hours we found that was related to a
files
dependencies, I use a generic kind of import all for my Docker Image
Copy code
files(
    name="files",
    sources=[
        "project/**/*",
        "**/*.py",
        "poetry.lock",
        "pyproject.toml",
        "README.md",
        "!tests/",
    ],
)

docker_image(
    name="docker",
    dependencies=[
        ":files",
[...]
without this, I am missing several files of all kinds during the Packaging of my Docker image, but when I remove this dependency, the
tailor ::
command works again correctly. Is there a way to disable for certain targets dependencies ? I have tested almost all options on the tailor stuff and options in my
pants.toml
I guess this is not ideal to do an import all with files but need a generic solution to build my docker image over ~20 micro services in a mono repo + multiples libraries. Any ideas?
e

enough-analyst-54434

02/09/2023, 6:37 PM
Did the options you tested include this?: https://www.pantsbuild.org/docs/reference-tailor#ignore_paths
Basically, can you enumerate what options you did try?
c

curved-microphone-39455

02/09/2023, 6:41 PM
I have tested so far • Adding in pants.toml under [tailor]
ignore_paths = ["src/services/project/BUILD"]
• Adding in pants.toml under [tailor]
ignore_adding_targets = ["src/services/project:docker", "src/services/project:files"]
(tried all combinations • Tried to tag my
files
and run
tailor --tag="sommething" tailor ::
• Tried to add a negative dep in the
python_source
top level of my project
e

enough-analyst-54434

02/09/2023, 6:42 PM
And, for the 1st two bullet points you're saying tailor modified
src/services/project/BUILD
anyway?
c

curved-microphone-39455

02/09/2023, 6:44 PM
tailor is not generating BUILD file deeper in the project, for example one of my dev did 5 python package under
src/services/project/package/api
with
__init__.py
and tailor won't detect it and add new BUILD files in each package
but if I remove the
files
dep completely of the top level BUILD of
src/services/project
it works normally
e

enough-analyst-54434

02/09/2023, 6:45 PM
That sounds buggy to me, but I have not been involved in tailor use or development.
c

curved-microphone-39455

02/09/2023, 6:46 PM
currently our dev are adding the BUILD file manually since they only contains the
python_sources()
but if they forget to add it, the unit test are failing since tailor add correctly the BUILD files for the unit tests only (I guess because I have
!tests/
in my
files
dependencies)
Should I open a ticket on github ? I can try to reproduce the bug from a tiny fresh project and see if the behavior is the same
and I have tested with 2.14 but I am currently using 2.15.0rc4
e

enough-analyst-54434

02/09/2023, 6:50 PM
Opening an issue would be a good next step, yes. If you can provide a tiny fresh repro project that is ideal. Thank you.
c

curved-microphone-39455

02/09/2023, 7:17 PM
so could reproduce with this https://github.com/CerberusQc/pants-issue I will open a ticket
5 Views