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

Factor BuildEvent into BuildEvent and GitEvent #73

Merged
merged 1 commit into from
Mar 4, 2016

Conversation

lwander
Copy link
Member

@lwander lwander commented Mar 2, 2016

@lwander lwander force-pushed the factor-multiple-build-events branch from cef4674 to 42f66d1 Compare March 2, 2016 21:47

private Action1<GitEvent> triggerEachMatchFrom(final List<Pipeline> pipelines) {
return event -> {
Observable.from(pipelines)
Copy link
Contributor

Choose a reason for hiding this comment

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

feels like we can move some of this stuff into the superclass without having to repeat it for every provider type

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought the same thing, but GitEvent and BuildEvent don't inherit from Event, making it tricky. Do we need to keep Event around as is?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with separating the events into different types but is there a pressing reason not to have an event interface or something so that we can unify some of this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, but do you know if we need to keep Event.content as a Map: https://github.com/spinnaker/echo/blob/master/echo-model/src/main/groovy/com/netflix/spinnaker/echo/model/Event.groovy?

(Outside of the Git/BuildEvent use case)

Copy link
Contributor

Choose a reason for hiding this comment

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

otherwise we would need to map every possible field from orca

Would suggest adding a TriggerEvent class for orca-pipelinetriggers and model Git, Cron and BuildEvents off that since it is essentially a different module and we don't have to deal with orca events as triggers.

Copy link
Member Author

Choose a reason for hiding this comment

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

SGTM

@tomaslin
Copy link
Contributor

tomaslin commented Mar 2, 2016

@robfletcher

@lwander lwander force-pushed the factor-multiple-build-events branch 2 times, most recently from a6868ad to 3a36508 Compare March 3, 2016 21:29
@lwander
Copy link
Member Author

lwander commented Mar 3, 2016

@tomaslin PTAL

@tomaslin
Copy link
Contributor

tomaslin commented Mar 4, 2016

defer to @robfletcher since he's the original author.

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import groovy.transform.Canonical

@Canonical
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it have any implications that this isn't on the superclass?

Copy link
Member Author

Choose a reason for hiding this comment

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

If I understand it correctly, it should be fine since we are never instantiating the superclass. But I'll defer to you on 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 means any fields on the superclass won't participate in equals, hashCode or toString but if that's not an issue here then it shouldn't matter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I thought it was used for generating constructors. None of those methods are used for the TriggerEvent subclasses, so it should be fine.

Ready to merge?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep

@Canonical generates a constructor with a param for each field – not including those in the superclass and it generates equals / hashCode / toString based on the same fields.

@robfletcher
Copy link
Contributor

Looks good. I have a couple of questions above but they're minor things.

@lwander lwander force-pushed the factor-multiple-build-events branch from 3a36508 to 35113db Compare March 4, 2016 14:30
robfletcher added a commit that referenced this pull request Mar 4, 2016
Factor BuildEvent into BuildEvent and GitEvent
@robfletcher robfletcher merged commit 7deecc2 into spinnaker:master Mar 4, 2016
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.

3 participants