Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make the path that jenkins is accessible on configureable #539

Merged
merged 4 commits into from
Aug 2, 2021
Merged

Make the path that jenkins is accessible on configureable #539

merged 4 commits into from
Aug 2, 2021

Conversation

agentgonzo
Copy link

@agentgonzo agentgonzo commented Jul 20, 2021

via --httpPath
Defaults to /

Follow on from #537 allowing for configuration

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@agentgonzo agentgonzo requested a review from a team as a code owner July 20, 2021 11:40
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Probably YAGNI but 🤷‍♂️ @oleg-nenashev requested it.

@@ -77,7 +77,8 @@ protected ServletContext createWebServer() throws Exception {
? new Server(launcherOptions.httpPort)
: new Server(queuedThreadPool);

WebAppContext context = new WebAppContext(launcherOptions.warDir.getPath(), null);
contextPath = launcherOptions.httpPath;
Copy link
Member

Choose a reason for hiding this comment

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

You may need to handle mistakes here:

  • trailing /
  • empty string
  • just /, which WebAppContext will like but getURL will not

Copy link
Author

Choose a reason for hiding this comment

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

what do you want me to do with all of those. Just throw an Illegal Argument Exception? I agree that probably YAGNI so I don't want to waste too much time with error cases for something that'll probably not get used

Copy link
Member

Choose a reason for hiding this comment

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

Just throw an Illegal Argument Exception?

Sure, just to make things more transparent.

I don't want to waste too much time with error cases for something that'll probably not get used

Agreed.

Copy link
Author

Choose a reason for hiding this comment

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

done. Case 1 and 3 are covered by the same "ends with /" statement

…p/commands/JenkinsLauncherOptions.java

Co-authored-by: Jesse Glick <jglick@cloudbees.com>
@agentgonzo agentgonzo requested a review from jglick July 20, 2021 14:58
@oleg-nenashev oleg-nenashev added the enhancement New feature or request label Jul 21, 2021
@oleg-nenashev oleg-nenashev changed the title chore: make the path that jenkins is accessible on configureable Make the path that jenkins is accessible on configureable Jul 21, 2021
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Documentation would be nice

private String validateHttpPath(String httpPath) throws IllegalArgumentException {
if (StringUtils.endsWith(httpPath, "/")) {
throw new IllegalArgumentException("httpPath must not end with a trailing /");
} else if ("".equals(httpPath)) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
} else if ("".equals(httpPath)) {
} else if (StringUtils.isBlank(httpPath)) {

Copy link
Author

@agentgonzo agentgonzo Jul 21, 2021

Choose a reason for hiding this comment

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

Not in this case. null is a valid input (what you get when the user does not set --httpPath) (and StringUtils.isBlank(null) returns true)

@agentgonzo agentgonzo requested a review from oleg-nenashev July 21, 2021 08:57
@agentgonzo
Copy link
Author

@oleg-nenashev - documentation present now. The build failure seems to be infra-related so can you retrigger a build (or just merge if you are happy as the last commit was only to the readme)

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Sorry for the review delay. Looks good to me!

@oleg-nenashev oleg-nenashev merged commit f76f36a into jenkinsci:master Aug 2, 2021
@jglick
Copy link
Member

jglick commented Aug 2, 2021

@oleg-nenashev reminder 1.0-beta-29...master

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants