You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This section documents the process of merging code changes contributed via Github Pull Requests. It assumes you have a clone of ZooKeeper's Git repository and the user has committer access rights.

zk-merge-pr.py is a script that automates the process of accepting a code change into the project. It creates a temporary branch from apache/master, squashes the commits in the pull request, rewrites the commit message in the squashed commit to follow a standard format including information about each original commit, merges the squashed commit into the temporary branch, pushes the code to apache/master and closes the JIRA ticket. The push will then be mirrored to apache-github/master, which will cause the PR to be closed due to the pattern in the commit message. Note that the script will ask the user before executing remote updates (ie git push and closing JIRA ticket), so it can still be used even if the user wants to skip those steps.

 

This script is a modified version of an Apache Kafka tool: https://github.com/apache/kafka/blob/trunk/kafka-merge-pr.py that, in its turn, is a modified version of an Apache Spark tool: https://github.com/apache/spark/blob/master/dev/merge_spark_pr.py

Step-by-step guide

Setting Up:

  1. Add aliases for the remotes expected by the merge script (if you haven't already):

    $ cd $ZOOKEPER_BASE_DIR
    $ git remote add apache-github https://github.com/apache/zookeeper.git
    $ git remote add apache https://git-wip-us.apache.org/repos/asf/zookeeper.git
  2. Before starting using the script it’s required to setup environment variables below:

    PR_REMOTE_NAME - points to Github mirror of Apache project (default git-remote name: apache-github)

    PUSH_REMOTE_NAME - points to Apache Git repo (default git-remote name: apache)

    $ export PR_REMOTE_NAME=apache-github

    $ export PUSH_REMOTE_NAME=apache

  3. Install jira-python: 

    sudo easy_install JIRA

  4. Setup environment variables to JIRA credentials:

    JIRA_USERNAME & JIRA_PASSWORD - apache JIRA credentials

     

    $ export JIRA_USERNAME=myname
    $ export JIRA_PASSWORD=mypassword

     

    If you don't execute steps 3 and 4 then the script will not be able to automatically close the JIRA after merging the PR.

     

  5. (Optional) Setup Github OAUTH token:

    GITHUB_OAUTH_KEY  (optional) - if you exceed Github API rate limit then set this variable to allow it to surpass this limit as the script comment states:

     

    $ export GITHUB_OAUTH_KEY=<your-github-oauth-key>

     

     

     



 

Once the pull request is ready to be merged (it has been reviewed, feedback has been addressed, CI build has been successful and the branch merges cleanly into trunk):

  1. adfadsfsa

 

  • No labels