If we want to ensure we are re-using a previously created artifact, can the IDs be saved and referenced in a later run of dagger assuming the buildkit storage still exists?
var savedValueFromPreviousRun dagger.DirectoryID;
savedValueFromPreviousRun = "value loaded from saved state"
result := client.Container().Build(savedValueFromPreviousRun)
This sort of use case would be for ensuring the same artifact that was built and then tested is used for a release. We wouldn't want to allow a cache miss here and rebuild from the start as we wouldn't be able to guarantee the tests were ran on what is being released or the same artifact is being deployed across different environments (eg. dev/qa/...).
An alternative is to use containers Published externally which makes sense for containerized code but some use cases (eg. terraform code) wouldn't normally be packaged into a container (at least how I've done it).