-
Notifications
You must be signed in to change notification settings - Fork 37
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
Remove RefreshRepositoryByUpstreamID from the repo reconciler #4620
Conversation
fd220c8
to
be713ff
Compare
// Provider is the provider that the event is relevant to | ||
Provider uuid.UUID `json:"provider"` | ||
// Properties is the properties of the repository to be reconciled | ||
Properties map[string]any `json:"properties"` | ||
} | ||
|
||
// NewRepoReconcilerMessage creates a new repos init event | ||
func NewRepoReconcilerMessage(providerID uuid.UUID, repoID int64, projectID uuid.UUID) (*message.Message, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With these changes and especially when issue #4618 is implemented, we can just pass in properties and use this to reconcile a generic entity.
oops the tests are failing looking into this |
be713ff
to
a4cd14c
Compare
this was just a silly bug - I use a real postgres in the test but was reusing the same ID and triggering duplicate errors |
a4cd14c
to
23b4242
Compare
if errors.Is(err, sql.ErrNoRows) { | ||
zerolog.Ctx(ctx).Debug().Err(err). | ||
Int64("repositoryUpstreamID", evt.Repository). | ||
Int64("repositoryUpstreamID", repoID). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use any
or something of the sort to print this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the code is past the repository reconcile and now the code is trying to reconcile artifacts which are supported with github only.
Above is this code:
repoID, err := ewp.Properties.GetProperty(properties.PropertyUpstreamID).AsInt64()
if err != nil {
log.Printf("error getting property upstreamID: %v", err)
// no point in retrying, so we just return nil
return nil
}
so in the case you called out where the upstream ID is a string we'd hit the error case and shortcut.
I can add a unit test with upstream ID as string and split this long function to repo and artifact parts, would it help?
We renamed Owner to Originator in the new refresh-and-do handlers, but forgot to rename the method that sets that attribute.
…ByUpstreamID in reconcilers Gets rid of the RefreshRepositoryByUpstreamID request that we are tryign to phase out in favour of the generic new handlers. This will also allow the reconcile handler to be useful for the github reconciler.
5a15633
to
10e69fb
Compare
10e69fb
to
cecc742
Compare
Summary
Fixes #4595
Change Type
Testing
unit tests + manual
Review Checklist: