Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
879 views
in Technique[技术] by (71.8m points)

hudson - Increase the Jenkins login timeout

Does anyone know how to increase the the timeout window before Jenkins logs out a user? I'm looking to raise it to 1 day or so.

I work in and out jenkins all day and we keep getting logged out between running of jobs. Added to this frustration, the 'stay logged in' checkbox doesn't seem to work either.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Jenkins uses Jetty, and Jetty's default timeout is 30 minutes. This is independent of authentication settings -- I use Active Directory but it's still this setting that affects timeouts.

You can override the timeout by passing an argument --sessionTimeout=<minutes> to the Jenkins init script, or -DsessionTimeout=<minutes> to the .war file. For example:

# Set the session timeout to 1 week
$ java -jar jenkins.war --sessionTimeout=10080

Alternatively, you can edit Jenkins' <jenkinsHome>/.jenkins/war/WEB-INF/web.xml and add explicitly set it:

<session-config>
  <!-- one hour -->
  <session-timeout>60</session-timeout>
</session-config>

According to Oracle's docs you can set this to 0 to disable timeouts altogether.

To find out the current value for timeouts, you can use the Groovy console provided in Jenkins:

import org.kohsuke.stapler.Stapler;
Stapler.getCurrentRequest().getSession().getMaxInactiveInterval() / 60

On my instance, this shows Result: 30.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...