target: pass the image filename in each target
Rather than having to assume that we only ever produce one artifact, have each upload target contain the filename it expects to upload from the osbuild output. An image file is always explicitly named in the manifest, and we leave it up to each distro to decide how this is done, but the convention is to use the same image filename as used when downloading the image through weldr. Now make this policy explicit, by quering the distro for the image name and inserting it into each upload target. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
61836a7079
commit
839b22026e
8 changed files with 24 additions and 21 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
|
|
@ -117,9 +118,14 @@ func targetsToUploadResponses(targets []*target.Target) []uploadResponse {
|
|||
return uploads
|
||||
}
|
||||
|
||||
func uploadRequestToTarget(u uploadRequest) (*target.Target, error) {
|
||||
func uploadRequestToTarget(u uploadRequest, d distro.Distro, imageType string) (*target.Target, error) {
|
||||
var t target.Target
|
||||
|
||||
filename, _, err := d.FilenameFromType(imageType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
t.Uuid = uuid.New()
|
||||
t.ImageName = u.ImageName
|
||||
t.Status = common.IBWaiting
|
||||
|
|
@ -129,6 +135,7 @@ func uploadRequestToTarget(u uploadRequest) (*target.Target, error) {
|
|||
case *awsUploadSettings:
|
||||
t.Name = "org.osbuild.aws"
|
||||
t.Options = &target.AWSTargetOptions{
|
||||
Filename: filename,
|
||||
Region: options.Region,
|
||||
AccessKeyID: options.AccessKeyID,
|
||||
SecretAccessKey: options.SecretAccessKey,
|
||||
|
|
@ -138,6 +145,7 @@ func uploadRequestToTarget(u uploadRequest) (*target.Target, error) {
|
|||
case *azureUploadSettings:
|
||||
t.Name = "org.osbuild.azure"
|
||||
t.Options = &target.AzureTargetOptions{
|
||||
Filename: filename,
|
||||
Account: options.Account,
|
||||
AccessKey: options.AccessKey,
|
||||
Container: options.Container,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue