mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 09:39:08 +00:00
Merge pull request #3877 from giggsoff/propagate-manifest-option
Propagate manifest option into push
This commit is contained in:
commit
a9c7a126cf
5
src/cmd/linuxkit/cache/push.go
vendored
5
src/cmd/linuxkit/cache/push.go
vendored
@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// Push push an image along with a multi-arch index.
|
||||
func (p *Provider) Push(name string) error {
|
||||
func (p *Provider) Push(name string, withManifest bool) error {
|
||||
var (
|
||||
err error
|
||||
options []remote.Option
|
||||
@ -113,6 +113,9 @@ func (p *Provider) Push(name string) error {
|
||||
return fmt.Errorf("name %s unknown in cache", name)
|
||||
}
|
||||
|
||||
if !withManifest {
|
||||
return nil
|
||||
}
|
||||
// Even though we may have pushed the index, we want to be sure that we have an index that includes every architecture on the registry,
|
||||
// not just those that were in our local cache. So we use manifest-tool library to build a broad index
|
||||
auth, err := registry.GetDockerAuth()
|
||||
|
@ -419,7 +419,7 @@ func (p Pkg) Build(bos ...BuildOpt) error {
|
||||
}
|
||||
|
||||
// push the manifest
|
||||
if err := c.Push(p.FullTag()); err != nil {
|
||||
if err := c.Push(p.FullTag(), bo.manifest); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ func (p Pkg) Build(bos ...BuildOpt) error {
|
||||
if _, err := c.DescriptorWrite(&ref, *desc); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := c.Push(fullRelTag); err != nil {
|
||||
if err := c.Push(fullRelTag, bo.manifest); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ func (c *cacheMocker) IndexWrite(ref *reference.Spec, descriptors ...registry.De
|
||||
|
||||
return c.NewSource(ref, "", &desc), nil
|
||||
}
|
||||
func (c *cacheMocker) Push(name string) error {
|
||||
func (c *cacheMocker) Push(name string, withManifest bool) error {
|
||||
if !c.enablePush {
|
||||
return errors.New("push disabled")
|
||||
}
|
||||
|
@ -37,8 +37,9 @@ type CacheProvider interface {
|
||||
// DescriptorWrite writes a descriptor to the cache index; it validates that it has a name
|
||||
// and replaces any existing one
|
||||
DescriptorWrite(ref *reference.Spec, descriptors v1.Descriptor) (ImageSource, error)
|
||||
// Push push an image along with a multi-arch index from local cache to remote registry.
|
||||
Push(name string) error
|
||||
// Push an image along with a multi-arch index from local cache to remote registry.
|
||||
// if withManifest defined will push a multi-arch manifest
|
||||
Push(name string, withManifest bool) error
|
||||
// NewSource return an ImageSource for a specific ref and architecture in the cache.
|
||||
NewSource(ref *reference.Spec, architecture string, descriptor *v1.Descriptor) ImageSource
|
||||
// Store get content.Store referencing the cache
|
||||
|
Loading…
Reference in New Issue
Block a user