Skip to content

Commit

Permalink
Restore blind-write to remote.Put
Browse files Browse the repository at this point in the history
This used to do a blind write, but I "simplified" that when introducing
remote.Pusher, which actually broke some things downstream of ggcr, so
this restores that behavior.

Signed-off-by: Jon Johnson <[email protected]>
  • Loading branch information
jonjohnsonjr committed Jul 8, 2024
1 parent 9915a85 commit 7cd8f6a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions pkg/v1/remote/pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ func (p *Pusher) writer(ctx context.Context, repo name.Repository, o *options) (
return rw, rw.init(ctx)
}

func (p *Pusher) Put(ctx context.Context, ref name.Reference, t Taggable) error {
w, err := p.writer(ctx, ref.Context(), p.o)
if err != nil {
return err
}

m, err := taggableToManifest(t)
if err != nil {
return err
}

return w.commitManifest(ctx, ref, m)
}

func (p *Pusher) Push(ctx context.Context, ref name.Reference, t Taggable) error {
w, err := p.writer(ctx, ref.Context(), p.o)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/v1/remote/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,5 +709,5 @@ func Put(ref name.Reference, t Taggable, options ...Option) error {
if err != nil {
return err
}
return newPusher(o).Push(o.context, ref, t)
return newPusher(o).Put(o.context, ref, t)
}

0 comments on commit 7cd8f6a

Please sign in to comment.