weldr: define the pulp.ostree upload settings

This commit is contained in:
Achilleas Koutsou 2023-08-17 19:33:32 +02:00
parent 4edeab80e3
commit 3b8e595351

View file

@ -108,6 +108,16 @@ type containerUploadSettings struct {
func (containerUploadSettings) isUploadSettings() {}
type pulpOSTreeUploadSettings struct {
ServerAddress string `json:"server_address"`
Repository string `json:"repository"`
BasePath string `json:"basepath,omitempty"`
Username string `json:"username"`
Password string `json:"password"`
}
func (pulpOSTreeUploadSettings) isUploadSettings() {}
type uploadRequest struct {
Provider string `json:"provider"`
ImageName string `json:"image_name"`
@ -147,6 +157,8 @@ func (u *uploadRequest) UnmarshalJSON(data []byte) error {
settings = new(awsS3UploadSettings)
case "container":
settings = new(containerUploadSettings)
case "pulp.ostree":
settings = new(pulpOSTreeUploadSettings)
default:
return errors.New("unexpected provider name")
}
@ -235,6 +247,15 @@ func targetsToUploadResponses(targets []*target.Target, state ComposeState) []up
// AccessKeyID and SecretAccessKey are intentionally not included.
}
uploads = append(uploads, upload)
case *target.PulpOSTreeTargetOptions:
upload.ProviderName = "pulp.ostree"
upload.Settings = &pulpOSTreeUploadSettings{
ServerAddress: options.ServerAddress,
Repository: options.Repository,
BasePath: options.BasePath,
// Username and Password are intentionally not included.
}
uploads = append(uploads, upload)
}
}
@ -363,6 +384,10 @@ func uploadRequestToTarget(u uploadRequest, imageType distro.ImageType) *target.
TlsVerify: options.TlsVerify,
}
case *pulpOSTreeUploadSettings:
t.Name = target.TargetNamePulpOSTree
convertedOptions := target.PulpOSTreeTargetOptions(*options)
t.Options = &convertedOptions
}
return &t