Skip to content

Conversation

@ecrupper
Copy link
Contributor

Based off of #615 #754 #809 #828 #829 #847 #848 #849 #851 #853 #855 and #856

This change continues the refactor efforts initially introduced in the above PRs.

This adds a new build package to the github.com/go-vela/server/api package.

This contains all the same handlers that existed previously but with each of them within their own file.

It also adds a new webhook package in order to export PublishToQueue as a function within build package.

Now that build has been moved to its own package, I was also able to put PlanSteps and PlanServices in their respective packages.

@ecrupper ecrupper self-assigned this May 26, 2023
@ecrupper ecrupper requested a review from a team as a code owner May 26, 2023 19:34
@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #864 (3c4c5cc) into main (f7c3c6b) will increase coverage by 5.59%.
The diff coverage is 1.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
+ Coverage   66.13%   71.72%   +5.59%     
==========================================
  Files         297      304       +7     
  Lines       13876    12794    -1082     
==========================================
  Hits         9177     9177              
+ Misses       4252     3170    -1082     
  Partials      447      447              
Impacted Files Coverage Δ
api/build/cancel.go 0.00% <0.00%> (ø)
api/build/clean.go 0.00% <0.00%> (ø)
api/build/create.go 0.00% <0.00%> (ø)
api/build/delete.go 0.00% <0.00%> (ø)
api/build/get.go 0.00% <0.00%> (ø)
api/build/get_id.go 0.00% <0.00%> (ø)
api/build/list_org.go 0.00% <0.00%> (ø)
api/build/list_repo.go 0.00% <0.00%> (ø)
api/build/plan.go 0.00% <0.00%> (ø)
api/build/publish.go 0.00% <0.00%> (ø)
... and 4 more

... and 6 files with indirect coverage changes

"github.com/sirupsen/logrus"
)

// swagger:operation GET /api/v1/repos/{org}/{repo}/builds/{build}/token builds GetBuildToken
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this endpoint should be in the api/auth package instead of api/build since it is auth-specific. Then all of the auth stuff is in the same package even if the API spreads it across a variety of endpoints. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was thinking similarly, but landed on sticking with the build package since the URL path is very much of the build flavor.


// getPRNumberFromBuild is a helper function to
// extract the pull request number from a Build.
func getPRNumberFromBuild(b *library.Build) (int, error) {
Copy link
Member

Choose a reason for hiding this comment

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

this is used for both CreateBuild and UpdateBuild but is in create.go - should it go in a file on its own? 🤔

It's probably fine here, but I'm asking anyway. 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to leave it there for now, but I almost wonder if this belongs in types rather than as a helper function

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.

Some misc questions and a couple typos.

@ecrupper ecrupper requested a review from cognifloyd May 30, 2023 16:30
Copy link
Contributor

@plyr4 plyr4 left a comment

Choose a reason for hiding this comment

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

nice

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.

4 participants