Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into enhance/scheduledBuildBranches
  • Loading branch information
claire1618 authored Aug 23, 2023
commit 3963259e83c62bcb10c0c2adc22d4f12f3534896
26 changes: 25 additions & 1 deletion api/build/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,31 @@ import (
// PublishToQueue is a helper function that creates
// a build item and publishes it to the queue.
func PublishToQueue(ctx context.Context, queue queue.Service, db database.Interface, p *pipeline.Build, b *library.Build, r *library.Repo, u *library.User) {
item := types.ToItem(b, r, u)
byteExecutable, err := json.Marshal(p)
if err != nil {
logrus.Errorf("Failed to marshal build executable %d for %s: %v", b.GetNumber(), r.GetFullName(), err)

// error out the build
CleanBuild(ctx, db, b, nil, nil, err)

return
}

bExecutable := new(library.BuildExecutable)
bExecutable.SetBuildID(b.GetID())
bExecutable.SetData(byteExecutable)

err = db.CreateBuildExecutable(bExecutable)
if err != nil {
logrus.Errorf("Failed to publish build executable to database %d for %s: %v", b.GetNumber(), r.GetFullName(), err)

// error out the build
CleanBuild(ctx, db, b, nil, nil, err)

return
}

item := types.ToItem(b, r, u)

logrus.Infof("Converting queue item to json for build %d for %s", b.GetNumber(), r.GetFullName())

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.