Setup Jenkins server - AD-EYE/AD-EYE_Core GitHub Wiki
How to install Jenkins
First, ensure to have OpenJDK with Java 8 or 11 installed on your computer.
Then in a terminal, type:
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 -y
sudo apt-get install jenkins -y
To run the software you need: sudo systemctl start jenkins
For the first time you will launch Jenkins, you have to type: sudo systemctl enable jenkins
Now, to open Jenkins you can browse to http://localhost:8080
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
On the next page you can install suggested plugins and then choose username and password for the new admin account.
How to setup Jenkins tests
First, to link it to a GitHub repository using a GitHub App, just follow this tutorial: https://github.com/jenkinsci/github-branch-source-plugin/blob/master/docs/github-app.adoc
To create a job, click on New item in the left menu and then create a Freestyle project
Then, in the Build section, choose Execute shell and enter your commands to run tests
How to automate tests
In Manage Jenkins -> Configure System, add https://gits-15.sys.kth.se/api/v3
API URL and API endpoint in GitHub server and in GitHub Enterprise servers
Send a message on Slack at every push
To automate tests after each push, you can follow this video tutorial: https://www.youtube.com/watch?v=Moe2D3Rstc4
Important information: when you create the webhook, for the Payload URL, http://localhost:8080/github-webhook/ and replace localhost by your IP address
To send the results of the tests in a Slack channel, you can follow this tutorial: https://medium.com/@gustavo.guss/jenkins-and-slack-integration-fbb031cd7895
Launch a test at every pull request
For that, you should install Github Pull RequestBuilder plugin. Then you can follow this tutorial: https://devopscube.com/jenkins-build-trigger-github-pull-request/ with some specific information
Because we use GitHub Enterprise, the API URL to enter in system configuration is https://gits-15.sys.kth.se/api/v3
And then you should add the webhook Payload URL as Jenkins URL override
And link it with the GitHub app created previously as credential.
For the webhook, you can't use the same as for push automation. So you have to create a new one with the Payload URL format like in the tutorial.