3 The purpose of this repository is store generically defined, reusable JJB
4 templates, deployable across LF projects.
6 Define the following variables in the Jenkins server as
7 global environment variables as scripts in this repo expect these variables to
13 GIT_URL=ssh://jenkins-$SILO@git.opendaylight.org:29418
14 GIT_CLONE_URL=git@github.com:
15 JENKINS_HOSTNAME=jenkins092
16 LOGS_SERVER=https://logs.opendaylight.org
17 NEXUS_URL=https://nexus.opendaylight.org
19 SONAR_URL=https://sonar.opendaylight.org
22 Note: Use **GIT_CLONE_URL** for GitHub projects as this
23 will be different from the URL used the poperties
26 ## Jenkins Plugin Requirements
30 - Config File Provider
32 - Environment Injector Plugin
38 **Required for Gerrit connected systems**
42 **Required for GitHub connected systems**
45 - GitHub Pull Request Builder
54 ## Installing global-jjb
56 Deploy global-jjb in the ci-management repository's jjb directory as
57 a submodule. Installing, upgrading, and rolling back changes is simple via the
61 # Choose a global-jjb version to install
62 GLOBAL_JJB_VERSION=v0.1.0
64 # Add the new submodule to ci-management's jjb directory.
65 # Note: Perform once per ci-management repo.
67 git submodule add https://gerrit.linuxfoundation.org/infra/releng/global-jjb
69 # Checkout the version of global-jjb you wish to deploy.
71 git checkout $GLOBAL_JJB_VERSION
73 # Commit global-jjb version to the ci-management repo.
75 git add jjb/global-jjb
76 git commit -sm "Install global-jjb $GLOBAL_JJB_VERSION"
78 # Push the patch to ci-management for review
82 ## Parameters stored in defaults.yaml
84 Configure the following parameters in the ci-management repo's
87 **gerrit-server-name**: The name of the Gerrit Server as defined
88 in Gerrit Trigger global configuration.
90 **jenkins-ssh-credential**: The name of the Jenkins Credential to
91 use for ssh connections.
93 If you are using GitHub then configure the following parameters
96 **git-url**: Set this to the base URL of your GitHub repo. In
97 general this should be <https://github.com>. If you are using
98 GitHub Enterprise, or some other GitHub-style system, then it
99 should be whatever your installation base URL is.
101 **git-clone-url**: This is the clone prefix used by GitHub jobs.
102 Set this to either the same thing as **git-url** or the
103 'git@github.com:' including the trailing ':'
105 **github-org**: The name of the GitHub organization interpolated
108 **github_pr_org**: The name of the GitHub organization. All members
109 of this organization will be able to trigger any job using the
110 `lf-infra-github-pr` macro.
112 **github_pr_whitelist**: List of GitHub members you wish to be able to
113 trigger any job that uses the `lf-infra-github-pr-trigger` macro.
115 **github_pr_admin_list**: List of GitHub members that will have admin
116 privileges on any job using the `lf-infra-github-pr-trigger`
119 **lftools-version**: Version of lftools to install. Can be a specific version
120 like '0.6.1' or a PEP-440 definition. <https://www.python.org/dev/peps/pep-0440/>
121 For example `<1.0.0` or `>=1.0.0,<2.0.0`.
123 **mvn-site-id**: Maven Server ID from settings.xml containing the credentials
124 to push to a Maven site repository.
126 **mvn-staging-id**: Maven Server ID from settings.xml containing the credentials
127 to push to a Maven staging repository.
136 jenkins-ssh-credential: opendaylight-jenkins-ssh
137 gerrit-server-name: OpenDaylight
143 github_pr_admin_list:
145 lftools-version: '<1.0.0'
146 mvn-site-id: opendaylight-site
149 ## Config File Management
153 The logs account requires a Maven Settings file created called
154 **jenkins-log-archives-settings** with a server ID of **logs** containing the
155 credentials for the logs user in Nexus.
159 The CI job group contains jobs that should deploy in all LF
160 Jenkins infra. The minimal configuration needed to deploy the ci-management
161 jobs is as follows which deploys the **{project-name}-ci-jobs** job group as
162 defined in **lf-ci-jobs.yaml**.
171 - '{project-name}-ci-jobs'
173 project: ci-management
174 project-name: ci-management
175 build-node: centos7-basebuild-2c-1g
180 **project**: is the project repo as defined in source control.
181 **project-name**: is a custom name to call the job in Jenkins.
182 **build-node**: is the name of the builder to use when building (Jenkins label).
186 **branch**: is the git branch to build from.
187 **jjb-version**: is the version of JJB to install in the build minion.
189 ## Deploying packer-jobs
191 The packer job group contains jobs to build custom minion images. The minimal
192 configuration needed to deploy the packer jobs is as follows which deploys the
193 **{project-name}-packer-jobs** job group as defined in **lf-ci-jobs.yaml**.
202 - '{project-name}-packer-jobs'
204 project: ci-management
205 project-name: ci-management
207 build-node: centos7-basebuild-2c-1g
230 **project**: is the project repo as defined in source control.
231 **project-name**: is a custom name to call the job in Jenkins.
232 **build-node**: is the name of the builder to use when building (Jenkins label).
233 **platforms**: is a list of supported platforms.
234 **templates**: is a list of supported templates.
238 **branch**: is the git branch to build from.
239 **packer-version**: is the version of packer to install in the build minion,
240 when packer is not available.
241 **exclude**: is a combination of platforms and templates which are not required
244 ## Deploying Python jobs
246 We provide the following Python jobs templates:
248 ### {project-name}-tox-verify-{stream}
250 Use this job to call python-tox to run builds and tests. The most common
251 usage of this job is to run the Coala linter against projects.
257 - '{project-name}-tox-verify-{stream}'
259 project-name: builder
260 project: releng/builder
261 build-node: centos7-java-builder-2c-4g
267 **project**: is the project repo as defined in source control.
268 **project-name**: is a custom name to call the job in Jenkins.
269 **build-node**: is the name of the builder to use when building (Jenkins label).
270 **stream**: typically `master` or matching the build branch. This
271 is a useful keywords to map a release codename to a branch. For
272 example OpenDaylight uses this to map stream=carbon to
273 branch=stable/carbon.
277 **branch**: is the git branch to build from.
278 **jjb-version**: is the version of JJB to install in the build minion.
279 **tox-dir**: directory containing tox.ini file (default: '')
280 **tox-envs**: tox environments to run (default: '')
282 ## Archiving logs in Jobs
284 There are 2 ways supported for archiving log information:
286 1) Job creates $WORKSPACE/archives directory and places logs there
288 This method pushes the entire archives directory to the log server
289 in the same structure as configured in the archives directory.
291 2) Via job variable ARCHIVE_ARTIFACTS using globstar patterns.
293 In this method a job can define a globstar for example `**/*.log` which then
294 causes the archive script to do a globstar search for that pattern and archives
295 any files it finds matching.
297 ## Overriding merge and verify triggers
299 The default trigger conditions for Merge and Verify job types are overrideable
300 in a project configuration by overriding the following variables:
302 - gerrit_merge_triggers
303 - gerrit_verify_triggers
305 These variables take a list of trigger-on values as defined in JJB docs here:
306 <https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit>
312 When using ShellCheck to lint global-jjb or any projects that include
313 global-jjb as part of their project (common with ci-management repos) then
314 we require version 0.4.x of ShellCheck installed on the build vms. This version
315 introduces annotations used by shell scripts in this repo.