Port osbuild/images v0.33.0 with dot-notation to composer
Update the osbuild/images to the version which introduces "dot notation" for distro release versions. - Replace all uses of distroregistry by distrofactory. - Delete local version of reporegistry and use the one from the osbuild/images. - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single `createTestWeldrAPI()` function`. - store/fixture: rework fixtures to allow overriding the host distro name and host architecture name. A cleanup function to restore the host distro and arch names is always part of the fixture struct. - Delete `distro_mock` package, since it is no longer used. - Bump the required version of osbuild to 98, because the OSCAP customization is using the 'compress_results' stage option, which is not available in older versions of osbuild. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
f6ff8c40dd
commit
625b1578fa
1166 changed files with 154457 additions and 5508 deletions
67
vendor/github.com/osbuild/images/pkg/container/client.go
generated
vendored
67
vendor/github.com/osbuild/images/pkg/container/client.go
generated
vendored
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/containers/image/v5/manifest"
|
||||
"github.com/containers/image/v5/signature"
|
||||
"github.com/containers/image/v5/transports"
|
||||
"github.com/containers/image/v5/transports/alltransports"
|
||||
"github.com/containers/image/v5/types"
|
||||
"github.com/opencontainers/go-digest"
|
||||
|
||||
|
|
@ -34,6 +35,9 @@ import (
|
|||
const (
|
||||
DefaultUserAgent = "osbuild-composer/1.0"
|
||||
DefaultPolicyPath = "/etc/containers/policy.json"
|
||||
|
||||
containersStorageTransport = "containers-storage"
|
||||
dockerTransport = "docker"
|
||||
)
|
||||
|
||||
// GetDefaultAuthFile returns the authentication file to use for the
|
||||
|
|
@ -340,9 +344,32 @@ func (m RawManifest) Digest() (digest.Digest, error) {
|
|||
return manifest.Digest(m.Data)
|
||||
}
|
||||
|
||||
func getImageRef(target reference.Named, transport string, storagePath string) (types.ImageReference, error) {
|
||||
switch transport {
|
||||
case "", dockerTransport:
|
||||
ref, err := docker.NewReference(target)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ref, nil
|
||||
case containersStorageTransport:
|
||||
var storage string
|
||||
if storagePath != "" {
|
||||
storage = fmt.Sprintf("[overlay@%s]", storagePath)
|
||||
}
|
||||
ref, err := alltransports.ParseImageName(fmt.Sprintf("%s:%s%s", transport, storage, target.Name()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ref, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("Unknown containers-transport: %s", transport)
|
||||
}
|
||||
}
|
||||
|
||||
// GetManifest fetches the raw manifest data from the server. If digest is not empty
|
||||
// it will override any given tag for the Client's Target.
|
||||
func (cl *Client) GetManifest(ctx context.Context, digest digest.Digest) (r RawManifest, err error) {
|
||||
func (cl *Client) GetManifest(ctx context.Context, digest digest.Digest, container *SourceSpec) (r RawManifest, err error) {
|
||||
target := cl.Target
|
||||
|
||||
if digest != "" {
|
||||
|
|
@ -355,13 +382,22 @@ func (cl *Client) GetManifest(ctx context.Context, digest digest.Digest) (r RawM
|
|||
target = t
|
||||
}
|
||||
|
||||
ref, err := docker.NewReference(target)
|
||||
var transport string
|
||||
if container != nil && container.ContainersTransport != nil {
|
||||
transport = *container.ContainersTransport
|
||||
}
|
||||
|
||||
var storagePath string
|
||||
if container != nil && container.StoragePath != nil {
|
||||
storagePath = *container.StoragePath
|
||||
}
|
||||
|
||||
ref, err := getImageRef(target, transport, storagePath)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
src, err := ref.NewImageSource(ctx, cl.sysCtx)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
@ -402,8 +438,7 @@ func (cl *Client) resolveManifestList(ctx context.Context, list manifestList) (r
|
|||
return resolvedIds{}, err
|
||||
}
|
||||
|
||||
raw, err := cl.GetManifest(ctx, digest)
|
||||
|
||||
raw, err := cl.GetManifest(ctx, digest, nil)
|
||||
if err != nil {
|
||||
return resolvedIds{}, fmt.Errorf("error getting manifest: %w", err)
|
||||
}
|
||||
|
|
@ -487,9 +522,9 @@ func (cl *Client) resolveRawManifest(ctx context.Context, rm RawManifest) (resol
|
|||
// which is the digest of the configuration object. It uses the architecture and
|
||||
// variant specified via SetArchitectureChoice or the corresponding defaults for
|
||||
// the host.
|
||||
func (cl *Client) Resolve(ctx context.Context, name string) (Spec, error) {
|
||||
func (cl *Client) Resolve(ctx context.Context, name string, container *SourceSpec) (Spec, error) {
|
||||
|
||||
raw, err := cl.GetManifest(ctx, "")
|
||||
raw, err := cl.GetManifest(ctx, "", container)
|
||||
|
||||
if err != nil {
|
||||
return Spec{}, fmt.Errorf("error getting manifest: %w", err)
|
||||
|
|
@ -500,7 +535,23 @@ func (cl *Client) Resolve(ctx context.Context, name string) (Spec, error) {
|
|||
return Spec{}, err
|
||||
}
|
||||
|
||||
spec := NewSpec(cl.Target, ids.Manifest, ids.Config, cl.GetTLSVerify(), ids.ListManifest.String(), name)
|
||||
var transport *string
|
||||
var location *string
|
||||
if container != nil {
|
||||
transport = container.ContainersTransport
|
||||
location = container.StoragePath
|
||||
}
|
||||
|
||||
spec := NewSpec(
|
||||
cl.Target,
|
||||
ids.Manifest,
|
||||
ids.Config,
|
||||
cl.GetTLSVerify(),
|
||||
ids.ListManifest.String(),
|
||||
name,
|
||||
transport,
|
||||
location,
|
||||
)
|
||||
|
||||
return spec, nil
|
||||
}
|
||||
|
|
|
|||
11
vendor/github.com/osbuild/images/pkg/container/resolver.go
generated
vendored
11
vendor/github.com/osbuild/images/pkg/container/resolver.go
generated
vendored
|
|
@ -23,9 +23,12 @@ type Resolver struct {
|
|||
}
|
||||
|
||||
type SourceSpec struct {
|
||||
Source string
|
||||
Name string
|
||||
TLSVerify *bool
|
||||
Source string
|
||||
Name string
|
||||
Digest *string
|
||||
TLSVerify *bool
|
||||
ContainersTransport *string
|
||||
StoragePath *string
|
||||
}
|
||||
|
||||
func NewResolver(arch string) Resolver {
|
||||
|
|
@ -52,7 +55,7 @@ func (r *Resolver) Add(spec SourceSpec) {
|
|||
}
|
||||
|
||||
go func() {
|
||||
spec, err := client.Resolve(r.ctx, spec.Name)
|
||||
spec, err := client.Resolve(r.ctx, spec.Name, &spec)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("'%s': %w", spec.Source, err)
|
||||
}
|
||||
|
|
|
|||
30
vendor/github.com/osbuild/images/pkg/container/spec.go
generated
vendored
30
vendor/github.com/osbuild/images/pkg/container/spec.go
generated
vendored
|
|
@ -11,27 +11,31 @@ import (
|
|||
// at the Source via Digest and ImageID. The latter one
|
||||
// should remain the same in the target image as well.
|
||||
type Spec struct {
|
||||
Source string // does not include the manifest digest
|
||||
Digest string // digest of the manifest at the Source
|
||||
TLSVerify *bool // controls TLS verification
|
||||
ImageID string // container image identifier
|
||||
LocalName string // name to use inside the image
|
||||
ListDigest string // digest of the list manifest at the Source (optional)
|
||||
Source string // does not include the manifest digest
|
||||
Digest string // digest of the manifest at the Source
|
||||
TLSVerify *bool // controls TLS verification
|
||||
ImageID string // container image identifier
|
||||
LocalName string // name to use inside the image
|
||||
ListDigest string // digest of the list manifest at the Source (optional)
|
||||
ContainersTransport *string // the type of transport used for the container
|
||||
StoragePath *string // location of the local containers-storage
|
||||
}
|
||||
|
||||
// NewSpec creates a new Spec from the essential information.
|
||||
// It also converts is the transition point from container
|
||||
// specific types (digest.Digest) to generic types (string).
|
||||
func NewSpec(source reference.Named, digest, imageID digest.Digest, tlsVerify *bool, listDigest string, localName string) Spec {
|
||||
func NewSpec(source reference.Named, digest, imageID digest.Digest, tlsVerify *bool, listDigest string, localName string, transport *string, storagePath *string) Spec {
|
||||
if localName == "" {
|
||||
localName = source.String()
|
||||
}
|
||||
return Spec{
|
||||
Source: source.Name(),
|
||||
Digest: digest.String(),
|
||||
TLSVerify: tlsVerify,
|
||||
ImageID: imageID.String(),
|
||||
LocalName: localName,
|
||||
ListDigest: listDigest,
|
||||
Source: source.Name(),
|
||||
Digest: digest.String(),
|
||||
TLSVerify: tlsVerify,
|
||||
ImageID: imageID.String(),
|
||||
LocalName: localName,
|
||||
ListDigest: listDigest,
|
||||
ContainersTransport: transport,
|
||||
StoragePath: storagePath,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue