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

Simplify the attributes sent to the entity_add handler #4517

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Sep 17, 2024

Summary

I have a rather large branch that works towards not using database access from
the webhook handler. These two patches were part of that branch and can be submitted separately.

The aim is to decrease the number of attributes we send to the handler as well
as make them more generic.

Related: #4327

Change Type

  • 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

as part of a larger branch + unit tests

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.

@jhrozek
Copy link
Contributor Author

jhrozek commented Sep 17, 2024

@blkt would you mind reviewing this? You probably know the code better than I

if repoName, ok = event.Entity["repoName"].(string); !ok {
return errors.New("invalid repo name")
if entName, ok = event.Entity[properties.PropertyName].(string); !ok {
return fmt.Errorf("invalid or unset entity name: %s", entName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this continue using the name? Or will this switch to using the upstream ID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

interesting idea, this code goes to repositories.CreateRepository which uses the name as a property for RetrieveAllProperties. I'm not sure if that and especially the underlying code supports retrieving a repo by name. I need to check that.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a big deal what property is used, as long as we use properties and not tie something to names.

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.

2 participants