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

Fixed incorrect depsdev getporject #1438

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

naveensrinivasan
Copy link
Contributor

@naveensrinivasan naveensrinivasan commented Oct 25, 2023

Description of the PR

PR Checklist

  • All commits have a Developer Certificate of Origin (DCO) -- they are generated using -s flag to git commit.
  • All new changes are covered by tests
  • If GraphQL schema is changed, make generate has been run
  • If collectsub protobuf has been changed, make proto has been run
  • All CI checks are passing (tests and formatting)
  • All dependent PRs have already been merged

- Fixed the issue of incorrect GetProject issue
- Fixes guacsec#1413

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
Copy link
Collaborator

@mdeicas mdeicas left a comment

Choose a reason for hiding this comment

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

Thanks @naveensrinivasan! A few comments

@@ -568,7 +567,7 @@ func (d *depsCollector) collectAdditionalMetadata(ctx context.Context, pkgType s
logger.Debugf("The project key was not found in the map: %v", projectReq.ProjectKey)
project, err = d.client.GetProject(ctx, projectReq)
if err != nil {
logger.Debugf("unable to get project for: %v, error: %v", projectReq.ProjectKey.Id, err)
logger.Infof("unable to get project for: %v, error: %v", projectReq.ProjectKey.Id, err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: This query will still fail for various reasons, so I think it will be too verbose for Info level. Keeping it as Debug should be fine because #1422 will be merged soon.

t.Errorf("NewDepsCollector() error = %v", err)
return
}
if err := c.collectAdditionalMetadata(context.Background(), tt.pkgType, tt.namespace, tt.name, tt.version, tt.pkgComponent); (err != nil) != tt.wantErr {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: use ctx defined above instead of context.Background()

t.Errorf("NewDepsCollector() error = %v", err)
return
}
if err := c.collectAdditionalMetadata(context.Background(), tt.pkgType, tt.namespace, tt.name, tt.version, tt.pkgComponent); (err != nil) != tt.wantErr {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If retrieving the project fails, then collectAdditionalMetadata logs the error instead of returning it. As a result, this test doesn't really capture what is intended to be tested (i.e. that the d.client.GetProject call does not fail).

// Based on the issue https://github.com/guacsec/guac/issues/1413, we need to ensure
// that the .git suffix is removed from the repository name. This is because some
// repository URLs might include the .git suffix which is not expected by certain endpoints.
m.Name = strings.TrimSuffix(m.Name, ".git")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we also trim .git after possibly removing the version? If there is a version specified after the .git then it won't be removed.

Copy link

stale bot commented Dec 26, 2023

This pull request has been automatically marked as stale because it has not had recent activity (60 days of inactivity).
It will be closed in 30 days if no further activity occurs.
Thank you for your contribution!

@stale stale bot added the wontfix This will not be worked on label Dec 26, 2023
@lumjjb
Copy link
Contributor

lumjjb commented Jan 2, 2024

Hi @naveensrinivasan just pinging on this from stale-bot notification - are you still looking to finish up this PR?

@stale stale bot removed the wontfix This will not be worked on label Jan 2, 2024
Copy link

stale bot commented Mar 2, 2024

This pull request has been automatically marked as stale because it has not had recent activity (60 days of inactivity).
It will be closed in 30 days if no further activity occurs.
Thank you for your contribution!

@stale stale bot added the wontfix This will not be worked on label Mar 2, 2024
@pxp928
Copy link
Collaborator

pxp928 commented Mar 4, 2024

@naveensrinivasan should we close this or will you be finishing it up? Thanks

@stale stale bot removed the wontfix This will not be worked on label Mar 4, 2024
@naveensrinivasan
Copy link
Contributor Author

@naveensrinivasan should we close this or will you be finishing it up? Thanks

Sorry I don't have cycles now.

Copy link

stale bot commented May 3, 2024

This pull request has been automatically marked as stale because it has not had recent activity (60 days of inactivity).
It will be closed in 30 days if no further activity occurs.
Thank you for your contribution!

@stale stale bot added the wontfix This will not be worked on label May 3, 2024
Copy link

stale bot commented Jun 2, 2024

This pull request has been automatically closed because there has been no activity for 90 days.
Please feel free to reopen it (or open a new one) if the proposed change is still appropriate.
Thank you for your contribution!

@stale stale bot closed this Jun 2, 2024
@pxp928 pxp928 reopened this Jun 2, 2024
@stale stale bot removed the wontfix This will not be worked on label Jun 2, 2024
@pxp928
Copy link
Collaborator

pxp928 commented Jun 2, 2024

Reopening as the fix may be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] some deps.dev GetProject RPCs fail
4 participants