Skip to content

Conversation

@fr123k
Copy link

@fr123k fr123k commented Mar 28, 2021

The reason for this change is that the JenkinRule based tests were all running
inside a docker container and i needed a way to bind it a non localhost address
in order to access it from outside the running container.

The host binding for the JenkinsRule is configurable with the host
property. The default value is localhost this keeps the backward
compatibility.

The following code snippet shows how to bind the JenkinsRule instance

@Rule public JenkinsRule j = new JenkinsRule() {{
    host = null;
  }
};

to all network interfaces. This is similar to set the host value to 0.0.0.0.

The test case JenkinsRuleHostIPTest validates that the assignment to a specific
host ip address is working correctly.

The test case JenkinsRuleAllHostInterfaceTest validates that the assignment to all
network interfaces is working correctly.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your master 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

@fr123k fr123k force-pushed the fr/add_remote_host_support branch 2 times, most recently from e6646b6 to 580910c Compare March 28, 2021 15:10
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.

Looks good to me 👍

The reason for this change is that the JenkinRule based tests were all running
inside a docker container and i needed a way to bind it a non localhost address
in order to access it from outside the running container.

The host binding for the JenkinsRule is configurable with the `host`
property. The default value is `localhost` this keeps the backward
compatibility.

The following code snippet shows how to bind the JenkinsRule instance
```
@rule public JenkinsRule j = new JenkinsRule() {{
    host = null;
  }
};
```
to all network interfaces. This is similar to set the `host` value to `0.0.0.0`.

The test case `JenkinsRuleHostIPTest` validates that the assignment to a specific
host ip address is working correctly.

The test case `JenkinsRuleAllHostInterfaceTest` validates that the assignment to all
network interfaces is working correctly.
@fr123k fr123k force-pushed the fr/add_remote_host_support branch from 580910c to 8f860d2 Compare March 29, 2021 14:59
@jglick
Copy link
Member

jglick commented Mar 29, 2021

@jglick jglick requested a review from Vlatombe March 29, 2021 17:23
@fr123k
Copy link
Author

fr123k commented Mar 29, 2021

That's true if you bind JenkinsRule instance to 0.0.0.0. Then its possible to access it from remote depends on the network setup.

I could add a log warning too.

The default is still localhost and has to be conciously overwritten with a different IP or hostname.

@fr123k fr123k closed this Mar 29, 2021
@fr123k fr123k reopened this Mar 29, 2021
@oleg-nenashev oleg-nenashev self-requested a review April 17, 2021 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants