Hmm, I can’t figure out why the ORAS binary is not...
# plugins
f
Hmm, I can’t figure out why the ORAS binary is not made available to the publish process. It is downloaded as a tar.gz archive (successfully I think), but I cannot call the contained binary. Does this look correct? https://github.com/Peder2911/pants-oras-plugin/blob/main/pants-plugins/oras/subsystem.py
1
Guess it would be much easier and simpler to just use BinaryPath ?
w
Does your calling function add the tool to the input parameters?
g
You need to provide the exe digest to the sandbox.
Copy code
oras_bin = await pants.engine.rules.Get(
        pants.core.util_rules.external_tool.DownloadedExternalTool,
        pants.core.util_rules.external_tool.ExternalToolRequest,
        oras.get_request(platform),
    )
    ...
    
        pants.engine.process.Process(
            argv=[oras_bin.exe, "version"],
            description="do nothing",
            input_digest=oras_bin.digest,
        ),
Then later when you have some files to package you'll need to do something like
Copy code
input_digest = await Get(Digest, MergeDigests([oras_bin.digest, other_digest, etc]))
The input digest describes all files that should be put into the sandbox
🧠 1
f
Ah, thank you!
Oh wow, I missed the whole thing about Digests and how that affects what’s made available to the process(es) (https://www.pantsbuild.org/docs/rules-api-file-system)? I was surprised to not see
./oras
in the output of the
ls
process, or in the sandbox directory after running, but I guess I am using the wrong assumptions when thinking about this.
Is a digest kind of like a reference to a filesystem (which is made available to a process when providing it with
input_digest
)?
g
Yeah, sort of. Though I think
archive
is a better way to think about it.
🙏 1
You build up a collection of files by manipulating and creating digests, and then you unpack them into the sandbox when you run a process.
🙏 1