Update all references to Gerrit
[ci-management.git] / README.md
1 # Continuous Integration for O-RAN SC at LF
2
3 This repo contains configuration files for Jenkins jobs for the O-RAN
4 SC project.
5
6 ## Custom JJB templates for Docker Java projects
7
8 Custom JJB templates are defined for projects that use Maven to
9 compile Java code and build a Docker image.  These projects should use
10 the following jobs in the project.yaml file::
11
12     jobs:
13       - gerrit-maven-docker-verify
14       - gerrit-maven-docker-merge
15       - gerrit-maven-docker-stage
16
17
18 ## Testing the templates
19
20 These instructions explain how to test the templates using the Jenkins
21 sandbox.  This catches errors before submitting the changes as Gerrit
22 reviews.
23
24 ### Prerequisites
25
26 Install the Jenkins job builder:
27
28     pip install jenkins-job-builder
29
30 Check out the global JJB templates submodule within this repo:
31
32     git submodule update --init
33
34 ### Test Locally
35
36 Check sanity by running the Jenkins job-builder script in this directory:
37
38     jenkins-jobs test -r jjb
39
40 ### Deploy the templates to the Jenkins sandbox
41
42 Login (after requesting membership in group
43 oran-jenkins-sandbox-access) at the Jenkins sandbox:
44
45     https://jenkins.o-ran-sc.org/sandbox
46
47 Get the authentication token from the sandbox:
48     a) click on your user name (top right)
49     b) click Configure (left menu)
50     c) under API Token, click Add new Token (button)
51     d) copy the token string
52
53 Create a config file jenkins.ini using the following template and your
54 credentials (user name and API token from above)::
55
56     [job_builder]
57     ignore_cache=True
58     keep_descriptions=False
59     recursive=True
60
61     [jenkins]
62     query_plugins_info=False
63     url=https://jenkins.o-ran-sc.org/sandbox
64     user=YOUR-USER-NAME
65     password=YOUR-API-TOKEN
66
67 Build and deploy a specific job using the EXACT job name.
68
69     jenkins-jobs --conf jenkins.ini update jjb your-job-name-here
70
71 Examples:
72
73     jenkins-jobs --conf jenkins.ini update jjb project-maven-docker-verify-master-mvn33-openjdk8
74
75 In the sandbox visit the job page, then click the button "Build with
76 parameters" in left menu.
77
78 ### How to build from a Gerrit review branch
79
80 This explains how to launch a "verify" job in the Sandbox on an open
81 review.  Most "verify" jobs accept parameters to build code in a
82 review submitted to Gerrit.  You must specify the change ref spec,
83 which is a Git branch name.  Get this by inspecting Gerrit's
84 "download" links at the top right.  The branch name will be something
85 like this:
86
87         refs/changes/78/578/2
88
89 The first number is a mystery to me; the second number is the Gerrit
90 change number; the third number is the patch set within the change.
91
92 Enter this name for both the GERRIT_BRANCH and the GERRIT_REFSPEC
93 parameters, then click Build.