-
Notifications
You must be signed in to change notification settings - Fork 35
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
⚠️ Only trigger discovery tasks if the Application has a repository specified #715
Conversation
Signed-off-by: Sam Lucidi <slucidi@redhat.com>
Signed-off-by: Sam Lucidi <slucidi@redhat.com>
api/application.go
Outdated
if err != nil { | ||
_ = ctx.Error(err) | ||
return | ||
if r.Repository != nil { |
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.
How about moving the check for the repository into the trigger.Application? When the repository is nil, the trigger could no-op.
By encapsulating/delegating the check to the trigger it can be done in one place and shared by multiple callers. Further, the caller does not need to be concerned.
e2f8d79
to
a6a3aec
Compare
trigger/application.go
Outdated
@@ -23,14 +25,25 @@ func (r *Application) Updated(m *model.Application) (err error) { | |||
if !Settings.Discovery.Enabled { | |||
return | |||
} | |||
|
|||
repo := model.Repository{} | |||
err = json.Unmarshal(m.Repository, &repo) |
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 will be revisited when the JSON serialization work goes in.
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.
LGTM
Signed-off-by: Sam Lucidi <slucidi@redhat.com>
a6a3aec
to
81b6daf
Compare
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.
LGTM, got this error when tested 0.5.0-beta.1.
No description provided.