Git / GitHub
All quattor Git repositories are part of the quattor organisation on GitHub.
Prerequisites
- An account on GitHub
- Join the quattor organisation and
developer
team- In case there is a problem, contact the mailing list as admins can also add new members
- Join the Quattor mailing list
Getting started with git
Lots of good introductions and tutorials using Git and GitHub already exists, for example:
- Git Documentation and Videos
- CodeSchool and GitHub’s TryGit
Workflow
- Fork the repository you want to work on
- Clone the forked repository locally using the
ssh
URL- Your fork is known as
origin
- Your fork is known as
- Add the
upstream
repository using thehttps
URL - Start with a new branch
- Do not work in
master
branch
- Do not work in
- Make modifications, add and commit them
- Try to use meaningful messages
- For the the
configuration-modules-core
(and otherconfiguration-modules
) repository, set the component name in the commit message when working on more then one component in same branch.
- For the the
- Try to use meaningful messages
- Push your changes to your fork (i.e. to
origin
)- Do not push to
upstream
- Do not push to
- Run the unit tests
- Add new ones to cover your changes (or refine existing ones)
- More information on running the tests
- Open a pull request (PR)
- Meaningful title; title will be part of the release notes
- For
configuration-modules
repository: start the title with the component that is being modified - When more then one component is modified, describe the general work in the title; the commit messages should have the component names.
- For
- Set
milestone
(i.e. the release you want this merged in)- Set a realistic milestone, e.g. if the PR is not urgent or not finished or you have no time to follow up, you might want to pick a later milestone.
- Meaningful title; title will be part of the release notes
- The initial PR will trigger a jenkins build of the unit tests
- The tests are run with the PR merged in current master
- The PR will be reviewed, and after the reviewer is satisfied, it will be merged in.
- Every 2 months, a release is made by the release manager that will contain your changes
- Only for severe regressions / bugs, the release manager might consider an intermediate release to address the specific issue.
- To start using your new code, you can make your own
package
and upload it to your own repository- Best to add a separate
testing
yum repository (no snapshots)- This repository should be empty most of the time, but you can put your self-built packages there until the new release is out that contains your changes.
- Best to add a separate
Maven
Quattor uses maven
for its software project management.
All source code and unit tests are kept under the src
subdirectory.
src/main/perl
for perl modulessrc/main/pan
for pan templates likeschema.pan
src/test/perl
for the perl unit tests (and any other perl helper modules that might required)src/test/resources
for pan templates that are used with the unit tests- metaconfig services are an exception
During testing, a target
subdirectory is created by the maven tool (and removed with mvn clean
).
The process is steered via a pom.xml
file, that is derived from a quattor maven artifact.
These pom files require few changes, but typical ones are:
- add developer / maintainer
- set the project name (e.g. in case of a new component)
- add custom plugins for specific projects
- bump the version of the
build-profile
to the latest usingmvn update
maven commands
Most common commands are
mvn clean
cleans any previous maven runs (in particular thetarget
directory)mvn test
runs the unit tests- best to run
mvn clean test
- best to run
mvn package
Sometimes you will want to make a rpm or tarball to start using your code while waiting for the PR to be reviewed and merged. This command will create the rpm (and tarball).package
also runs the tests, and also here it is advised to usemvn clean package
When newer build tools are available, use mvn update
to bump the version in the pom.xml
(do not edit by hand).
More information on running the tests
Adding new component in configuration-modules or AII
TODO: more info
New components should be added to the parent pom.xml
in order to be part of the release.
Copy initial pom.xml
from other component/hook, change the project.