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

[JENKINS-58942] Honor -Djenkins.hook.url=… if defined #240

Merged
merged 4 commits into from
Sep 11, 2019

Conversation

jglick
Copy link
Member

@jglick jglick commented Aug 14, 2019

See JENKINS-58942 for discussion. Open to alternate configuration mechanisms; this is just the simplest thing I could think of. I have tested this using a webhook forwarding service by creating an organization folder, verifying that the alternate base URL was used when registering the hook, and verifying that hook deliveries succeed and trigger responses such as starting builds.

@jglick jglick requested a review from bitwiseman August 14, 2019 21:01
Copy link
Contributor

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

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

There's ways to WireMock this, right?
Let's get an automated test that ensures this doesn't regress.

@jglick
Copy link
Member Author

jglick commented Aug 21, 2019

There are some WireMock tests in this repo. I am not sure how to write new ones using the current idiom of record/playback. Did not see anything related to hook registration.

@jglick jglick changed the title [JENKINS-58942] Honor $JENKINS_HOOK_URL if defined [JENKINS-58942] Honor -Djenkins.hook.url=… if defined Sep 9, 2019
@jglick jglick dismissed bitwiseman’s stale review September 9, 2019 22:42

addressed, I think

public static void register(GitHub hub, String orgName) throws IOException {
String rootUrl = Jenkins.getActiveInstance().getRootUrl();
String rootUrl = System.getProperty("jenkins.hook.url");
Copy link
Contributor

Choose a reason for hiding this comment

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

@jglick Does that automatically convert from the JENKINS_HOOK_URL env value as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. I switched to the system property

  • for consistency with other configuration in Jenkins
  • because for my purposes it must be mutable inside the JVM, which environment variables are not (AFAIK)

In the long term, this probably belongs in JenkinsLocationConfiguration, but requiring such a core dependency would make this potentially unmergeable for months, so I thought it would be acceptable to start with an experimental system property.

Copy link
Contributor

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

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

One questions, otherwise looks good.

@bitwiseman bitwiseman merged commit 376f176 into jenkinsci:master Sep 11, 2019
@jglick jglick deleted the JENKINS_HOOK_URL branch September 11, 2019 15:27
@jglick
Copy link
Member Author

jglick commented Jan 6, 2021

see #310

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