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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Kept it as a debug in PR #2009

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()

Copy link
Contributor

Choose a reason for hiding this comment

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

Using ctx instead of context.Background in PR #2009.

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).

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right, collectAdditionalMetadata has logs instead of errors, so the tests are now checking the logs to see whether they contain the expected error. Again, this is in PR #2009.

// 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
Contributor

Choose a reason for hiding this comment

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

Yeah, the code now trims the .git after removing the version. Thanks!

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.

@nathannaveen
Copy link
Contributor

This PR is being continued in #2009.

@pxp928
Copy link
Collaborator

pxp928 commented Jul 16, 2024

Closing this as continued work in #2009.

@pxp928 pxp928 closed this Jul 16, 2024
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
5 participants