container: add support for uploading to registries

Add a new generic container registry client via a new `container`
package. Use this to create a command line utility as well as a
new upload target for container registries.

The code uses the github.com/containers/* project and packages to
interact with container registires that is also used by skopeo,
podman et al. One if the dependencies is `proglottis/gpgme` that
is using cgo to bind libgpgme, so we have to add the corresponding
devel package to the BuildRequires as well as installing it on CI.

Checks will follow later via an integration test.
This commit is contained in:
Christian Kellner 2022-06-28 19:47:59 +02:00
parent d136a075bc
commit 986f076276
955 changed files with 164203 additions and 2549 deletions

View file

@ -97,6 +97,15 @@ type ociUploadSettings struct {
func (ociUploadSettings) isUploadSettings() {}
type containerUploadSettings struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
TlsVerify *bool `json:"tls_verify,omitempty"`
}
func (containerUploadSettings) isUploadSettings() {}
type uploadRequest struct {
Provider string `json:"provider"`
ImageName string `json:"image_name"`
@ -134,6 +143,8 @@ func (u *uploadRequest) UnmarshalJSON(data []byte) error {
// While the API still accepts provider type "generic.s3", the request is handled
// in the same way as for a request with provider type "aws.s3"
settings = new(awsS3UploadSettings)
case "container":
settings = new(containerUploadSettings)
default:
return errors.New("unexpected provider name")
}
@ -322,6 +333,15 @@ func uploadRequestToTarget(u uploadRequest, imageType distro.ImageType) *target.
Namespace: options.Namespace,
Compartment: options.Compartment,
}
case *containerUploadSettings:
t.Name = "org.osbuild.container"
t.Options = &target.ContainerTargetOptions{
Username: options.Username,
Password: options.Password,
Filename: imageType.Filename(),
TlsVerify: options.TlsVerify,
}
}
return &t