Skip to content

Conversation

@ecrupper
Copy link
Contributor

Part of the effort for go-vela/community#613. It would be helpful to not have to make two calls to the database during our webhook process. This can be remedied by returning the created build object when it's saved to the database.

@ecrupper ecrupper requested a review from a team as a code owner September 22, 2022 19:09
@ecrupper ecrupper self-assigned this Sep 22, 2022
@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Merging #701 (bfdcac6) into main (71240b4) will decrease coverage by 2.99%.
The diff coverage is 42.10%.

❗ Current head bfdcac6 differs from pull request most recent head 38bd752. Consider uploading reports for the commit 38bd752 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #701      +/-   ##
==========================================
- Coverage   58.08%   55.10%   -2.99%     
==========================================
  Files         255      201      -54     
  Lines       15876    15972      +96     
==========================================
- Hits         9222     8801     -421     
- Misses       6249     6789     +540     
+ Partials      405      382      -23     
Impacted Files Coverage Δ
api/build.go 1.65% <0.00%> (+0.17%) ⬆️
api/webhook.go 0.00% <0.00%> (ø)
database/postgres/build.go 91.17% <50.00%> (-4.69%) ⬇️
database/sqlite/build.go 91.17% <50.00%> (-4.69%) ⬇️

... and 149 files with indirect coverage changes

@ecrupper ecrupper changed the title enhance(build): return build on CreateBuild enhance(build): return build on CreateBuild and UpdateBuild Sep 22, 2022
cognifloyd
cognifloyd previously approved these changes Oct 11, 2022
Copy link
Member

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane

return nil, err
}

return build.Crop().ToLibrary(), nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we confirmed the build object has the ID field populated with this change?

We don't explicitly set that ID field in our codebase which is why I ask.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When gorm saves the object, it populates the ID field, right?

@ecrupper
Copy link
Contributor Author

closing because this has become a mess. Will just use a new branch

@ecrupper ecrupper closed this Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants