job/target: add support for uploading to S3
This should still import the image into EC2, but that is left for a future patch. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
7f5c869cd2
commit
04d055d262
1 changed files with 16 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"os/exec"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/osbuild/osbuild-composer/internal/awsupload"
|
||||
"github.com/osbuild/osbuild-composer/internal/pipeline"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
)
|
||||
|
|
@ -75,6 +76,21 @@ func (job *Job) Run() error {
|
|||
panic(err)
|
||||
}
|
||||
case *target.AWSTargetOptions:
|
||||
a, err := awsupload.New(options.Region, options.AccessKeyID, options.SecretAccessKey)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err = a.Upload("/var/cache/osbuild-composer/store/refs/"+result.OutputID+"/image.ami", options.Bucket, options.Key)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
/* TODO: communicate back the AMI */
|
||||
_, err = a.Register(result.OutputID, options.Bucket, options.Key)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
case *target.AzureTargetOptions:
|
||||
default:
|
||||
panic("foo")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue