Page tree
Skip to end of metadata
Go to start of metadata

Information on this page is preliminary and subject to change while the process is verified.


This page describes how to contribute code reviews to Acumos through Nordix. Developers who are contributing code as reviews to Acumos must use this process. This process keeps the reviews on the Nordix master branch in lock step with reviews on the Acumos master branch.

This process assumes that your userid on the Nordix Gerrit and the Acumos Gerrit are the same. You can check if this is the case by clicking these links

The process may work in cases where your Nordix and Acumos userids differ but we have not tested that case.

Contents

1 Initial Configuration

1.1 Permit the Nordix Gerrit to upload changes to Acumos on your behalf

You must store the Nordix gerrit public key in the Acumos Gerrit in order to enable pushing of reviews directly from the Nordix Gerrit to the Acumos Gerrit under your username. You need only carry out this step once.

  1. Log onto the Acumos Gerrit
  2. in Settings→SSH Public Keys, click "Add Key..." (or click this link https://gerrit.acumos.org/r/#/settings/ssh-keys)
  3. Paste the infra@nordix.org public key below into the text box

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCdyLRXDIU4w/0H/kZa+2Fw/NLPTyW83F9cQqrahGybbff/pY3CxBKUqRefIp6SLjcR5TjrWOLVO6hlan+nzUzVahlgim8YIGYiD7l6ZuWBvlt/WpqqZOswRLKsgQgTDBUNFXl4V++bsZfbJwlv1QnNaeXGYdfGulXTnQ0wk4+/rBhPXqKVIPJyjnnrz1yCxwyRGOtB9hzSiG1VoKEoddgqIydRnxPQER7K5mc3E6CmvNr8FB5sbo+urT8EVLlb9Df8a7G0XRfMrM0z+1mFjlXG6ckvbIrlfJjQkeK00cXiFwwAmRQeHKZEQrl9++uhjcueIT0TYnGMW7ZW/Hl6NfV8z21pcj+erD3ltDXn3yZjlzf44ekvtNGegJ7hlB7mSdY17rk46QPSlPtPDeibZFj33c+jhZVFeB8PV7DOfXhqtNEVCZ/GlajQlgqbJqy1ILVftD/AhZpyEK0P6j8RiP7IF+rKVrdLsnoXPuHPMV+l+JKJE7STDHiCST0Opn5+WbQhiysDkORCfZMa+q02+/V4X6Khc97ws2LVJU19EQpqGSTYRew44E/cPGFMd3MvlyvzULV56XEtGESAYGAJdgj8g+zif8R4HjfgXo0KRgnz9yk3UU9qo2QZ1aqfu7+mO5r33cVk5ZVUIp3r0f7SD6OEOpj2nlc+cIaV6XRlF/BDYQ== infra@nordix.org
  4. Click "Add"

1.2 Add Repository Jenkins JJB Jobs

Jenkins jobs are written in the JJB (Jenkins Job Builder)  language, a dialect of Yaml. To create or amend your Jenkins job:

  1. Clone the Nordix infra/cicd repository

    git clone ssh://<your-userid>@gerrit.nordix.org:29418/infra/cicd
  2. 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 Acumos projects, create your new JJB file in the appropriate directory.
  3. Submit your new or updated JJB yaml files as a review

There are three jobs which must exist on the Nordix Jenkins for all Acumos cloned repositories. To create the jobs

  1. Copy working jobs for another Acumos cloned repository in the infra/cicd/jjb directory
  2. Change the fields name, project, and project-name to the values for your project in all three yaml files

For example, for the security-verification project, the fields are as follows:

	name: acumos-security-verification-push-upstream
    project: acumos-security-verification
    project-name: acumos-security-verification


You can check running and/or completed jobs on the Nordix Jenkins.

The three jobs to be created are as follows:

  1. 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.
  2. The Push Upstream Job: <project-name>-push-upstream-jobs.yaml This job pushes your reviews upstream from the Nordix master branch to the Acumos 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.
  3. The Rebase Job: <project-name>-rebase-jobs.yaml This job keeps the Nordix master branch synchronized with the Acumos master  branch in the repository. It is called whenever code is merged on the Acumos gerrit repo. It pushes the merged code from the Acumos master branch to the Nordix master branch.

1.3 Set your git "user.name" to be your Linux Foundation ID

In order for the review push from the Nordix Gerrit to the Acumos Gerrit, your review must be submitted with your Linux Foundation ID. Set your git user name as follows

git config --global user.name "<your linux foundation ID>"

2 Submitting a Review

  1. Prepare your review on the master branch of the Nordix repo that is a downstream of an Acumos repo.
    1. You may work on the review on the master branch from scratch
    2. You may create the review on the master branch by squashing or cherry picking reviews from development branches.
  2. Your user name in git must be your Linux Foundation ID. Check that your git user name is your Linux Foundation ID with the command:

    git config --global --list

    If the user.name is not set correctly, set it with the command:

    git config --global user.name "<your linux foundation ID>"
  3. Submit your review to the master branch of the repo on the Nordix gerrit.

    git push origin HEAD:refs/for/master
  4. Upstream your review to the master branch of the repository on the Acumos gerrit by logging onto the Nordix gerrit and posting a comment with the word push-upstream. This triggers the Jenkins job that upstreams your review to the Acumos master branch.
    Note: Never +2 or commit/merge a review directly on the Nordix master branch as this will cause the Acumos and Nordix master branches to diverge.
  5. The review is approved and merged in Acumos. When the review is merged in Acumos, the merge triggers a push of the review in the Nordix cloned repo. The Nordix cloned repo is therefore always in lock step with the Acumos upstream original repo.
  6. When the review in upstream gets merged, the status of your original review on Nordix Gerrit will also be automatically closed since Gerrit associates reviews using ChangeId and when sync job brings your commit from upstream to Nordix Gerrit, it will be in Merged state. No further work is required on your side.

Note: Steps 1. to 3. may be repeated to update reviews where changes to reviews are required.

2.1 Uploading a Modified Review and Submitting it through Nordix to Acumos

The review is created on the Nordix gerrit and is then transferred to the Acumos gerrit.

  1. Make whatever changes and additions you require to the review and check it in locally.

    git commit -as --amend
  2. Push your commit to the Nordix gerrit as a patch set on an existing review.

    git push origin HEAD:refs/for/master
    

    You can check that you review has a new patch set on the master branch of the Nordix gerrit.

  3. Transfer the review from the Nordix gerrit to the Acumos gerrit. Post a comment on the Nordix gerrit containing the magic word "push-upstream". You can now check that your review has a new patch set on the master branch of the Acumos gerrit.

1 Comment

  1. I don't know if you can use "git review" in Acumos as well, have a look at the changes on the ONAP page.