...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
The ci-management
or releng/builder
repos in an LF project consolidates the Jenkins jobs from project-specific VMs to a single Jenkins server. Each Git repo in every project has a view for their jobs on the main Jenkins server. The system utilizes Jenkins Job Builder for the creation and management of the Jenkins jobs.
Quick Start
This section provides details on how to create jobs for new projects with minimal steps. All users in need to create or contribute to new job types should read and understand this guide.
As a new project you will be mainly interested in getting your jobs to appear in the Jenkins server silo archiving it by creating a <project>.yaml in the releng/builder or ci-management project’s jjb directory.
Example for releng/builder projects:
...
.yaml in the ci-management project’s jjb directory.
Example for ci-management projects:
git clone --recursive https://gerrit.akraino.org/gerrit/ci-management
cd ci-management
mkdir jjb/<new-project>
...
In similar matter, if your project name is “aaa/bbb” then create a new jjb/aaa-bbb directory by replacing all “/” with “-“.
Note
builder/jjb/global-jjb or ci-management/jjb/global-jjb are submodules of releng/builder or is a submodule of ci-management repositories which require a git submodule update --init
or using –recursive with git clone to get them fetched.
...
The changes to these files get published in Gerrit and reviewed by the releng/builder or ci-management teams team for the LF project. After approvals, these Gerrits patches get merged and the jobs published in Jenkins.
git add jjb/<new-project>
git commit -sm "Add <new-project> jobs to Jenkins"
git review
This will push the jobs to Gerrit and your jobs will appear in Jenkins once the releng/builder or ci-management teams team has reviewed and merged your patch.
...
Projects requiring a specific build configuration can submit a change to the ci-management
or releng
reposrepo.
Refer to the Jenkins Configuration Merge section to understand how the configuration changes get merged.
...
At the end of a build the job ships logs to a Nexus logs repo and can be conveniently accessed via the https://logs.exampleakraino.org/ URL. The Job Build Description will contain the specific log server URL for a build log. Jobs triggered via Gerrit Trigger will have the URL to the logs left as a post build comment.
Example Jenkins Build Description:
Build logs: https://logs.opendaylightakraino.org/releng/vex-yul-odl-jenkins-1/distribution-check-carbon/167
Example Gerrit Comment:
jenkins-releng 03-05 16:24 Patch Set 6: Verified+1 Build Successful https://jenkins.akraino.org/releng/job/builder-tox-verify-master/1066/ : SUCCESS Logs: https://logs.akraino.org/releng/vex-yul-odl-jenkins-1/builder-tox-verify-master/1066
The log path pattern for the logs server is LOG_SERVER_URL/SILO/JENKINS_HOSTNAME/JOB_NAME/BUILD_NUMBER
typically if you know the JOB_NAME and BUILD_NUMBER you can replace the paths before it to convert the URL between Jenkins and the Log server.
...
To activate your virtual environment.
source ./jjb/bin/activate # or workon jjb
To deactivate your virtual environment.
...
Set a virtualenv
virtualenv jjb source jjb/bin/activate
Install JJB
pip install jenkins-job-builder==2.0.5
Note
If a requirements.txt exists in the repository with the recommended JJB version then, use the requirements file to install JJB by calling.
# From the root of the ci-management or builder directory pip install -r jjb/requirements.txt
To change the version of JJB specified by jjb/requirements.txt to install from the latest commit to the master branch of JJB’s Git repository:
cat jjb/requirements.txt -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder#egg=jenkins-job-builder
Check JJB installation:
jenkins-jobs --version
...
While developing a new builder image type, we can use the Jenkins Sandbox to build and deploy the image for testing. Configure a Jenkins Job the new image type using the global-jjb gerrit-packer-merge job template.
Example job definition:
- project: name: packer-robot-jobs jobs: - gerrit-packer-merge project: releng/builder project-name: builder branch: master archive-artifacts: '**/*.log' build-node: centos7-builder-2c-1g platforms: centos-7 templates: robot
The gerrit-packer-merge job creates jobs in the format PROJECT_NAME-packer-merge-PLATFORM-TEMPLATE
. Where PROJECT_NAME is the project-name
field, PLATFORM is the platforms
field, and TEMPLATES is the templates
field in the yaml above. In this example the resultant job is builder-packer-merge-centos-7-robot
.
...
Once the job is on the Jenkins Sandbox, run the job and it will attempt to deploy the new image and make it available. Once the job completes look for a line in the logs that look like:
==> vexxhost: Creating the image: ZZCI - CentOS 7 - robot - 20180301-1004
This line provides the name of the new image we built.
...
The Jenkins server is the home for all project’s Jenkins jobs. Most of the job configuration gets managed through code using JJB through the ci-management or releng/builder reposmanagement repo.
To access the Jenkins Production URL for any project use: https://jenkins.akraino.org
...