Install private jenkins for CD jobs
[icn.git] / ci / README.md
1 # Setup a private Jenkins server from a refresh ubuntu 18.04
2
3 Akraino community has a publich jenkins cluster, we run CI jobs there.
4 But the CD jobs, we need to run them in our private Jenkins cluster.
5 For now, we support only one node private jenkins deployment.
6 The only supported OS is ubuntu 18.04
7
8 ## How to setup jenkins server
9
10 We define vars in `vars.yaml` to customize the deployment.
11 The default listening address is the default ip address of the Jenkins server.
12 To override the listening address/domain name, please set `jenkins_hostname`.
13 The default Jenkins username/password is `admin/admin`. To overrides it, please set
14 `jenkins_admin_username` and `jenkins_admin_password`.
15
16 ```bash
17 git clone "https://gerrit.akraino.org/r/icn" # may need to switch the branch based on your case
18 cd icn/ci
19 sudo ./install_ansible.sh
20 sudo ansible-playbook site_jenkins.yaml --extra-vars "@vars.yaml" -v
21 ```
22
23 Once the playbook is successful, we can visite the jenkins server at http://<listen_address>:8080.
24
25 ## What to do next
26
27 1. Add the gerrit ssh key as jenkins credential, so that our jobs can pull code from the gerrit.
28 The credential ID field must be `jenkins-ssh`. As this is hard coded in the jobs.
29 2. To push the logs to Akraino Nexus server, we need to create the authentication file for lftools.
30 The file path is `/var/lib/jenkins/.netrc` and the content should be one line
31 `machine nexus.akraino.org login the_name password the_pass`
32 3. The last step is to deploy our CD jobs by jenkins-job-builder tool.
33
34 ```
35 git clone "https://gerrit.akraino.org/r/ci-management"
36 git clone "https://gerrit.akraino.org/r/icn"
37 # create the jjb config file before moving on
38 # https://docs.releng.linuxfoundation.org/en/latest/jenkins-sandbox.html
39 jenkins-jobs test ci-management/jjb:icn/ci/jjb icn-master-verify
40 jenkins-jobs update ci-management/jjb:icn/ci/jjb icn-master-verify
41 ```