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

extract Servlet functionality into sse-common module for reuse #23

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

jordanglassman
Copy link

Description

Extracts the pieces of the Endpoint class into a common module for reuse elsewhere.

Reviewer should verify no regressions with existing, unchanged test suite as well as the new unit tests. Smoke test by installing the plugin and the sse-gateway-sample, to verify functionality.

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description
  • Appropriate unit or acceptance tests or explanation to why this change has no tests
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verified the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given

Copy link
Member

@tfennelly tfennelly left a comment

Choose a reason for hiding this comment

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

Looking great Jordan ... I'll try take it for a spin later.

},
"homepage": "https://github.com/jenkinsci/sse-gateway-plugin",
"dependencies": {
"@jenkins-cd/sse-gateway": "0.0.21"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you can use the relative dep for this + as a devDependency e.g. same as in sse-gateway-sample/package.json.

"@jenkins-cd/sse-gateway": "../"

Copy link
Member

Choose a reason for hiding this comment

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

With that though, you might want to get the maven clean task to wipe node_modules/@jenkins-cd/sse-gateway.

Copy link
Author

Choose a reason for hiding this comment

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

Done and done. Not sure how sse-gateway-sample worked before, I assume it had a stale copy of sse-gateway already present.

@@ -23,7 +23,7 @@
},
"homepage": "https://github.com/jenkinsci/sse-gateway-plugin",
"dependencies": {
"@jenkins-cd/sse-gateway": "0.0.21"
"@jenkins-cd/sse-gateway": "../sse-gateway-client"
Copy link
Member

Choose a reason for hiding this comment

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

It probably doesn't matter too much in this case, but I guess this really is a devDependencies since it's only there to service unit tests.

Copy link
Author

Choose a reason for hiding this comment

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

Updated.

@tfennelly
Copy link
Member

Blue Ocean CI run using these changes ... https://ci.blueocean.io/job/blueocean/job/sse-gateway-pr23-verify/

@tfennelly
Copy link
Member

@jordanglassman I think we need a few more tweaks to the poms. The root/parent pom prob shouldn't have he plugin parent pom as it's parent.

See the last commit on https://github.com/tfennelly/sse-gateway-plugin/tree/jordanglassman-ANALYTICS-682. Those tweaks cause compile errors in commons because it's no longer able to get some of the deps it needs (that it was getting from the plugin parent pom).

@jordanglassman
Copy link
Author

jordanglassman commented Sep 21, 2017

@tfennelly are you saying that you want to import all these deps individually, rather than transitively via jenkins-core?

sse-common still has a couple of hudson.* imports, so I think jenkins-core is needed in any case.

@jordanglassman
Copy link
Author

Had to roll back java version in sse-gateway based on parent pom enforcer settings.

@tfennelly
Copy link
Member

@jordanglassman what are the hudson deps?

@jordanglassman
Copy link
Author

Mostly in the EventDispatcher classes:
import hudson.Extension: used to add servlet listener as an extension point
import hudson.model.User: used to get Jenkins authentication data for Pubsub
import hudson.security.ACL: Jenkins-related security data for Pubsub
import hudson.util.CopyOnWriteMap: could be changed seamlessly to ConcurrentMap, I think

Only used in tests:
import hudson.Functions;
import hudson.security.csrf.CrumbIssuer;

Want me to try to factor all of this stuff out into other classes? I think it should be possible.

@tfennelly
Copy link
Member

@jordanglassman yeah ... I think ideally the pubsub and sse "common" modules should have no Jenkins deps what so ever.

So maybe it means that, after all, we do need a separate pubsub module that becomes the pubsub commons. Then maybe the pubsub Jenkins plugin could define the Guava bus implementation. Would need to look at the code, but maybe you know what I mean.

return;
}

try {
SimpleMessage message = new SimpleMessage()
.setChannelName("sse")
.set("jenkins_channel", "sse")
Copy link
Author

Choose a reason for hiding this comment

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

A lot of special tweaks like this were needed to avoid the need to update the client.

@jordanglassman
Copy link
Author

blueocean-plugin acceptance tests currently hanging in the nightwatch section, even with the existing version of sse-gateway/pubsub-light.

Going to try rolling it back a bit.

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