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.
Setup
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 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) you need to specify which shell you want to use:
# su -s /bin/bash jenkins
Running Jenkins with access to the display
If Jenkins needs to run graphics applications that fail without a display (for example unity-editorAUR). Instead of running Jenkins as a service, it needs to run from a terminal with display environment variables.
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!