Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(repo)!: add pending approval timeout #1227

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ecrupper
Copy link
Contributor

Give repos a new setting called approval_timeout which will set builds that have been sitting in a pending approval state to a failure if they've been unapproved for the given time.

Also applied some approval logic to restarts now that we store fork on builds.

@ecrupper ecrupper requested a review from a team as a code owner December 16, 2024 20:53
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 36.96370% with 191 lines in your changes missing coverage. Please review.

Project coverage is 56.84%. Comparing base (aa973fe) to head (68ba5c8).

Files with missing lines Patch % Lines
api/build/traffic.go 0.00% 86 Missing ⚠️
cmd/vela-server/cleanup.go 0.00% 26 Missing ⚠️
api/repo/create.go 0.00% 15 Missing ⚠️
api/webhook/post.go 0.00% 15 Missing ⚠️
cmd/vela-server/server.go 0.00% 13 Missing ⚠️
cmd/vela-server/main.go 0.00% 12 Missing ⚠️
api/build/restart.go 0.00% 6 Missing ⚠️
api/repo/update.go 0.00% 5 Missing ⚠️
router/middleware/default_timeout.go 0.00% 5 Missing ⚠️
database/types/repo.go 88.23% 3 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1227      +/-   ##
==========================================
- Coverage   56.91%   56.84%   -0.08%     
==========================================
  Files         599      602       +3     
  Lines       32904    33036     +132     
==========================================
+ Hits        18727    18778      +51     
- Misses      13541    13620      +79     
- Partials      636      638       +2     
Files with missing lines Coverage Δ
api/types/repo.go 100.00% <100.00%> (ø)
database/repo/table.go 100.00% <ø> (ø)
database/testutils/api_resources.go 94.83% <100.00%> (+0.01%) ⬆️
mock/server/repo.go 0.00% <ø> (ø)
api/build/auto_cancel.go 16.93% <66.66%> (+0.44%) ⬆️
database/build/list_pending_approval.go 89.65% <89.65%> (ø)
database/types/repo.go 94.84% <88.23%> (-1.86%) ⬇️
api/repo/update.go 0.00% <0.00%> (ø)
router/middleware/default_timeout.go 50.00% <0.00%> (-50.00%) ⬇️
api/build/restart.go 0.00% <0.00%> (ø)
... and 6 more

Copy link
Contributor

@KellyMerrick KellyMerrick left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +81 to +88
// publish the build to the queue
go Enqueue(
context.WithoutCancel(c.Request.Context()),
queue.FromGinContext(c),
database.FromContext(c),
item,
b.GetHost(),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

thoughts on separating the logic from the action taken?

// determine whether to send compiled build to queue

do the determining, return bool error then gatekeep or enqueue afterwards?
seems cleaner that way, like how we separate logic and API response writer code in other spots

Copy link
Contributor

Choose a reason for hiding this comment

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

returning bool based on some logic might also make the function more testable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the idea. There's a few spots within TrafficBuild and gatekeepBuild that leverage contextual services, which may make testing a little tricky. But I'll see what I can do.

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.

3 participants