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 GERRIT_URL=https://git.opendaylight.org/gerrit
14 GIT_URL=ssh://jenkins-$SILO@git.opendaylight.org:29418
15 GIT_CLONE_URL=git@github.com:
16 JENKINS_HOSTNAME=jenkins092
17 LOGS_SERVER=https://logs.opendaylight.org
18 NEXUS_URL=https://nexus.opendaylight.org
20 SONAR_URL=https://sonar.opendaylight.org
23 Note: Use **GIT_CLONE_URL** for GitHub projects as this
24 will be different from the URL used the poperties
27 ## Jenkins Plugin Requirements
31 - [Config File Provider](https://plugins.jenkins.io/config-file-provider)
32 - [Description Setter](https://plugins.jenkins.io/description-setter)
33 - [Environment Injector Plugin](https://plugins.jenkins.io/envinject)
34 - [Git plugin](https://plugins.jenkins.io/git)
35 - [Post Build Script](https://plugins.jenkins.io/postbuildscript)
36 - [SSH Agent](https://plugins.jenkins.io/ssh-agent)
37 - [Workspace Cleanup](https://plugins.jenkins.io/ws-cleanup)
39 **Required for Gerrit connected systems**
41 - [Gerrit Trigger](https://plugins.jenkins.io/gerrit-trigger)
43 **Required for GitHub connected systems**
45 - [GitHub plugin](https://plugins.jenkins.io/github)
46 - [GitHub Pull Request Builder](https://plugins.jenkins.io/ghprb)
50 - [Mask Passwords](https://plugins.jenkins.io/mask-passwords)
51 - [MsgInject](https://plugins.jenkins.io/msginject)
52 - [OpenStack Cloud](https://plugins.jenkins.io/openstack-cloud)
53 - [Timestamps](https://plugins.jenkins.io/timestamper)
55 ## Installing global-jjb
57 Deploy global-jjb in the ci-management repository's jjb directory as
58 a submodule. Installing, upgrading, and rolling back changes is simple via the
62 # Choose a global-jjb version to install
63 GLOBAL_JJB_VERSION=v0.1.0
65 # Add the new submodule to ci-management's jjb directory.
66 # Note: Perform once per ci-management repo.
69 # For production deployments:
70 git submodule add https://github.com/lfit/releng-global-jjb global-jjb
71 # For test deployments comment the above and uncomment the below
72 # git submodule add https://gerrit.linuxfoundation.org/infra/releng/global-jjb
74 # Checkout the version of global-jjb you wish to deploy.
76 git checkout $GLOBAL_JJB_VERSION
78 # Commit global-jjb version to the ci-management repo.
80 git add jjb/global-jjb
81 git commit -sm "Install global-jjb $GLOBAL_JJB_VERSION"
83 # Push the patch to ci-management for review
87 ## Parameters stored in defaults.yaml
89 Configure the following parameters in the ci-management repo's
92 **gerrit-server-name**: The name of the Gerrit Server as defined
93 in Gerrit Trigger global configuration.
95 **jenkins-ssh-credential**: The name of the Jenkins Credential to
96 use for ssh connections.
98 If you are using GitHub then configure the following parameters
101 **git-url**: Set this to the base URL of your GitHub repo. In
102 general this should be <https://github.com>. If you are using
103 GitHub Enterprise, or some other GitHub-style system, then it
104 should be whatever your installation base URL is.
106 **git-clone-url**: This is the clone prefix used by GitHub jobs.
107 Set this to either the same thing as **git-url** or the
108 'git@github.com:' including the trailing ':'
110 **github-org**: The name of the GitHub organization interpolated
113 **github_pr_org**: The name of the GitHub organization. All members
114 of this organization will be able to trigger any job using the
115 `lf-infra-github-pr` macro.
117 **github_pr_whitelist**: List of GitHub members you wish to be able to
118 trigger any job that uses the `lf-infra-github-pr-trigger` macro.
120 **github_pr_admin_list**: List of GitHub members that will have admin
121 privileges on any job using the `lf-infra-github-pr-trigger`
124 **lftools-version**: Version of lftools to install. Can be a specific version
125 like '0.6.1' or a PEP-440 definition. <https://www.python.org/dev/peps/pep-0440/>
126 For example `<1.0.0` or `>=1.0.0,<2.0.0`.
128 **mvn-site-id**: Maven Server ID from settings.xml containing the credentials
129 to push to a Maven site repository.
131 **mvn-staging-id**: Maven Server ID from settings.xml containing the credentials
132 to push to a Maven staging repository.
141 jenkins-ssh-credential: opendaylight-jenkins-ssh
142 gerrit-server-name: OpenDaylight
148 github_pr_admin_list:
150 lftools-version: '<1.0.0'
151 mvn-site-id: opendaylight-site
154 ## Config File Management
158 The logs account requires a Maven Settings file created called
159 **jenkins-log-archives-settings** with a server ID of **logs** containing the
160 credentials for the logs user in Nexus.
164 The CI job group contains jobs that should deploy in all LF
165 Jenkins infra. The minimal configuration needed to deploy the ci-management
166 jobs is as follows which deploys the **{project-name}-ci-jobs** job group as
167 defined in **lf-ci-jobs.yaml**.
176 - '{project-name}-ci-jobs'
178 project: ci-management
179 project-name: ci-management
180 build-node: centos7-basebuild-2c-1g
185 **project**: is the project repo as defined in source control.
186 **project-name**: is a custom name to call the job in Jenkins.
187 **build-node**: is the name of the builder to use when building (Jenkins label).
191 **branch**: is the git branch to build from.
192 **jjb-version**: is the version of JJB to install in the build minion.
194 ## Deploying packer-jobs
196 The packer job group contains jobs to build custom minion images. The minimal
197 configuration needed to deploy the packer jobs is as follows which deploys the
198 **{project-name}-packer-jobs** job group as defined in **lf-ci-jobs.yaml**.
207 - '{project-name}-packer-jobs'
209 project: ci-management
210 project-name: ci-management
212 build-node: centos7-basebuild-2c-1g
235 **project**: is the project repo as defined in source control.
236 **project-name**: is a custom name to call the job in Jenkins.
237 **build-node**: is the name of the builder to use when building (Jenkins label).
238 **platforms**: is a list of supported platforms.
239 **templates**: is a list of supported templates.
243 **branch**: is the git branch to build from.
244 **packer-version**: is the version of packer to install in the build minion,
245 when packer is not available.
246 **exclude**: is a combination of platforms and templates which are not required
249 ## Deploying Python jobs
251 We provide the following Python jobs templates:
253 ### {project-name}-tox-verify-{stream}
255 Use this job to call python-tox to run builds and tests. The most common
256 usage of this job is to run the Coala linter against projects.
262 - '{project-name}-tox-verify-{stream}'
264 project-name: builder
265 project: releng/builder
266 build-node: centos7-java-builder-2c-4g
272 **project**: is the project repo as defined in source control.
273 **project-name**: is a custom name to call the job in Jenkins.
274 **build-node**: is the name of the builder to use when building (Jenkins label).
275 **stream**: typically `master` or matching the build branch. This
276 is a useful keywords to map a release codename to a branch. For
277 example OpenDaylight uses this to map stream=carbon to
278 branch=stable/carbon.
282 **branch**: is the git branch to build from.
283 **jjb-version**: is the version of JJB to install in the build minion.
284 **tox-dir**: directory containing tox.ini file (default: '')
285 **tox-envs**: tox environments to run (default: '')
287 ## Archiving logs in Jobs
289 There are 2 ways supported for archiving log information:
291 1) Job creates $WORKSPACE/archives directory and places logs there
293 This method pushes the entire archives directory to the log server
294 in the same structure as configured in the archives directory.
296 2) Via job variable ARCHIVE_ARTIFACTS using globstar patterns.
298 In this method a job can define a globstar for example `**/*.log` which then
299 causes the archive script to do a globstar search for that pattern and archives
300 any files it finds matching.
302 ## Overriding merge and verify triggers
304 The default trigger conditions for Merge and Verify job types are overrideable
305 in a project configuration by overriding the following variables:
307 - gerrit_merge_triggers
308 - gerrit_verify_triggers
310 These variables take a list of trigger-on values as defined in JJB docs here:
311 <https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit>
317 When using ShellCheck to lint global-jjb or any projects that include
318 global-jjb as part of their project (common with ci-management repos) then
319 we require version 0.4.x of ShellCheck installed on the build vms. This version
320 introduces annotations used by shell scripts in this repo.