Worker/osbuild: indent manifest before uploading to Koji
Indent the osbuild manifest before uploading it to Koji. This will make it much nicer for reading by humans. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
98c50e3f6e
commit
cf0571b908
1 changed files with 9 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
|
|
@ -883,10 +884,16 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
}
|
||||
logWithId.Info("[Koji] 🎉 Image successfully uploaded")
|
||||
|
||||
manifest := bytes.NewReader(jobArgs.Manifest)
|
||||
var manifest bytes.Buffer
|
||||
err = json.Indent(&manifest, jobArgs.Manifest, "", " ")
|
||||
if err != nil {
|
||||
logWithId.Warnf("[Koji] Indenting osbuild manifest failed: %v", err)
|
||||
targetResult.TargetError = clienterrors.WorkerClientError(clienterrors.ErrorKojiBuild, err.Error(), nil)
|
||||
break
|
||||
}
|
||||
logWithId.Info("[Koji] ⬆ Uploading the osbuild manifest")
|
||||
manifestFilename := jobTarget.ImageName + ".manifest.json"
|
||||
manifestHash, manifestSize, err := kojiAPI.Upload(manifest, targetOptions.UploadDirectory, manifestFilename)
|
||||
manifestHash, manifestSize, err := kojiAPI.Upload(&manifest, targetOptions.UploadDirectory, manifestFilename)
|
||||
if err != nil {
|
||||
logWithId.Warnf("[Koji] ⬆ upload failed: %v", err)
|
||||
targetResult.TargetError = clienterrors.WorkerClientError(clienterrors.ErrorUploadingImage, err.Error(), nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue