Skip to content

Commit

Permalink
cache: set all merge+diff refs non-mutable on load.
Browse files Browse the repository at this point in the history
This fixes merge+diff refs from v0.10.{0,1} that weren't set as
committed.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
  • Loading branch information
sipsma committed Apr 13, 2022
1 parent 16699a4 commit a493fab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cache/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,13 @@ func (cm *cacheManager) getRecord(ctx context.Context, id string, opts ...RefOpt
cacheMetadata: md,
}

// TODO:(sipsma) this is kludge to deal with a bug in v0.10.{0,1} where
// merge and diff refs didn't have committed set to true:
// https://github.com/moby/buildkit/issues/2740
if kind := rec.kind(); kind == Merge || kind == Diff {
rec.mutable = false
}

// the record was deleted but we crashed before data on disk was removed
if md.getDeleted() {
if err := rec.remove(ctx, true); err != nil {
Expand Down

0 comments on commit a493fab

Please sign in to comment.