hey, is there an way to replace a file in a digest...
# plugins
c
hey, is there an way to replace a file in a digest?
1
c
I’m not aware of any high level API for this, so think you’d have to resort to something like
Copy code
entries = await Get(DigestEntries, Digest, digest)
modified_entries = ... # replace desired FileEntry with a FileContent object, then
new_digest = await Get(Digest, CreateDigest(modified_entries))
c
ah, neat, thanks!
👍 1
for future ref, you can also get a
DigestSubset
that's everything but the files you want, and then merge a
Digest
with the files you want.
Copy code
Get(
            Digest,
            DigestSubset(
                dependencies_files.snapshot.digest,
                PathGlobs(
                    (
                        "**",
                        "!" + os.path.join(chdir, ".terraform.lock.hcl"),
                    ),
                ),
            ),
        ),
👍 1