Skip to content

Commit 68b8961

Browse files
committed
Do not assume all depot artifacts are cached yet.
Users upgrading State Tool will not have their artifacts cached in the depot yet.
1 parent e2d7b3d commit 68b8961

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/runtime/depot.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ func (d *depot) Save() error {
422422
// Mark artifacts that are no longer used and remove the old ones.
423423
for id := range d.artifacts {
424424
if deployments, ok := d.config.Deployments[id]; !ok || len(deployments) == 0 {
425+
if _, exists := d.config.Cache[id]; !exists {
426+
err := d.recordUse(id)
427+
if err != nil {
428+
return errs.Wrap(err, "Could not update depot cache with previously used artifact")
429+
}
430+
}
425431
d.config.Cache[id].InUse = false
426432
logging.Debug("Artifact '%s' is no longer in use", id.String())
427433
}

0 commit comments

Comments
 (0)