Permalink
Browse files

Allow the default port to be more easily configured.

Docker images and other automation use cases often want to make Jenkins
use specific port. Today they do this via init.groovy.d with a
problematic sleep timeout, so allow them to control this value via
system property.
  • Loading branch information...
kohsuke committed Dec 19, 2015
1 parent 9a54623 commit 653fbdb65024b1b528e21f682172885f7111bba9
Showing with 1 addition and 1 deletion.
  1. +1 −1 core/src/main/java/jenkins/model/Jenkins.java
@@ -566,7 +566,7 @@ protected void onModified() throws IOException {
* TCP slave agent port.
* 0 for random, -1 to disable.
*/
- private int slaveAgentPort =0;
+ private int slaveAgentPort = Integer.getInteger(Jenkins.class.getName()+".slaveAgentPort",0);
/**
* Whitespace-separated labels assigned to the master as a {@link Node}.

12 comments on commit 653fbdb

@KostyaSha

This comment has been minimized.

Show comment
Hide comment
@KostyaSha

KostyaSha Dec 20, 2015

Member

@kohsuke could you do your changes using PRs?

Member

KostyaSha replied Dec 20, 2015

@kohsuke could you do your changes using PRs?

@KostyaSha

This comment has been minimized.

Show comment
Hide comment
@KostyaSha

KostyaSha Dec 20, 2015

Member

👎 for such change and 👎 for direct commits into master even if you are @kohsuke .
This change doesn't follow #1914

Member

KostyaSha replied Dec 20, 2015

👎 for such change and 👎 for direct commits into master even if you are @kohsuke .
This change doesn't follow #1914

@kohsuke

This comment has been minimized.

Show comment
Hide comment
@kohsuke

kohsuke Dec 20, 2015

Member

OK, I do use PR when I think a change warrants that (for example this), and in other cases I push through J-on-J. This felt like such a trivial enough change that the latter was well justified. I also thought this is non-controversial, though apparently I was wrong there.

I'm not following the last part of your comment. Clearly I cannot depend on a feature that's not in the code yet.

Member

kohsuke replied Dec 20, 2015

OK, I do use PR when I think a change warrants that (for example this), and in other cases I push through J-on-J. This felt like such a trivial enough change that the latter was well justified. I also thought this is non-controversial, though apparently I was wrong there.

I'm not following the last part of your comment. Clearly I cannot depend on a feature that's not in the code yet.

@KostyaSha

This comment has been minimized.

Show comment
Hide comment
@KostyaSha

KostyaSha Dec 20, 2015

Member

This felt like such a trivial enough change that the latter was well justified.

Not only you depend on some changes in core. That's your point of view and core has many contributors that may think other. During review you may get other points of views.

Sorry, what part is not clear? One person from community spent time and picked all magic system variables and proposed change, after your commit it introduces other way of configuration again.

I checked and found that:

Your simple change (because of workflow?) leads to undocumented variables. Now other people should spend their time (rebasing proposed PR to pick your variable, update documentation) even on such trivial change.

Member

KostyaSha replied Dec 20, 2015

This felt like such a trivial enough change that the latter was well justified.

Not only you depend on some changes in core. That's your point of view and core has many contributors that may think other. During review you may get other points of views.

Sorry, what part is not clear? One person from community spent time and picked all magic system variables and proposed change, after your commit it introduces other way of configuration again.

I checked and found that:

Your simple change (because of workflow?) leads to undocumented variables. Now other people should spend their time (rebasing proposed PR to pick your variable, update documentation) even on such trivial change.

@KostyaSha

This comment has been minimized.

Show comment
Hide comment
@KostyaSha

KostyaSha Dec 21, 2015

Member

Now i got this issue, why answer in header available after some delay at all? (CliPort connection fails, CLI switches to buggy http connection). Will be glad to see filled jira issue as it smells like a bug.

Member

KostyaSha replied Dec 21, 2015

Now i got this issue, why answer in header available after some delay at all? (CliPort connection fails, CLI switches to buggy http connection). Will be glad to see filled jira issue as it smells like a bug.

@KostyaSha

This comment has been minimized.

Show comment
Hide comment
@KostyaSha

KostyaSha Dec 22, 2015

Member

Or it not used for CLI?

Member

KostyaSha replied Dec 22, 2015

Or it not used for CLI?

@daniel-beck

This comment has been minimized.

Show comment
Hide comment
@daniel-beck

daniel-beck Dec 22, 2015

Member

Naming inconsistent with the corresponding option hudson.TcpSlaveAgentListener.hostName.

Member

daniel-beck replied Dec 22, 2015

Naming inconsistent with the corresponding option hudson.TcpSlaveAgentListener.hostName.

@daniel-beck

This comment has been minimized.

Show comment
Hide comment
@daniel-beck

daniel-beck Dec 22, 2015

Member

@kohsuke Does this capture the intended behavior correctly?

Specifies the default TCP slave agent port unless/until configured differently on the UI. -1 to disable, 0 for random port, other values for fixed port.

Member

daniel-beck replied Dec 22, 2015

@kohsuke Does this capture the intended behavior correctly?

Specifies the default TCP slave agent port unless/until configured differently on the UI. -1 to disable, 0 for random port, other values for fixed port.

@KostyaSha

This comment has been minimized.

Show comment
Hide comment
@KostyaSha

KostyaSha May 3, 2016

Member

No replies, could be reverted?

Member

KostyaSha replied May 3, 2016

No replies, could be reverted?

@alexellis

This comment has been minimized.

Show comment
Hide comment
@alexellis

alexellis May 3, 2016

Can the TCP port also be configured through an environmental variable for use on Docker?

Can the TCP port also be configured through an environmental variable for use on Docker?

@kohsuke

This comment has been minimized.

Show comment
Hide comment
@kohsuke

kohsuke May 3, 2016

Member

@daniel-beck yes it does capture the intended behaviour correctly.

@alexellis When I did this change, there was an in-flight PR that enables such dual support for every similar configuration option, and I was assuming that when that comes in, we'll change this as well. I'm not seeing it in the core today and I cannot find that PR right now.

Member

kohsuke replied May 3, 2016

@daniel-beck yes it does capture the intended behaviour correctly.

@alexellis When I did this change, there was an in-flight PR that enables such dual support for every similar configuration option, and I was assuming that when that comes in, we'll change this as well. I'm not seeing it in the core today and I cannot find that PR right now.

@daniel-beck

This comment has been minimized.

Show comment
Hide comment
@daniel-beck

daniel-beck May 3, 2016

Member

@kohsuke It's still open: #1914

Member

daniel-beck replied May 3, 2016

@kohsuke It's still open: #1914

Please sign in to comment.