mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-04-08 03:25:25 +00:00
Seems we should not use own credential extraction logic as it should be aligned with resolver internally to select correct information for the host we want to push manifest. I.e. we may want to push manifest onto ghcr.io, and in that case we will hit errors as we will extract credentials for docker.io instead. Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package pkglib
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/linuxkit/linuxkit/src/cmd/linuxkit/registry"
|
|
"github.com/linuxkit/linuxkit/src/cmd/linuxkit/util"
|
|
)
|
|
|
|
// Index create an index for the package tag based on all arch-specific tags in the registry.
|
|
func (p Pkg) Index(bos ...BuildOpt) error {
|
|
var bo buildOpts
|
|
for _, fn := range bos {
|
|
if err := fn(&bo); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
name := p.FullTag()
|
|
|
|
// 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
|
|
|
|
// push based on tag
|
|
fmt.Printf("Pushing index based on all arch-specific images in registry %s\n", name)
|
|
_, _, err := registry.PushManifest(name)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// push based on release
|
|
if bo.release != "" {
|
|
relTag, err := p.ReleaseTag(bo.release)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
fullRelTag := util.ReferenceExpand(relTag)
|
|
|
|
fmt.Printf("Pushing index based on all arch-specific images in registry %s\n", fullRelTag)
|
|
_, _, err = registry.PushManifest(fullRelTag)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|