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

Implement properties fetch for GitLab #4446

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Implement properties fetch for GitLab #4446

merged 1 commit into from
Sep 11, 2024

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Sep 11, 2024

Summary

This does a very basic implementation of fetching the base propertiesf
or a repo in gitlab.

Closes: #4330

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

Copy link

stacklok-cloud-staging bot commented Sep 11, 2024

Minder Vulnerability Report ✅

Minder analyzed this PR and found it does not add any new vulnerable dependencies.

Vulnerability scan of 88f51fb3:

  • 🐞 vulnerable packages: 0
  • 🛠 fixes available for: 0

return nil, fmt.Errorf("failed to create properties: %w", err)
}

return outProps.Merge(getByProps), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

should we merge getByProps as-is or just cherry-pick the known values?

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 don't have a strong opinion, as long as outProps takes precedence.

Copy link
Contributor

Choose a reason for hiding this comment

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

what maybe is not apparent: merge replaces any properties in outProps with same-named properties in getByProps so the caller could essentially set the outProps...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! So I meant to do the opposite then.

Copy link
Contributor

Choose a reason for hiding this comment

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

I acked the code, but I took a note to revisit how we actually use Merge and see if we either 1) change Merge to not replace keys that exist or 2) add something like MergeIfNotExists (or call it Extend like Python)

This does a very basic implementation of fetching the base propertiesf
or a repo in gitlab.

Closes: #4330
Signed-off-by: Juan Antonio Osorio <[email protected]>
return nil, fmt.Errorf("upstream ID not found or invalid: %w", err)
}

projectURLPath, err := url.JoinPath("projects", url.PathEscape(uid))
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess later we'll split this into a helper when we have more getProperties calls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, all of this will get refactored in due time.

@coveralls
Copy link

Coverage Status

coverage: 53.51% (+0.2%) from 53.35%
when pulling 88f51fb on gitlab-fetch-properties
into 756c8d6 on main.

@JAORMX JAORMX merged commit 69c8d61 into main Sep 11, 2024
21 checks passed
@JAORMX JAORMX deleted the gitlab-fetch-properties branch September 11, 2024 14:02
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.

Add properties fetching for GitLab
3 participants