Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Run the merge script:

    Code Block
    languagebash
    python kafka-merge-pr.py
  2. Answer the questions prompted by the script.
    When the script asks “List pull request commits in squashed commit message? (y/n)”, answer n.

    If there is any error during the script execution then the process can be aborted without running the clean up routine. In this case, make sure you delete the PR_TOOL_* branches before re-running the script. (look the section below entitled "Temporary local branches" to understand what artifacts the script creates).

Under the hood

  1. Merging and/or cherry-picking
    1.  If the Github PR is already closed by asfgit then this indicates the PR has already been merged into Apache Git repo, so the script will ask if you want to cherry-pick the PR commits to other branches (to backport the changes to other branches, for example). After we are done cherry-picking (the script asks if we want to continue), no further steps from this script are executed.
       
    2. Otherwise, the script will try to merge the PR into the target reference (if the PR is targeting the master branch it will try to merge the PR on master, if targeting branch-3.5 it will try to merge on branch-3.5, etc). It will ask for authors and reviewers names/emails, among other bits of info that compose the commit log.


    3. After executing step b, the script will ask if you want to backport (i.e., cherry-pick) the PR into other branches, suggesting the latest branch it has already find (say, branch-3.6), but you are free to choose other branches. After each cherry-pick it will ask if you want to backport the PR to another branch until you choose not to (in a nutshell, the same procedure as 2.3.1).


    4. During this step, the script will update the JIRA entry, marking it as closed. It will try to fill the fixed versions accordingly. The committer should provide the JIRA ID and have the credentials to be able to do so. If the JIRA credentials are not set up, the script will just finish without closing the JIRA issue, so make sure the correspondent issue was closed.

       

       

  2. Temporary local branches
    1. Suppose we want to merge the PR 34 into master:

      1. the script creates a local branch for pull request 34 commits called PR_TOOL_MERGE_PR_34


      2.  Then it creates a local branch from the Apache Git repo as the merge destination called PR_TOOL_MERGE_PR_34_MASTER and checkout into this branch. As the name shows, PR 34 is gonna be merged into master branch. 

      3.  The script automatically performs a merge with commit squashing from PR_TOOL_MERGE_PR_34 into PR_TOOL_MERGE_PR_34_MASTER:

        The script executes the following commands:

        Code Block
        $ git checkout PR_TOOL_MERGE_PR_34_MASTER
        
        $ git merge --squash PR_TOOL_MERGE_PR_34
      4. After the merge the tool ask if we would like to push PR_TOOL_MERGE_PR_34_MASTER to the changes to master at Apache Git repo.


      5. Finally, the clean up process removes the local temporary branches (PR_TOOL_*) from the  commiter’s ZK git repo (i.e., git branch -D PR_TOOL_<suffix> )


      6. Cherry pick work along the same lines, but the temporary branch name created (the one that will be pushed to Apache git) has the name PR_TOOL_PICK_PR_34_branch-3.4 if we want to cherry pick the PR 34 into branch-3.4, for example.

 

Info

Content by Label
showLabelsfalse
max5
spacesZOOKEEPER
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("committer","practices") and type = "page" and space = "ZOOKEEPER"
labelscommitter practices

...