How to contribute code to the Hyperledger Fabric project
Installation Environment
It is recommended to develop the code in the Ubuntu 14.04+ environment and install the following tools. git: Used to get the code; Golang 1.6+: Environment variables such as configuration $GOPATH after successful installation. Get Code
First register the Linux Foundation ID and log in to https://gerrit.hyperledger.org/to add a personal SSH pub key.
Look at the list of items, find the corresponding project, and in the case of fabric, get the Clone with Commit-msg hook method.
Typically, execute the following command to get the code, where lf_id is replaced with your Linux foundation ID.
$ git clone ssh://lf_id@gerrit.hyperledger.org:29418/fabric && scp-p-P 29418 LF_ID@gerrit.hyperledger.org: Hooks/commit-msg fabric/.git/hooks/
If you do not add a personal ssh PubKey, you can clone by HTTPS, you need to enter the user name and password information.
git clone http://lf_id@gerrit.hyperledger.org/r/fabric && (CD fabric && curl-klo ' git rev-parse--git-di R '/hooks/commit-msg http://lf_id@gerrit.hyperledger.org/r/tools/hooks/commit-msg; chmod +x ' git rev-parse--git-dir '/hooks/commit-msg)
Clone under the code, in order to facilitate the subsequent compilation test, you need to put in the $GOPATH/src/github.com/hyperledger/path.
$ mkdir
Compiling and testing
Most of the compilation and installation processes can be performed through Makefile. Install Go Tools
Perform
$ make Gotools
Syntax Format Checker
Perform
$ make Linter
compiling peer
Perform
$ make Peer
creating a Docker image
Perform
$ make Images
Performing unit tests
Perform
$ make Unit-test
If you want to run a specific unit test, you can do so by using a format similar to the following.
$ go test-v-run=testgetfoo
perform a BDD test
Need Mister cost to Docker mirroring.
Perform
$ make behave
Submit Code
Still log in to jira.hyperledger.org with the Linux Foundation ID to see if there are no unassigned tasks, and if you are interested in a task, you can add yourself as assignee, such as the FAB-XXX task.
Creates a new branch fab-xxx locally.
$ git checkout-b fab-xxx
Implement the task code, complete the syntax format check and test, and make sure all the checks and tests are passed.
Submit the code to the local repository.
$ git commit-a-S
A window will open with the commit information in the form of the general requirements:
Simple words to describe main change this
fixes #FAB-xxx.
A more detailed description can is here, with several
paragraphs and sentences ...
Then use the GIT Review command to push to the remote repository.
$ git Review
After the submission is successful, you can open gerrit.hyperledger.org/r/, view your latest submitted patchset information, and add several reviewer. This is followed by the review results for the developer team, which, if passed, will be maintainer into the main branch by the project's members. Otherwise, further amendments to the recommendations are needed.
The remediation process is similar to the commit code process, except that it is used when committing
$ git commit-a--amend
Indicates that the submission was a revision to the old submission.
For more information, refer to the Blockchain technical guide.
Reprint Please specify:
http://blog.csdn.net/yeasy/article/details/53609814
Https://github.com/yeasy/blockchain_guide/blob/master/hyperledger/contribute.md