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