Jenkins
Jenkins is an open source continuous integration server written in Java. It is capable of running scheduled automated builds and test suites of managed software projects. The build or tests for example may be triggered on a per commit basis or in a calendar driven manner. Jenkins thereby relies on the code being managed via a version control system (see git) and an automated build process. Note that Jenkins is not limited to Java applications and is suitable to manage projects in all common languages. Its capabilities can be further expanded by plugins.
Installation
Install jenkins for the latest stable release or jenkins-ltsAUR for the long-term-support version. The package will create a Jenkins user for the daemon using systemd-sysusers. If running on a server with only console access, also install packages fontconfig and freetype2.
Configuration
In order to enable jenkins, you need to have jre11-openjdk or jre17-openjdk and the path to your version of Java Runtime Environment must be in the first line of the jenkins config file at /etc/conf.d/jenkins
, if this is not the case, the jenkins.service
will fail to start
Project configuration can be done using the built-in web interface. To access it start/enable jenkins.service
.
You can now open http://localhost:8090
with your browser and start setting up Jenkins.
The configuration file of the daemon running Jenkins is located at /etc/conf.d/jenkins
. It is sourced by the according .service
file and takes effect immediately after a restart.
jenkins listens on 0.0.0.0
and is immediately available remotely. If this is unwanted, for example on a test server, consider adding --httpListenAddress=127.0.0.1
to the configuration file (e.g. in JENKINS_OPTS
).
Log in as the Jenkins user
The default Admin username is Admin. When you log into the Web interface at http://localhost:8090
; you will need to view the file at /var/lib/jenkins/secrets/initialAdminPassword
or run journalctl -u jenkins.service
and search for the default password that was created upon installation.
The home folder of the jenkins
user is located at /var/lib/jenkins
. The Jenkins user does not have a default shell, so if you need to log in this user (for example to manage SSH keys) see su#Nologin users.
Running Jenkins with access to the display
If Jenkins needs to run graphical applications that fail without a display (for example, the Unity Editor), you must run it from a desktop session. If you are running GNOME, you can do the following to automatically run Jenkins with access to the display:
- Give Jenkins a login shell.
# usermod -s /bin/bash jenkins
- Give Jenkins a password.
# passwd jenkins
- Set Jenkins to automatically login using GDM.
/etc/gdm/custom.conf
# Enable automatic login for user [daemon] AutomaticLogin=jenkins AutomaticLoginEnable=True
- Add a new autostart application of your favorite terminal running jenkins.
/var/lib/jenkins/.config/autostart/jenkins.desktop
# Launch a gnome terminal, using a bash shell to launch jenkins. [Desktop Entry] Type=Application Exec=gnome-terminal -x bash -c "JENKINS_HOME=~ java -jar /usr/share/java/jenkins/jenkins.war; exec bash" Hidden=false X-GNOME-Autostart-enabled=true Name=jenkins Comment=Jenkins auto-start
After a reboot, GDM should automatically log into a gnome session. Then gnome should launch a terminal running a jenkins instance. This instance should be able to build Unity games without issue!