Skip to content

Get Started

Joshua1023 edited this page Oct 24, 2024 · 6 revisions

Installation

Support the following operating systems or platforms:

AlmaLinux or Fedora or RHEL

Debian or Ubuntu

AWS

DigitalOcean

Huawei Cloud

Linode

Create Redmine Project and Issue

Navigate to https://bug.nsbox.local:9443/projects, click "New project" and fill in the necessary information to create a new project.

In the page of the new project, click the "Issues" tag and then click "New issue". Fill in the information and create a new issue. Each issue will have a unique ID, which can be used to link a Gerrit code review patch with one or more issues.

Create a Repository in Gerrit (Admin User)

In https://review.nsbox.local:9443/admin/repos, click "CREATE NEW", fill in the Repository name, and click the "CREATE" button: image

Repository Preparation

The repository needs Makefile(more compilation methods will be supported in the future) and Dockerfile to trigger a build in Buildbot after a commit is updated to Gerrit.

Dockerfile is used to generate a container to execute the compilation and testing steps. Makefile should support at least make and make test

Create a Code Review

To clone the repository, you need to add the SSH key to https://review.nsbox.local:9443/settings/#SSHKeys.

On the page of the repository, you will find the clone URL:

image

Notes:

(1) If you bought a domain in Cloudflare or AWS, ensure the domain in the clone URL is added to .ssh/config with the correct IP address.

(2) Make sure port 29418 is open.

Although the commit-msg hook is necessary for creating a code review in Gerrit, we recommend cloning the repository since the clone command with the commit-msg hook may not work correctly.

If you want to upload a commit to Gerrit, run:

git push origin HEAD:refs/for/master

Note the refs/for/master part. It is a special ref handled by Gerrit.

The first time when you run this command, it probably complains:

$ git push origin HEAD:refs/for/master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Writing objects: 100% (3/3), 231 bytes | 231.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Processing changes: refs: 1, done
remote: ERROR: commit 0bece87: missing Change-Id in message footer
remote:
remote: Hint: to automatically insert a Change-Id, install the hook:
remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 admin@nsbox.local:hooks/commit-msg ${gitdir}/hooks/
remote: (for OpenSSH >= 9.0 you need to add the flag '-O' to the scp command)
remote: or, for http(s):
remote:   f="$(git rev-parse --git-dir)/hooks/commit-msg"; curl -o "$f" https://nsbox.local:9442/tools/hooks/commit-msg ; chmod +x "$f"
remote: and then amend the commit:
remote:   git commit --amend --no-edit
remote: Finally, push your changes again
remote:
To ssh://nsbox.local:29418/demo
 ! [remote rejected] HEAD -> refs/for/master (commit 0bece87: missing Change-Id in message footer)
error: failed to push some refs to 'ssh://nsbox.local:29418/demo'

Just follow its instructions. First let's run

gitdir=$(git rev-parse --git-dir); scp -p -P 29418 admin@nsbox.local:hooks/commit-msg ${gitdir}/hooks/

And then run

git commit --amend --no-edit

It will amend your last change by running the commit-msg hook.

Now let's try to upload again:

$ git push origin HEAD:refs/for/master
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 56 threads
Compressing objects: 100% (11/11), done.
Writing objects: 100% (16/16), 2.70 KiB | 2.70 MiB/s, done.
Total 16 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1)
remote: Processing changes: refs: 1, updated: 1, done    
remote: 
remote: SUCCESS
remote: 
remote:   https://nsbox.local:9442/c/demo/+/1 create a test commit
remote: 
To ssh://nsbox.local:29418/analyze-demo
 * [new reference]   HEAD -> refs/for/master

Referencing Redmine Issues

By adding Bug-Id to commit messages, a code review patch on Gerrit can be linked with a Redmine issue.

An example:

demo: create a test commit

Bug 1 can be mentioned as b/1 or task 1 or issue 1.

Bug-Id: 1
Change-Id: I206fe2cddda702dabd57769b5ef4ab5fee6a9b10

On Gerrit:

image

Follow the link you can visit the issue on Redmine:

image

Clone this wiki locally