CI Jobs¶
Job Groups¶
Job groups are a great tool to configure categories of jobs together at the same time. Below the example are some starting point job-groups but we recommend creating your own to ensure that the jobs configured reflect the project’s needs.
An example project:
- job-group:
name: odl-maven-jobs
jobs:
- gerrit-maven-clm
- gerrit-maven-merge
- gerrit-maven-release
- gerrit-maven-verify
- gerrit-maven-verify-dependencies:
build-timeout: 180
mvn-version: mvn35
- project:
name: aaa
jobs:
- odl-maven-jobs
In this example we are using the job-group to assign a list of common jobs to
the aaa project. The job-group also hardcodes mvn-version
to mvn35 and
build-timeout
to 180 for all projects using this job-group.
A benefit of this method is for example disabling entire category of jobs by
modifying the job-group, insert disable-job: true
parameter
against the jobs to disable.
Below is a list of CI job groups:
---
- job-group:
name: "{project-name}-ci-jobs"
jobs:
- gerrit-jenkins-cfg-merge
- gerrit-jenkins-cfg-verify
- gerrit-jenkins-sandbox-cleanup
- gerrit-jjb-deploy-job
- gerrit-jjb-merge
- gerrit-jjb-verify
- job-group:
name: "{project-name}-github-ci-jobs"
jobs:
- github-jenkins-cfg-merge
- github-jenkins-cfg-verify
- github-jenkins-sandbox-cleanup
- github-jjb-deploy-job
- github-jjb-merge
- github-jjb-verify
- job-group:
name: "{project-name}-info-yaml-jobs"
jobs:
- gerrit-info-yaml-verify
- job-group:
name: "{project-name}-github-info-yaml-jobs"
jobs:
- github-info-yaml-verify
- job-group:
name: "{project-name}-packer-jobs"
jobs:
- gerrit-packer-merge
- gerrit-packer-verify
- job-group:
name: "{project-name}-github-packer-jobs"
jobs:
- github-packer-merge
- github-packer-verify
Macros¶
lf-infra-jjb-parameters¶
Required Parameters: | |||||
---|---|---|---|---|---|
|
lf-jenkins-cfg-clouds¶
Deploys Jenkins Cloud configuration read from the jenkins-clouds
directory
in ci-management repositories.
Note
Requires the jjbini file in Jenkins CFP to contain JJB 2.0 style config definitions for “production” and “sandbox” systems.
Required Parameters: | |||
---|---|---|---|
|
lf-jenkins-cfg-global-vars¶
Manages the Global Jenkins variables. This macro will clear all exist macros in Jenkins and replaces them with the ones defined by the ci-management/jenkins-config/global-vars-SILO.sh script.
Note
Requires the jjbini file in Jenkins CFP to contain JJB 2.0 style config definitions for “production” and “sandbox” systems.
Required parameters: | |||
---|---|---|---|
|
lf-infra-jjbini¶
Provides jenkins_jobs.ini configuration for Jenkins.
lf-packer-common¶
Common packer configuration.
lf-packer-file-paths¶
Gerrit file-paths for packer jobs.
lf-packer-parameters¶
Parameters useful for packer related tasks.
Parameters: |
|
---|
lf-packer-verify-file-paths¶
Gerrit file-paths for packer verify jobs.
lf-puppet-parameters¶
Parameters useful for Puppet related tasks.
Parameters: |
|
---|
Job Templates¶
Gerrit Branch Lock¶
Job submits a patch to lock or unlock a project’s branch.
Template Names: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||||
|
|||||||||||||||||||
Required parameters: | |||||||||||||||||||
|
|||||||||||||||||||
Optional parameters: | |||||||||||||||||||
|
Jenkins Configuration Merge¶
Jenkins job to manage Global Jenkins configuration.
Note
Requires the jjbini file in Jenkins CFP to contain JJB 2.0 style config definitions for “production” and “sandbox” systems.
Template names: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
Optional parameters: | |||||||||
|
Typically this template is automatically pulled in by the “{project-name}-ci-jobs” job-group and does not need to be explicitly called if the job group is being used.
Minimal Example:
---
- project:
name: jenkins-cfg-merge-minimal-test
jobs:
- "gerrit-jenkins-cfg-merge"
project-name: ci-management
Full Example:
---
- project:
name: jenkins-cfg-merge-full-test
jobs:
- "gerrit-jenkins-cfg-merge"
project-name: builder
jenkins-silos: releng sandbox
Global Environment Variables¶
Global Environment Variables are managed via the
jenkins-config/global-vars-SILO.sh
file in ci-management. Replace SILO with
the name of the Jenkins silo the variable configuration is for.
The format for this file is KEY=value
for example:
GERRIT_URL=https://git.opendaylight.org/gerrit
GIT_BASE=git://devvexx.opendaylight.org/mirror/$PROJECT
GIT_URL=git://devvexx.opendaylight.org/mirror
JENKINS_HOSTNAME=vex-yul-odl-jenkins-2
LOGS_SERVER=https://logs.opendaylight.org
NEXUS_URL=https://nexus.opendaylight.org
ODLNEXUSPROXY=https://nexus.opendaylight.org
SILO=sandbox
SONAR_URL=https://sonar.opendaylight.org
Cloud Configuration¶
This configuration requires the OpenStack Cloud plugin in Jenkins and is currently the only cloud plugin supported.
OpenStack Cloud plugin version supported:
- 2.30 - 2.34
- 2.35 - 2.37
Cloud configuration are managed via a directory structure in ci-management as follows:
- jenkins-config/clouds/openstack/
- jenkins-config/clouds/openstack/cattle/cloud.cfg
- jenkins-config/clouds/openstack/cattle/centos7-builder-2c-2g.cfg
- jenkins-config/clouds/openstack/cattle/centos7-builder-4c-4g.cfg
- jenkins-config/clouds/openstack/cattle/centos7-docker-4c-4g.cfg
The directory name inside of the “openstack” directory is used as the name of the cloud configuration. In this case “cattle” is being used as the cloud name.
The cloud.cfg
file is a special file used to configure the main cloud
configuration in the format KEY=value
.
Cloud Parameters: | |||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||||||||||||||||||||||||||||||||
Template Parameters: | |||||||||||||||||||||||||||||||||||||||||||
Note In the case of template definitions of a parameter below is not passed the one defined in default clouds will be inherited.
|
For a live example see the OpenDaylight project jenkins-config directory. https://github.com/opendaylight/releng-builder/tree/master/jenkins-config
Troubleshooting¶
Cloud Configuration: | |
---|---|
|
Jenkins Configuration Verify¶
Jenkins job to verify the Global Jenkins configuration.
Requires the clouds-yaml
file to be setup on the Jenkins host.
Template names: |
|
||||
---|---|---|---|---|---|
Optional parameters: | |||||
|
This job is not part of the “{project-name}-ci-jobs” group. It must be called explicitly.
Example:
---
- project:
name: jenkins-cfg-verify
jobs:
- "gerrit-jenkins-cfg-verify"
project-name: ci-management
Jenkins Sandbox Cleanup¶
Cleanup Jenkins Sandbox of jobs and views periodically.
Template names: |
|
||||||
---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||
NONE |
|||||||
Required parameters: | |||||||
|
|||||||
Optional parameters: | |||||||
|
JJB Deploy Job¶
Deploy jobs to jenkins-sandbox system via code review comment.
This job checks out the current code review patch and then runs a
jenkins-jobs update
to push a patch defined by the comment.
Template names: |
|
||||||
---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||
jjb-deploy JOB_NAME Note The JJB Deploy Job is configured to trigger only if the Gerrit comment starts with the jjb-deploy keyword. Example of a valid command in Gerrit comment that triggers the job:
Example of a invalid command in Gerrit comment that would _not_ trigger the job:
JOB_NAME can include the * wildcard character to push multiple jobs
matching the pattern. For example |
|||||||
Required parameters: | |||||||
|
|||||||
Optional parameters: | |||||||
|
JJB Merge¶
Runs jenkins-jobs update to update production job configuration
Template Names: |
|
||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||||||||||||||||||||||||
remerge |
|||||||||||||||||||||||||||||||||||||||
Required parameters: | |||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||
Optional parameters: | |||||||||||||||||||||||||||||||||||||||
|
JJB Verify¶
Runs jenkins-jobs test to validate JJB syntax
Template Names: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
recheck|reverify |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required parameters: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Optional parameters: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
JJB Verify Upstream Global JJB¶
Runs jenkins-jobs test
to validate JJB syntax for upstream global-jjb
patches. This job is useful to notify upstream that they may be breaking
project level jobs.
Template Names: |
|
||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||
recheck|reverify |
|||||||||||||||||
Required parameters: | |||||||||||||||||
|
|||||||||||||||||
Optional parameters: | |||||||||||||||||
|
Info YAML Verify¶
Info YAML Verify job validates that INFO.yaml file changes are kept isolated from other file changes. Verifies INFO.yaml files follow the schema defined in lfit/releng-global-jjb/schema/info-schema.yaml.
Template Names: |
|
||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Required parameters: | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
Optional parameters: | |||||||||||||||||||||||||||||
|
License Checker¶
Job to scan projects for files missing license headers.
Template Names: |
|
||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Optional parameters: | |||||||||||||||||||||
|
OpenStack Cron¶
Cron job that runs regularly to perform periodic tasks against OpenStack.
This job requires a Config File Provider file named clouds-yaml
available
containing the credentials for the cloud.
Template Names: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Required parameters: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
Optional parameters: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Minimal Example:
---
- project:
name: openstack-cron-minimal-test
jobs:
- "gerrit-openstack-cron"
project-name: ci-management
jenkins-urls: >
https://jenkins.example.org
https://jenkins.example.org/sandbox
Full Example:
---
- project:
name: openstack-cron-full-test
jobs:
- "gerrit-openstack-cron"
project-name: ciman-full
jenkins-urls: >
https://jenkins.example.org
https://jenkins.example.org/sandbox
openstack-cloud: example-cloud
openstack-image-cleanup: false
openstack-image-cleanup-age: 42
openstack-image-protect: false
openstack-server-cleanup: false
openstack-stack-cleanup: false
openstack-volume-cleanup: false
Packer Merge¶
Packer Merge job runs packer build to build system images in the cloud.
Template Names: |
|
||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||||||||||||||||||||||||||||
remerge |
|||||||||||||||||||||||||||||||||||||||||||
Required parameters: | |||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
Optional parameters: | |||||||||||||||||||||||||||||||||||||||||||
|
Test an in-progress patch¶
To test an in-progress patch from a GitHub Pull Request. Upload this job to the Jenkins Sandbox. Then when manually building the job replace the GERRIT_REFSPEC parameter with the GitHub Pull Request number of the patch you would like to test.
Example GitHub:
GERRIT_REFSPEC: origin/pr/49/merge
Packer Verify¶
Packer Verify job runs packer validate to verify packer configuration.
Template Names: |
|
||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||||||||||||||||||||||||||||||
recheck|reverify |
|||||||||||||||||||||||||||||||||||||||||||||
Required parameters: | |||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||
Optional parameters: | |||||||||||||||||||||||||||||||||||||||||||||
|
Puppet Verify¶
Runs puppet-lint in the puppet-dir
directory. puppet-lint runs recursively,
the base directory is usually the best place to run from.
Template Names: |
|
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Comment Trigger: | |||||||||||||||||||||||||||||||||||
recheck|reverify |
|||||||||||||||||||||||||||||||||||
Required Parameters: | |||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||
Optional Parameters: | |||||||||||||||||||||||||||||||||||
|
Sonar¶
Runs Jenkins Sonarqube plug-in to review for bugs, code smells, and security vulnerabilities.
Template Names: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Optional Parameters: | |||||||||||||||
|