NOTICE: This software (or technical data) was produced for the U.S. Government under contract, and is subject to the Rights in Data-General Clause 52.227-14, Alt. IV (DEC 2007). Copyright 2023 The MITRE Corporation. All Rights Reserved.

High-level Overview

We're excited that you're considering contributing to the OpenMPF project! If you have any questions about the process or how to get involved, please feel free to send us an e-mail with your question.

We encourage you to read the remainder of the guide as well as review the project's License and other Documentation.

The OpenMPF project consists of the following repositories:

Work across the project is tracked using our workboard.

Contribution Guidelines

We welcome all contributions that are made in a good faith effort to meet the following criteria:

Code Merging Workflow

Contributor Instructions

Perform the following instructions to create a feature branch off of develop, commit your changes, push your branch, and create a pull request. Before the pull request is accepted a Jenkins build must pass and an OpenMPF project administrator must review the changes. We do not have a public Jenkins server so a project administrator will have to start the build for you.

cd /path/to/repo
git checkout develop
git pull
git checkout -b <my-new-feature>
git add .
git commit
git push -u origin <my-new-feature>
git checkout develop
git pull
git checkout <my-new-feature>
git merge develop

# Fix conflicts
git add .
git commit
git push

In order to be accepted and merged, pull requests need to comply with the Contribution Guidelines. In cases where an issue is found, please refer to the reviewer's comments for more information on how to update your code. This review and acceptance process applies to all of the OpenMPF repositories, including the OpenMPF core and all of the OpenMPF components.

Large pull requests should be split up into smaller pull requests where possible. This will make it easier to review the code. In general, each pull request should add new functionality, update an existing feature, or fix a bug. We strive to keep the develop branch stable. If merging a smaller pull request will break the system before additional pull requests can be merged, then it's generally a better idea to merge one larger pull request.

Note that GitHub has a 100 MB file size limitation. There is currently no way to push files to any of the OpenMPF repositories that are larger than this size.

Reviewer Instructions

git fetch
git checkout <new-feature>
cd openmpf-projects
git checkout develop
git pull
git submodule foreach 'git checkout develop'
git submodule foreach 'git pull'
git add .
git commit
git push

Hotfix Workflow

When an OpenMPF project administrator determines that a code change is urgently needed to fix a bug in previously released code, the pull request workflow is modified in the following ways.

git checkout master
git pull
git checkout develop
git pull
git checkout -b hf-merge/<branch-name>
git merge master
git push -u
git checkout develop
git pull
git merge hf-merge/<branch-name>

Make sure that the merge is a fast-forward merge.

git push

Versioning a New Release

The decision to version a new release is based on the following factors:

When the OpenMPF team agrees that it's time to version a new release of the system, a project administrator will create a release branch in each repository off of the develop branch. The name of a release branch takes the form r<major>.<minor>.<bugfix>. For example, r0.10.0. Also, the first commit in the release branch will be tagged as release candidate 1. For example, r0.10.0-rc1. Beta testers will then have the opportunity to test the release candidate 1 code.

If a bug is found in the release candidate code, then developers should land the bug fix to the release branch via a pull request. Once it has landed, the most recent commit will be tagged as release candidate 2. For example, r0.10.0-rc2. Beta testers will then have the opportunity to test the release candidate 2 code. The release candidate number will increase by one each time bugs are fixed. The bug fix code should be merged into the develop branch after it lands to the release branch.

If no bugs are found in the release candidate code for a period of time (generally, a month) then the release candidate will be finalized. The release candidate branch for each repo will be merged into the master branch for that repo. That commit on the master branch will be tagged with the release number. For example, r0.10.0.

If a critical bug fix needs to be made to the master branch, this is known has a "hot fix". Developers should land a hot fix to the master branch via a pull request. Once the code lands, the commit will be tagged by incrementing the <bugfix> number. For example, r0.10.1. The bug fix code should be merged into the develop branch after it lands to the master branch.

Note that you should not use the --no-ff option when merging one branch into another. Doing so will make the commit history more verbose and difficult to follow.

This process is based on GitFlow.

Adding New Components

In general, a new component will initially go in the openmpf-contrib-components repository. That is a holding ground until it can be transitioned to the openmpf-components repository. To be a candidate for transition, it must meet the following criteria:

Note that new components should have a README.md file, LICENSE file, COPYING file, and optionally a NOTICE file. The LICENSE file should contain information about all of the licenses in the code base, including those licenses for code you didn't write.

Coding Style

The following list of style guides provide a comprehensive explanation of some of the best coding practices for the programming languages used in the OpenMPF project:

Generally speaking, when writing new code, please refer to existing code in the repositories and match the style. Most style issues boil down to inconsistency. Not all of our code adheres to these style guidelines, but we are striving to improve it.

Updating Online Documentation

Our openmpf.github.io repo repo is forked from Beautiful Jekyll. In general, everything within openmpf.github.io/docs is part of a Read the Docs subsite within our overall Beautiful Jekyll site.

To build the site Docker must be installed. After making your changes run ./build-site.sh from within the top-level openmpf.github.io directory. To view your changes locally, you can run ./build-site.sh serve and then browse to http://localhost:4000.

Committing Changes

When your changes look good, make sure to run the ./build-site.sh command explained above to generate the HTML site content. Commit all of the generated files and generate a pull request to merge them into the develop branch. Note that _site is in .gitignore and should not be committed.

When a commit is made to the master branch on GitHub, the https://openmpf.github.io/docs/site/ page will automatically update (often within 5 minutes).