F-parts: on registry 2.8.3 a shared-digest tagged version's remove keeps the tag and says removed
The store's pinned image is registry 2.8.3, whose DeleteManifest cannot delete a tag alone: by a tag it deletes the empty digest and answers 400 DIGEST_INVALID. The fakes accepted a DELETE by tag, a fixture agreeing with the mistake, so every merge of a reproducible build would have been a refused remove and a retry finding live. RemoveTag now answers ErrNoTagAlone for that answer; remove then keeps the tag, whose bytes stay under the other tag anyway, and says removed with that reason, so the builder lets it go. Any other store failure is still refused; a digest shared with nothing is still deleted by digest. The fakes answer as 2.8.3 does. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -22,7 +23,7 @@ type Catalog interface {
|
||||
// collector frees its blobs.
|
||||
Remove(name, version string) error
|
||||
// RemoveTag deletes the tag version of name alone, the manifest staying under every other tag naming it; a store
|
||||
// that cannot delete a tag alone answers an error and removes nothing.
|
||||
// that cannot delete a tag alone answers ErrNoTagAlone and removes nothing.
|
||||
RemoveTag(name, version string) error
|
||||
// RemoveDigest deletes an untagged manifest of name by its digest (retention).
|
||||
RemoveDigest(name, digest string) error
|
||||
@@ -159,13 +160,18 @@ func (v *Verbs) Remove(seat, caller string, r RemoveRequest) error {
|
||||
if d != "" {
|
||||
// Reproducible builds share a digest between a branch's tagged version and the trunk's numbered one: a
|
||||
// manifest deleted by its digest would take the trunk's version with it (security review F1). When another
|
||||
// tag names the digest, the tag alone goes; when the store cannot do that, nothing goes, said.
|
||||
// tag names the digest, the tag alone goes. A store that cannot remove a tag alone (registry 2.8.3) keeps the
|
||||
// tag: its bytes are kept under the other tags anyway, so the removal is said removed with that reason and
|
||||
// the builder lets the version go from its keeping, no refusal and no retry. Any other failure is refused.
|
||||
others, err := v.otherTags(r.Name, r.Version, d)
|
||||
if err != nil {
|
||||
return fmt.Errorf("remove: the store cannot say which other tags of %s name %s, so nothing is removed: %w", r.Name, d, err)
|
||||
}
|
||||
if len(others) > 0 {
|
||||
if err := v.Catalog.RemoveTag(r.Name, r.Version); err != nil {
|
||||
if err := v.Catalog.RemoveTag(r.Name, r.Version); errors.Is(err, ErrNoTagAlone) {
|
||||
sort.Strings(others)
|
||||
ev.Reason = fmt.Sprintf("%s; the store cannot remove a tag alone, so the tag %s is kept and its bytes stay under %s", r.Reason, r.Version, strings.Join(others, ", "))
|
||||
} else if err != nil {
|
||||
return fmt.Errorf("remove: refused: %s@%s shares its digest %s with %v, and the store did not remove the tag alone, so nothing is removed: %w", r.Name, r.Version, d, others, err)
|
||||
}
|
||||
} else if err := v.Catalog.Remove(r.Name, r.Version); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user