-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make Slave 🠦 Jenkins conn. timeout configurable #141
The head ref may contain hidden characters: "introduce-slave\u279Bjenkins-conn-timeout"
Make Slave 🠦 Jenkins conn. timeout configurable #141
Conversation
6137ca7
to
5b42e77
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Added some comments, and it is missing a help text like https://github.com/nehaljwani/kubernetes-plugin/blob/5b42e773214cea6bcb91cccda411cc94f5c78c00/src/main/resources/org/csanchez/jenkins/plugins/kubernetes/PodTemplate/help-annotations.html
@DataBoundSetter | ||
public void setSlaveConnectTimeoutStr(String slaveConnectTimeoutStr) { | ||
if (StringUtils.isBlank(slaveConnectTimeoutStr)) { | ||
setSlaveConnectTimeout(100); // default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have a constant instead of 100
@@ -40,6 +40,10 @@ | |||
<f:textbox/> | |||
</f:entry> | |||
|
|||
<f:entry field="slaveConnectTimeoutStr" title="${%Timeout in seconds for slave 🡒 jenkins conn.}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write Jenkins connection
, for a better description
is there a bad char 🡒 ?
@@ -202,6 +204,18 @@ public int getInstanceCap() { | |||
return instanceCap; | |||
} | |||
|
|||
public void setSlaveConnectTimeout(int slaveConnectTimeout) { | |||
if (slaveConnectTimeout < 0) { | |||
this.slaveConnectTimeout = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to set it to the default and log a warning
} | ||
|
||
public int getSlaveConnectTimeout() { | ||
return slaveConnectTimeout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when upgrading slaveConnectTimeout won't be in the object, so it will get set to 0 IIRC
You need to handle it in readResolve
to set it to the default, or here to return the default if it is 0
For certain slaves, there might be a need to perform some runtime configuration/steps after getting scheduled, but before starting the jenkins job. The default timeout of 100s might not be sufficient for such a scenario. To cater to this use case, this patch introduces the ability to configure the slave to jenkins connection timeout, defaulting to 100s for backwards compatibility.
5b42e77
to
2abc8cf
Compare
@carlossg I have updated the PR as per your comments. |
For certain slaves, there might be a need to perform some runtime
configuration/steps after getting scheduled, but before starting the
jenkins job. The default timeout of 100s might not be sufficient for
such a scenario. To cater to this use case, this patch introduces the
ability to configure the slave to jenkins connection timeout, defaulting
to 100s for backwards compatibility.