upload/koji: use CGInitBuild and clarify metadata structs
Move to requiring CGInitBuild to be called before CGImport. In the future we could make the former optional again, but for now we want to allow the caller to have done CGInitBuild and for composer only to do the CGImport using the passed in build_id and token. Also rename and document some struct fields in the metadata struct to make them more specific to our use-case and hopefully easier to read. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
e4b839b31f
commit
f446613d4a
6 changed files with 149 additions and 65 deletions
|
|
@ -86,11 +86,15 @@ func RunJob(job worker.Job, store string) (*osbuild.Result, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
start_time := time.Now()
|
||||
|
||||
result, err := RunOSBuild(manifest, store, outputDirectory, os.Stderr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
end_time := time.Now()
|
||||
|
||||
var r []error
|
||||
|
||||
for _, t := range targets {
|
||||
|
|
@ -199,12 +203,13 @@ func RunJob(job worker.Job, store string) (*osbuild.Result, error) {
|
|||
continue
|
||||
}
|
||||
|
||||
build := koji.Build{
|
||||
Name: job.Id.String(),
|
||||
Version: "1",
|
||||
Release: "1",
|
||||
StartTime: time.Now().Unix(),
|
||||
EndTime: time.Now().Unix(),
|
||||
build := koji.ImageBuild{
|
||||
BuildID: options.BuildID,
|
||||
Name: options.Name,
|
||||
Version: options.Version,
|
||||
Release: options.Release,
|
||||
StartTime: start_time.Unix(),
|
||||
EndTime: end_time.Unix(),
|
||||
}
|
||||
buildRoots := []koji.BuildRoot{
|
||||
{
|
||||
|
|
@ -221,11 +226,11 @@ func RunJob(job worker.Job, store string) (*osbuild.Result, error) {
|
|||
Type: "nspawn",
|
||||
Arch: "noarch",
|
||||
},
|
||||
Tools: []koji.Tool{},
|
||||
Components: []koji.Component{},
|
||||
Tools: []koji.Tool{},
|
||||
RPMs: []koji.RPM{},
|
||||
},
|
||||
}
|
||||
output := []koji.Output{
|
||||
output := []koji.Image{
|
||||
{
|
||||
BuildRootID: 1,
|
||||
Filename: options.Filename,
|
||||
|
|
@ -234,16 +239,16 @@ func RunJob(job worker.Job, store string) (*osbuild.Result, error) {
|
|||
ChecksumType: "md5",
|
||||
MD5: hash,
|
||||
Type: "image",
|
||||
Components: []koji.Component{},
|
||||
Extra: koji.OutputExtra{
|
||||
Image: koji.OutputExtraImageInfo{
|
||||
RPMs: []koji.RPM{},
|
||||
Extra: koji.ImageExtra{
|
||||
Info: koji.ImageExtraInfo{
|
||||
Arch: "noarch",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err = k.CGImport(build, buildRoots, output, options.UploadDirectory)
|
||||
_, err = k.CGImport(build, buildRoots, output, options.UploadDirectory, options.Token)
|
||||
if err != nil {
|
||||
r = append(r, err)
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue