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

Make Slave 🠦 Jenkins conn. timeout configurable #141

Merged

Conversation

nehaljwani
Copy link
Contributor

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.

@nehaljwani nehaljwani force-pushed the introduce-slave➛jenkins-conn-timeout branch from 6137ca7 to 5b42e77 Compare February 26, 2017 16:20
Copy link
Contributor

@carlossg carlossg left a comment

Choose a reason for hiding this comment

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

@DataBoundSetter
public void setSlaveConnectTimeoutStr(String slaveConnectTimeoutStr) {
if (StringUtils.isBlank(slaveConnectTimeoutStr)) {
setSlaveConnectTimeout(100); // default
Copy link
Contributor

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.}">
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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.
@nehaljwani nehaljwani force-pushed the introduce-slave➛jenkins-conn-timeout branch from 5b42e77 to 2abc8cf Compare February 26, 2017 18:36
@nehaljwani
Copy link
Contributor Author

@carlossg I have updated the PR as per your comments.

@carlossg carlossg merged commit 6471a8e into jenkinsci:master Feb 27, 2017
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.

2 participants