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

refactor(repo)!: nested repository with migration from types #1095

Merged
merged 11 commits into from
Apr 10, 2024

Conversation

ecrupper
Copy link
Contributor

@ecrupper ecrupper requested a review from a team as a code owner March 26, 2024 21:53
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 90.57301% with 102 lines in your changes are missing coverage. Please review.

Project coverage is 64.47%. Comparing base (b889656) to head (74aa2c9).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1095      +/-   ##
==========================================
+ Coverage   61.93%   64.47%   +2.53%     
==========================================
  Files         358      370      +12     
  Lines       10901    11788     +887     
==========================================
+ Hits         6752     7600     +848     
- Misses       3663     3671       +8     
- Partials      486      517      +31     
Files Coverage Δ
api/types/actions/deploy.go 100.00% <100.00%> (ø)
api/types/actions/push.go 100.00% <100.00%> (ø)
api/types/actions/schedule.go 100.00% <100.00%> (ø)
api/types/events.go 100.00% <100.00%> (ø)
api/types/executor.go 100.00% <100.00%> (ø)
api/types/repo.go 100.00% <100.00%> (ø)
compiler/native/compile.go 71.63% <100.00%> (ø)
compiler/native/environment.go 85.71% <100.00%> (ø)
compiler/native/native.go 87.95% <100.00%> (ø)
database/build/count_repo.go 100.00% <100.00%> (ø)
... and 68 more

... and 2 files with indirect coverage changes

compiler/native/compile_test.go Outdated Show resolved Hide resolved
compiler/native/compile_test.go Outdated Show resolved Hide resolved
database/hook/last_repo.go Show resolved Hide resolved
database/hook/count_repo.go Show resolved Hide resolved
api/build/update.go Show resolved Hide resolved
@ecrupper
Copy link
Contributor Author

Putting in draft right now. Functionally it's there, but I'd like to work out more comments, address some tests, and search for more optimizations

@ecrupper ecrupper marked this pull request as draft March 26, 2024 21:55
@ecrupper ecrupper marked this pull request as ready for review April 2, 2024 15:55
api/types/repo.go Outdated Show resolved Hide resolved
@@ -69,7 +69,7 @@ import (
// expand and validate a pipeline configuration.
func ValidatePipeline(c *gin.Context) {
Copy link

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
70-109 lines are duplicate of api/pipeline/compile.go:72-111 (dupl)

scm/github/webhook.go Show resolved Hide resolved
scm/github/webhook.go Show resolved Hide resolved
timhuynh94
timhuynh94 previously approved these changes Apr 8, 2024
Copy link
Contributor

@timhuynh94 timhuynh94 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -7,11 +7,10 @@ import (
"fmt"
"net/http"

"github.com/go-vela/server/api/types"
Copy link
Contributor

Choose a reason for hiding this comment

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

as we move everything to this pattern, any thoughts on giving every types import the api alias?

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 was operating on the following pattern:

  • go-vela/server/api —> types
  • anything else —> api

But I'm open to using api always if people would prefer that

Copy link
Contributor

Choose a reason for hiding this comment

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

cool that works for me, not blocking either way

"github.com/go-vela/types/constants"
"github.com/go-vela/types/database"
"github.com/go-vela/types/library"
"github.com/sirupsen/logrus"
)

// GetDeploymentForRepo gets a deployment by repo ID and number from the database.
func (e *engine) GetDeploymentForRepo(ctx context.Context, r *library.Repo, number int64) (*library.Deployment, error) {
func (e *engine) GetDeploymentForRepo(ctx context.Context, r *api.Repo, number int64) (*library.Deployment, error) {
Copy link

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)

"github.com/sirupsen/logrus"
)

// CountDeploymentsForRepo gets the count of deployments by repo ID from the database.
func (e *engine) CountDeploymentsForRepo(ctx context.Context, r *library.Repo) (int64, error) {
func (e *engine) CountDeploymentsForRepo(ctx context.Context, r *api.Repo) (int64, error) {
Copy link

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)

"github.com/go-vela/types/constants"
"github.com/go-vela/types/database"
"github.com/go-vela/types/library"
"github.com/sirupsen/logrus"
)

// ListDeploymentsForRepo gets a list of deployments by repo ID from the database.
func (e *engine) ListDeploymentsForRepo(ctx context.Context, r *library.Repo, page, perPage int) ([]*library.Deployment, error) {
func (e *engine) ListDeploymentsForRepo(ctx context.Context, r *api.Repo, page, perPage int) ([]*library.Deployment, error) {
Copy link

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)

Copy link
Member

@wass3rw3rk wass3rw3rk left a comment

Choose a reason for hiding this comment

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

looks good overall.. a few minor things.

any thoughts around moving some of the "internal" types that live in /internal now to /internal/types/ or another location?

api/types/actions/push_test.go Outdated Show resolved Hide resolved
api/types/string.go Show resolved Hide resolved
api/types/string.go Outdated Show resolved Hide resolved
api/types/string.go Outdated Show resolved Hide resolved
api/webhook/post.go Outdated Show resolved Hide resolved
compiler/native/parse_test.go Outdated Show resolved Hide resolved
scm/github/changeset.go Outdated Show resolved Hide resolved
plyr4
plyr4 previously approved these changes Apr 10, 2024
timhuynh94
timhuynh94 previously approved these changes Apr 10, 2024
scm/service.go Outdated Show resolved Hide resolved
@ecrupper ecrupper dismissed stale reviews from timhuynh94 and plyr4 via 74aa2c9 April 10, 2024 15:27
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