Add upgrade documentation
[icn.git] / ci / README.md
1 # Setup a private Jenkins server from a fresh Ubuntu 18.04
2
3 Akraino community has a public 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.  The
6 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.  The
11 default listening address is the default IP address of the Jenkins
12 server.  To override the listening address/domain name, please set
13 `jenkins_hostname`.  The default Jenkins username/password is
14 `admin/admin`. To override it, please set `jenkins_admin_username` and
15 `jenkins_admin_password`.
16
17 1. If deploying the Jenkins server on a machine configured with KuD
18    (i.e. an ICN jump server), first remove the `ANSIBLE_CONFIG` line
19    from `/etc/environment` and login again.
20
21    ``` shell
22    ./ci.sh cleanup-after-kud
23    logout
24    ```
25
26 2. Install the Jenkins server into the machine. If the VM verifier
27    Jenkins job will not be added later, set `WITH_VAGRANT=no` in the
28    environment before running the install step.
29
30    ``` shell
31    # Use one of the following
32    WITH_VAGRANT=no ./ci.sh install-jenkins
33    ./ci.sh install-jenkins
34    ```
35
36    After the script has completed, the Jenkins server can be visited
37    at http://<listen_address>:8080.
38
39 3. Add the Gerrit ssh key as Jenkins credential, so that the jobs can
40    pull code from Gerrit. `JENKINS_SSH_PRIVATE_KEY` is the path to the
41    private key file of the `icn.jenkins` Gerrit account.
42
43    ``` shell
44    JENKINS_SSH_PRIVATE_KEY="path/to/icn.jenkins/id_rsa"
45    ./ci.sh install-credentials
46    ```
47
48   To use a different account, edit `git-url` in `jjb/defaults.yaml`
49   with the account name and execute the above command with the
50   username specified.
51
52    ``` shell
53    JENKINS_SSH_USERNAME="username"
54    JENKINS_SSH_PRIVATE_KEY="path/to/username/id_rsa"
55    ./ci.sh install-credentials
56    ```
57
58 4. To push the logs to Akraino Nexus server, we need to create the
59    authentication file for lftools.
60
61    ``` shell
62    JENKINS_LFTOOLS_USERNAME="username"
63    JENKINS_LFTOOLS_PASSWORD="password"
64    ./ci.sh install-lftools-credentials
65    ```
66
67 5. Add the ICN Jenkins jobs to Jenkins. The script adds only a subset
68    of the available jobs; review the script for information about
69    other jobs.
70
71    ``` shell
72    ./ci.sh update-jobs
73    ```
74
75 ## Job specific instructions
76
77 ### icn-bluval
78
79 The Bluval job requires that Jenkins ssh into the cluster control
80 plane. The script can be used to create a new keypair for the
81 `jenkins` user and install the credentials into an existing cluster.
82
83 For example, where the control plane endpoint is at `192.168.151.254`
84 and there exists `/home/ubuntu/.kube/config`:
85
86 ``` shell
87 CLUSTER_MASTER_IP=192.168.151.254
88 CLUSTER_SSH_USER=root
89 ./ci.sh install-jenkins-id
90 ```
91
92 The same values of `CLUSTER_MASTER_IP` and `CLUSTER_SSH_USER` should
93 be provided to the icn-bluval job in Jenkins. Note that
94 `CLUSTER_SSH_USER` must be `root` for the Bluval Lynis testing to
95 succeed.