Git

Pulp source code lives on GitHub. This document is definitive for pulpcore only, but some plugins may choose to follow the same strategies.

Versions and Branches

Code is submitted by a Pull Request on Github to merge the changes to main which represents the next pulpcore release. See Versioning for more details.

Commits

Rebasing and Squashing

We prefer each pull request to contain a single commit. Before you submit a PR, please consider an interactive rebase and squash.

The git commit --amend command is very useful, but be sure that you understand what it does before you use it! GitHub will update the PR and keep the comments when you force push an amended commit.

Warning

Keep in mind that rebasing creates new commits that are unique from your original commits. Thus, if you have three commits and rebase them, you must make sure that all copies of those original commits get deleted. Did you push your branch to origin? Delete it and re-push after the rebase.

Commit Message

Commit messages in Pulp should contain a human readable explanation of what was fixed. They should also follow the standard git message format of starting with a subject line or title (usually wrapped at about 50 chars) and optionally, a longer message (usually wrapped at 72 characters) broken up into paragraphs. For more on what constitutes a good commit message, we recommend Tim Pope’s blog post on the subject.

Each commit message should link to an issue on the pulpcore Github Issue tracker. See the Github Linking Docs and include at least one link in your commit message.

If you must create a commit for which there is no issue, add the [noissue] syntax in the commit message.

Putting this all together, the following is an example of a good commit message:

Update install and quickstart

The install docs and quickstart was leaving out an important step on
the worker configuration.

closes #1392

Hint

A good candidate for a noissue tag is a one line fix or a typo, otherwise we encourage you to open an issue.

Requiring other Pull Requests

Sometimes a new feature may require changes to both pulpcore and one or many other plugins, simultaneously. In order to keep the CI happy in these circumstances (as tests may fail otherwise), we provide a mechanism to force the CI service to fetch the version of a component in a linked Pull Request, rather than master branch.

To do so, add a tag in the following format to the last commit in your series.

This will allow the PR against pulp to run against the Pull Requests for pulp_file:

Required PR: https://github.com/pulp/pulp_file/pull/2345

This will allow the PR against a plugin to run against the Pull Request for pulpcore:

Required PR: https://github.com/pulp/pulpcore/pull/3456

Attention and care must be given to merging PRs that require other Pull Requests. Before merging, all required PRs should be ready to merge–meaning that all tests/checks should be passing, the code review requirements should be met, etc. When merging, the PR along with its required PRs should all be merged at the same time. This is necessary to ensure that test breakages don’t block other PRs.

For very similar reasons it can happen that you need changes to the base image used in the CI to spin up a new pulp container. In those cases you can build your own modified version of the image and push it to a container registry. Now you can specify the image to use in the last commit like:

CI Base Image: pulp/pulp-ci:special_feature

The same meticulousness as described above is required to merge those Pull Requests.

Changelog update

The CHANGES.rst file is managed using the towncrier tool and all non trivial changes must be accompanied by a news entry.

For user facing changes, put those news files into CHANGES/. For Plugin API changes, put those into the CHANGES/plugin_api/ folder.

To add an entry to the news file, you first need an issue on github describing the change you want to make. Once you have an issue, take its number and create a file inside of the CHANGES/ or CHANGES/plugin_api/ directory named after that issue number with one of the extensions below.

extension

description

.bugfix

A bug fix

.feature

A new feature

.removal

A backwards incompatible change (ie a removal or change in behavior)

.deprecation

Information about an upcoming backwards incompatible change

.doc

A documentation improvement

.misc

A change that is not visible to the end user

So if your user-facing issue is 3543 and it fixes a bug, you would create the file CHANGES/3543.bugfix. Or if your plugin API change is 5432 and it’s a breaking change you would create the file CHANGES/plugin_api/5432.removal.

PRs can span multiple categories by creating multiple files (for instance, if you added a feature and deprecated an old feature at the same time, you would create CHANGES/NNNN.feature and CHANGES/NNNN.removal). Likewise if a PR touches multiple issues/PRs you may create a file for each of them with the exact same contents and Towncrier will deduplicate them.

The contents of this file are reStructuredText formatted text that will be used as the content of the news file entry. You do not need to reference the issue or PR numbers here as towncrier will automatically add a reference to all of the affected issues when rendering the news file.

The changelog message should use past simple tense. When possible, the message should describe the change being made as opposed to the problem or user story. Here are some examples:

  • Added API that allows users to export a repository version to disk.

  • Fixed bug where whitespace was being trimmed from uploaded files.

  • Added documentation for new pulpcore-manager command.