wiki:increase_jenkins_user_session_timeout
Table of Contents
Increase jenkins user session timeout
Add these option to java starting arguments
–sessionTimeout=1440 –sessionEviction=43200
e.g.
root@debian11-21:[~]: ps fauxw | grep jenk jenkins 18642 0.3 31.6 4715720 1268388 ? Ssl Dec20 4:05 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --sessionTimeout=1440 --sessionEviction=43200
If its started via systemd add the override file /etc/systemd/system/jenkins.service.d/override.conf
with content
JENKINS_OPTS=--sessionTimeout=1440 --sessionEviction=43200
Reload daemon and service:
systemctl daemon-reload systemctl restart jenkins
Ansible steps:
- name: Create a jenkins.service override directory
file:
owner: root
group: root
mode: 0755
path: /etc/systemd/system/jenkins.service.d
state: directory
- name: Increase session timeout for logged in users
ini_file:
dest: /etc/systemd/system/jenkins.service.d/override.conf
owner: root
group: root
mode: 0644
section: Service
option: Environment
value: '"JENKINS_OPTS=--sessionTimeout=1440 --sessionEviction=43200"'
- name: Restart jenkins
systemd:
name: jenkins
daemon_reload: yes
state: restarted
Docker
Example from docker compose file:
jenkins:
# https://hub.docker.com/r/jenkins/jenkins/tags?page=1&name=lts
build:
context: .
dockerfile: Dockerfile-jenkins-docker
container_name: jenkins-docker
networks:
- buildnet
restart: always
environment:
- TZ=Europe/Berlin
- JENKINS_OPTS=--sessionTimeout=1440 --sessionEviction=43200 # increase user session duration
Tested on
- Jenkins 2.414.1
See also
References
wiki/increase_jenkins_user_session_timeout.txt · Last modified: by antisa
