Skip to content

Contributing

Nicolas Harraudeau edited this page Apr 20, 2017 · 9 revisions

Contributions are very much appreciated, below you'll find some of the workflows.

Submitting a Bug

The quickest way you can get involved with the B2SHARE project is if you report issues! Provide a logic and clear title and comment, and tag labels accordingly.

Submitting a security issue

PLEASE DO NOT CREATE AN ISSUE DESCRIBING THE PROBLEM. Contact the developers directly via the EUDAT support (https://eudat.eu/support-request). The issue will be publicly announced once a new release fixing the issue is published. This is to prevent any attack on running B2SHARE instances.

Creating a Fork

Making pull-requests

Pull-requests can only be made if you've can reference it to an issue issueno. Discovered a bug? Create an issue/ ticket first! Your fix will be targeted at a specific version of B2SHARE only. The master branch contains the latest and greatest features, whereas x.x (currently 1.0) is the latest stable version. Bug fixes found on production, QA or test servers are only pushed to the x.x branch.

  1. Make a fork of the EUDAT-B2SHARE/b2share project
  2. Create a branch on your project <targetbranch#issueno-some-desc>
  3. Goto page https://github.com/EUDAT-B2SHARE/b2share and click green button: Compare, review, create a pull-requests
  4. Select base fork: EUDAT-B2SHARE/b2share base: <targetbranch> ... head fork: <username>/b2share compare: <your_branch_name>
  5. Click Create pull request
  6. Add a logic description in the title
  7. Add a description including issue #no (hrefs will resolve, so issues can be related to issues!)

Branch switching

B2SHARE runs Python, which creates intermediate .pyc files. When switching branch uncommitted (ignored) files can remain. Before running the server, make sure to remove all .pyc files first.

NOTE: don't forget to rsync your files to the VM, if you're running Vagrant

cd /path/to/b2share
find . -name "*.pyc" -exec rm -rf {} \;
git branch `<targetbranch#issueno-some-desc>`

Syncing upstream

Once you have your fork, and local branch, keeping your branches updated is important. After numerous merges your branches can become outdated, and pull-requests are no longer able to automatically-merge, so fetch upstream regularly!

NOTE: before merging upstream, make sure you're on the correct branch locally!

Add remote upstream

Allows git to communicate to the remote git repository.

cd /path/to/your/b2share
git remote add upstream [email protected]:EUDAT-B2SHARE/b2share.git

Update master branch

git checkout master
git fetch upstream
git merge upstream/master

NOTE: when you've got pending commits, an error will be thrown

Update other branches

In this case branch 1.0 is merged, however you can replace this with any branch you want.

git checkout 1.0
git fetch upstream
git merge upstream/1.0

Publishing/ Pushing to git

Publishing a branch is meant by pushing a local branch to your remote public repository. Once public, you can make a pull-request from your branch.

git push -u origin `<targetbranch#issueno-some-desc>`

Testing

The backend system of B2SHARE (Invenio) has facilities for automated testing. The example below will run all tests.

cd /path/to/b2share
python setup.py test

Python files containing, the code snippet below, are runnable by the test suite.

TEST_SUITE = make_test_suite(...)
if __name__ == "__main__":
    run_test_suite(TEST_SUITE)

Targeting a single module can be done with the -s argument.

# replace `xyz` with module name like: `invenio.testsuite.test_bibauthority`
python setup.py test -s xzy

NOTE: you can only run this within an B2SHARE environment, workon b2share.