...
1.2 Add Repository Jenkins JJB Jobs
This step is only needed if you are creating a new repo/project in Gerrit
Expand |
---|
title | Click here to expand... If creating new repo/project |
---|
|
Jenkins jobs are written in the JJB (Jenkins Job Builder) language, a dialect of Yaml. To create or amend your Jenkins job: Clone the Nordix infra/cicd repository Code Block |
---|
| git clone ssh://<your-userid>@gerrit.nordix.org:29418/infra/cicd |
- Create or amend the JJB yaml file for your job under the jjb directory in the cloned infra/cicd repo
Note that by convention, there are subdirectories under the jjb directory for the various ONAP projects, create your new JJB file in the appropriate directory. - Submit your new or updated JJB yaml files as a review
There are three jobs which must exist on the Nordix Jenkins for all ONAP cloned repositories. To create the jobs - Copy working jobs for another ONAP cloned repository in the infra/cicd/jjb directory
- Change the fields name, project, and project-name to the values for your project in all three yaml files
For example, for the OOM project, the fields are as follows: Code Block |
---|
name: oom-push-upstream
project: oom
project-name: oom |
For the policy/apex-pdp project, the fields are as follows: Code Block |
---|
name: policy-apex-pdp-push-upstream
project: policy/apex-pdp
project-name: policy-apex-pdp |
You can check running and/or completed jobs on the Nordix Jenkins. The three jobs to be created are as follows: - The Verify Job: <project-name>-verify-jobs.yaml This job is called when you submit a review to your project on the Nordix gerrit. You specify the branches that you want the verify job to trigger on. Since we should strive for quality code, having verify jobs for your project on Nordix Infra helps you to send your changes to upstream with minimum issues so the reviews in upstream could go faster.
- The Push Upstream Job: <project-name>-push-upstream-jobs.yaml This job pushes your reviews upstream from the Nordix master branch to the ONAP master branch. You activate by posting a comment containing the magic word "push-upstream" to your review in the Nordix master branch. Please ensure your review on Nordix Gerrit got Verified+1 from verify job running on Nordix Jenkins before sending the review to upstream.
- The Rebase Job: <project-name>-rebase-jobs.yaml This job keeps the Nordix master branch synchronized with the ONAP master branch in the repository. It is called whenever code is merged on the ONAP gerrit repo. It pushes the merged code from the ONAP master branch to the Nordix master branch.
1.2.1 Use scripts to generate the three Nordix Jenkins jobs View file |
---|
name | nordixJobs.sh |
---|
height | 150 |
---|
|
To make the process easier and quicker for creating the push-upstream, rebase and verify jobs for Nordix, the above nordixJobs.sh shell script and setup.txt will reliably do it. - Place the two files in whatever directory you want to create the three yaml files.
- Run 'sh nordixJobs.sh' and you will be prompted for the name of the root project, eg: 'policy'
- Next you will be prompted for the name of a child project if one exists, e.g, 'pdp' (If there is no child project, just hit [Enter])
- The three yaml files in either case (with or without child projects) will be created in a folder with the same name as the root project in that directory.
- chosenDirectory - policy - policy-pdp-push-upstream-jobs.yaml - policy-pdp-rebase-jobs.yaml - policy-pdp-verify-jobs.yaml
Simple edits to the nordixJobs.sh script can improve speed and ease of use, e.g, include your own 'git add .' and 'git commit -am "Add rebase/push/verify jobs for $rootProject\/$childProject"' etc... |
1.3 Set your git "user.name" to be your Linux Foundation ID
...
Code Block |
---|
git config --global gitreview.username "<your_nordix_gerrit_user_name>" |
...
1.5 Add Corporate Contributor License Agreement (CCLA) in Onap.gerrit
- Sign in to https://gerrit.onap.org/
- Click on <Your Name> top right corner and select Settings
- Navigate to <Agreements>
- Click on New Contributor Agreement
- Select 'CCLA' and click [Continue]
- Select "Ericsson Software Technology" (To-Be-Confirmed)
2 Submitting a Review
Warning |
---|
You MUST configure git review to work towards the Nordix gerrit as explained in step 1. |
Warning |
---|
You MUST configure git review to work towards the Nordix gerrit as explained in step 1.4 above in order for git review to work towards the Nordix gerrit rather than the ONAP gerrit. |
...
Note 2. Only the original author can use 'push-upstream' on a commit. Sometimes it might be necessary that a different developer takes over a commit and needs to execute this. In that case you need to reset the author (and sign it) for the commit:
Code Block |
---|
language | bash |
---|
title | rest reset commit author |
---|
|
git commit -s --amend --reset-author |
2.1 Getting convenience scripts
...