jenkins.md 2.1 KB

Jenkins

How to install and administrate Jenkins.

Install

Java

You need Java 8 or 11 if you have Jenkins above 2.164.

sudo apt install openjdk-8-jre

Raspberry Pi

Jenkins doc : installation

To execute on debian server

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - ;
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' ;
sudo apt-get update ;
sudo apt-get install jenkins ;

Jenkins is now installed as a daemon and you should connect locally to it with a browser to complete installation.

192.168.0.40:8080

HTTPS

The best way to secure Jenkins is to use the proxy with Apache.

Jenkins wiki : running Jenkins behind Apache

See the JovianHttpd repository to see the template for configuration.

Integration

Integrate Jenkins with other tools

Gogs

Plugin

Install gogs-webhook plugin.

Documentation on plugins.jenkins.io.

Add webhook on Gogs side

In the Gogs repository settings, add the webhook

https://jenkins.jovian-hersemeule.eu/gogs-webhook/?job=experiments/connect

Adapt job name.

Private communication

  • Create a Jenkins account on Gogs
  • Generate an SSH key with ssh-keygen
  • Create credentials under Jenkins and store private key and passphrase
  • Put SSH public key in Jenkins account on Gogs
  • On Gogs : Add Jenkins user with read rights to any repository Jenkins has to build

Apache2 http server

How to deploy on a Httpd server.

Grant jenkins user

You have to set jenkins user owner of the targeted folder.

Trouble shooting

Logs

In file /var/log/jenkins/jenkins.log

Git describe

To allow the command git describe to work, go to your job configuration and add an Advanced Cloned Behoviours and tick the tags checkbox.

Configure

Configuration parameters can be found at /etc/default/jenkins

Useful plugins

Basic Branch strategy

Useful to build tags.