In order for a pull request to be ready, it must have been:
- Given a +1 by at least 2 committers
- Have an associated JIRA in the Apache Metron JIRA
Once a pull request is ready to be merged, the following is the process to use to merge into apache master.
Prerequisite 1 - Setting Up Your Github Environment
Prerequisite 2 - Setting Up Your Repo
Start with a clean clone of my personal fork of Metron
git clone firstname.lastname@example.org:james-sirota/incubator-metron.git
Add the apache repo as a remote repository
git remote add apache https://git-wip-us.apache.org/repos/asf/incubator-metron.git
Sync apache with our github clone
git pull apache master
[If needed] Push changes to github clone
Merging the Pull Request: Gathering Information
Step 1 - Gather Information about the pull request
Now that we have a repo set up that is clean, we need to merge the pull request. We want to squash the commits done as part of the PR so that we can keep the commits relatively isolated and uniform. From the pull request page on github, you will need the following information:
- The owner’s github username and email address
- The pull request remote branch (Please do NOT do your development in the master branch of your github mirror of Metron)
- The pull request number
First, look at the pull request. It will look something like this:
Step 2 - Gather Information about the committer
Finding the email address may be tricky because github tries to hide it from the web UI. I sometimes clone the repo and do a git log to see the actual email:
git clone --bare email@example.com:merrimanr/incubator-metron.git METRON-72
Towards the top of the log you will notice:
Author: rmerriman <firstname.lastname@example.org>Date: Fri Mar 18 12:49:31 2016 -0500
Step 3 - Merging the Pull Request: Pulling and Squashing
Now you can gather information, you can pull the remote branch from the PR’s clone into your local git repo via “git pull —squash email@example.com:USERNAME/incubator-metron.git BRANCH".
First make sure you are on master
git checkout master
Checkout the PR. This should pull the changes into the current repo and not commit them.
git pull --squash firstname.lastname@example.org:merrimanr/incubator-metron.git METRON-72
Step 4 - Merging the Pull Request: Verifying
After a successful pull, you need to verify that the PR meets minimal standards after the merge. Presumably more rigorous quality checks have been done before the vote was given on the PR, this is just to ensure minimal quality control.
mvn apache-rat:check && cd metron-streaming && mvn clean integration-test && cd ..
If this completed successfully, then we have ensured that:
- Our Unit tests function
- Our Integration tests function
- Licenses are checked by apache-rat
Step 5 - Merging the Pull Request: Committing
From here, you can make the commit, ensuring that
- The commit message is structured appropriately to close the PR
- We have credited the user appropriately
The format for the commit message is as follows:
git commit --author=“PR_USER <PR_EMAIL>" -a -m “JIRA PR_REASON (PR_USER via YOUR_USER) closes apache/incubator-metron#PR_NUMBER”
git commit --author="merrimanr <email@example.com>" -a -m "METRON-72 Create unified enrichment topology (merrimanr via jsirota) closes apache/incubator-metron#50"
You will get a message:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
Now that you’ve committed locally, you need to push to apache:
git push apache master
Step 6 - Merging the Pull Request: After Action
After committing a PR, you should remember to close the JIRA ticket associated with the PR