-
Notifications
You must be signed in to change notification settings - Fork 28
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(api/database)!: store deployment record in database for Vela-targeted deployments #1031
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1031 +/- ##
==========================================
- Coverage 67.79% 66.96% -0.84%
==========================================
Files 318 330 +12
Lines 13754 14074 +320
==========================================
+ Hits 9325 9424 +99
- Misses 3956 4169 +213
- Partials 473 481 +8
|
@@ -0,0 +1,33 @@ | |||
// SPDX-License-Identifier: Apache-2.0 | |||
|
|||
package deployment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
3-33 lines are duplicate of database/deployment/update.go:5-35
(dupl)
// | ||
// Use of this source code is governed by the LICENSE file in this repository. | ||
|
||
package deployment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
5-35 lines are duplicate of database/deployment/create.go:3-33
(dupl)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a couple comments, looks great so far
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting a few things here. Major one being the need for listing deployments endpoint to be repo-specific.
} else { | ||
d.SetBuilds(builds) | ||
_, err := database.FromContext(c).UpdateDeployment(d) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should an error like this stop the build? Probably? Not sure though, so noting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not too sure what to do for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super minor things, otherwise nice work :D only other thing i noted was a few linter messages still, but hard to tell in GitHub UI if they are current.
dWithBs := []*library.Deployment{} | ||
|
||
for _, deployment := range d { | ||
b, _, err := database.FromContext(c).ListBuildsForDeployment(ctx, deployment, nil, 1, 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we delete the database function ListBuildsForDeployment
? Can be a follow up PR but would be nice to remove any dead code.
16fc94c
When a repo has a lot of deployments historically, viewing them in the UI is cumbersome and slow.
The loading of deployments on the deployments tab in Vela takes a few more seconds to load than the other pages (schedules, secrets, audits...) even when there are no deployments for a repo. This is due to the way deployments are stored and retrieved.
The changes made in this pull request add a new database table so that we can store deployment information instead of having to go to the scm to retrieve them.
With these changes, any new deployments will be added to our database and pulled from there when requested, but old deployments are still pulled from GitHub.