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

wide-midnight-78598

09/30/2022, 8:18 PM
Not sure how to resolve this issue, at least until the ansible plugin is ready. Using ansible to deploy a bunch of pexes. After packaging, they end up in
dist/...
- however, to deploy them from my ansible role, I need them in specific locations. I haven't been able to resolve symlinks (it just uploads the symlink to the target). Is there a Pantsian way to manipulate the host filesystem?
1
My thought was to package, and then run a script to transfer to them to their expected locations - but wondering if this is something I can do from pants
h

hundreds-father-404

09/30/2022, 8:19 PM
would it help if we didn't write to
dist
and instead wrote to your project? I'm trying to remember why we did
dist/
in the first place
w

wide-midnight-78598

09/30/2022, 8:19 PM
Maybe the
shell
target?
Well, I have 10 packages, that need to be split up to several locations... Oh,
outputpath
?
h

hundreds-father-404

09/30/2022, 8:20 PM
Oh, outputpath?
yeah, but still writes to
dist/
. I'm wondering if we changed it so you could write anywhere (in the repo)
w

wide-midnight-78598

09/30/2022, 8:20 PM
I thought I recalled a way to change the root dist dir - I could just make it my project root
👍 1
1
h

hundreds-father-404

09/30/2022, 8:21 PM
yep you can, the
--distdir
option. or maybe it's
--pants-distdir
w

wide-midnight-78598

09/30/2022, 8:22 PM
Very silly question, but I look for this all the time, and struggle to find it. Is there a
pants.toml
api page somewhere?
h

hundreds-father-404

09/30/2022, 8:23 PM
yeah
w

wide-midnight-78598

09/30/2022, 8:23 PM
Gotta say, for being one of the most important files - it's really hard to find in the docs. That link was on page 2 of the search for
pants.toml
Ummm, possibly a bug or a feature here
pants_distdir = "."
Packaging puts my pexes alongside their sources, in whatever subdir that is. I cannot use
pants_distdir = "/"
because it complains about
" InvalidDistDir: When set to an absolute path,
--pants-distdir
must be relative to the build root.You set it to /. Instead, use a relative path or an absolute path relative to the build root."
So, this behaviour is inconsistent with source roots, where this is a good thing:
Copy code
[source]
root_patterns = ["/"]
h

hundreds-father-404

09/30/2022, 8:31 PM
Maybe add a special case so that
/
gets converted to
.
?
w

wide-midnight-78598

09/30/2022, 8:32 PM
But
.
is relative to source paths of the files, apparently. So, not sure how to get my project root. Weird though, that
pants_dir = "build"
IS relative to my project root...
... Oh wait...
Hmmm.... maybe it IS relative to my project root, but output path auto-adds the parent folders
1
Phew, okay, that got nutty
Copy code
pants_distdir = "."
Copy code
pex_binary(
    name="configurator",
    entry_point="configurator.py",
    output_path="deployment/roles/app/files/configurator.pex"
)
h

hundreds-father-404

09/30/2022, 8:39 PM
are you going to permenantly set
pants_distdir
, or only when building this? It will impact things like
./pants export-codegen
w

wide-midnight-78598

09/30/2022, 8:39 PM
I dont have any codegen in this project, just a whole bunch of shell and python scripts.
I think this is all placeholder until we land the ansible plugin - which can then auto-pick up the packages as needed
👍 1
c

careful-address-89803

09/30/2022, 9:38 PM
many ansible tasks have an option to follow symlinks which is false by default. eg ansible.builtin.copy, it's p annoying.
w

wide-midnight-78598

09/30/2022, 9:55 PM
Whoa, weird - why wasn't it working then.....? I was so sure there was a way to resolve them, but never had luck
I wonder if I had some weird filesystem setup while doing this, maybe - because only my symlinks ended up on target
c

careful-address-89803

09/30/2022, 9:57 PM
it's off by default, so the default is to copy the symlinks
w

wide-midnight-78598

09/30/2022, 10:17 PM
Looks like default on - however, this is a good point that I should check BOTH follow and local_follow - I actually don't know which ones I've been using 🤦‍♂️
I think the pex output_path is still good, however, for all my bash scripts, I would prefer to keep them in the local source dirs and then symlink
2 Views