How do I get the digest from a Dependencies field?
# plugins
f
How do I get the digest from a Dependencies field?
I realize that I might be asking the wrong question here, I am trying to figure out how to include the files produced in a dependency in my Process call.
c
I think most answers to this may be found on this page: https://www.pantsbuild.org/docs/rules-api-and-target-api#the-dependencies-field i.e. get all targets from your dependencies field. Then get all sources for those targets.
šŸ’« 1
f
Aha, there’s a docs section for it! I almost remembered that. Thanks!
šŸ‘ 1
Although would that work? I.e produce the output of the targets defined as dependencies? Trying to use the output of archive as input to my process.
Am I supposed to just path-glob in the outputs based on the targets?
c
ah, archives etc are
BuiltPackage
I believe.. so no, the above is for getting raw sources.
f
Hmm, so go from dependencies -> Targets -> BuiltPackage?
I was squinting at the backend.docker source since this is basically what it supports, no?
c
dependencies -> targets -> PackageFieldSet’s -> BuiltPackage’s
yea, I can pull examples from the docker backend if you’re looking at that already
ā¤ļø 1
this rule is rather long, but it’s mostly about taking the dependencies and turning them into the digest to pass to the docker process: https://github.com/pantsbuild/pants/blob/90cf800f4055e940d1006f96bc0ffa90696da54e/src/python/pants/backend/docker/util_rules/docker_build_context.py#L258-L382
if squint past the ā€œbuild upstream imagesā€ part, you cut it down to much less
f
Woah awesome, I got it to work! You rock @curved-television-6568
c
HƤrligt!
f
Now there’s another hurdle, ORAS fails to authenticate. I have been relying on the nice heueristic that it just uses the default Docker config, but that does not seem to work here. But I think I’ll save that one for tomorrow. Takker sĆ„ mye! šŸ‡øšŸ‡ŖšŸ¤šŸ‡³šŸ‡“
c
Sounds good. That’s likely due to some missing ENV var.. the way to dig into that is to get a sandbox with a
__run.sh
script in it, that makes it much easier to see which ones are required.. šŸ˜‰
Det var sĆ„ lite, glad att hjƤlpa till šŸ‡ØšŸ‡¦ āœˆļø šŸ‡øšŸ‡Ŗ šŸ¤— šŸ‡³šŸ‡“ šŸ˜‚