HOWTO backport commits » History » Version 20
Abhishek Lekshmanan, 06/07/2015 05:13 PM
1 | 1 | Loïc Dachary | h3. Backport issues |
---|---|---|---|
2 | |||
3 | 18 | Loïc Dachary | * Pick one entry with the highest *Priority* field in the list of backports linked from [[HOWTO|the top level page]] (for instance "hammer backports":http://tracker.ceph.com/projects/ceph/issues?query_id=78) |
4 | 7 | Loïc Dachary | * git clone a fork of http://github.com/ceph/ceph |
5 | 10 | Loïc Dachary | * *git checkout -b wip-$issue-$release origin/$release* to create a branch with a name that reflects the issue being fixed and the target release: this naming is convenient to select all branches containing backports for firefly or select all branches containing backports for a specific issue |
6 | 1 | Loïc Dachary | * git cherry-pick -x the commits from the pull request that was targeting master (not from the pull requests targeting stable branches) |
7 | 19 | Loïc Dachary | ** the original issue is linked in the *Related issues* section of the issue, as a *Copied from* link |
8 | ** the pull request or commit targeting master can be found by following the *Copied from* link and searching the original issue |
||
9 | 10 | Loïc Dachary | * *git push origin wip-$issue-$release* to publish the branch on github and be able to create a pull request from it |
10 | 16 | Loïc Dachary | * generate a *$github_token* by "following the GitHub instructions":https://help.github.com/articles/creating-an-access-token-for-command-line-use/ |
11 | 14 | Loïc Dachary | * retrieve the *$redmine_key*: it is a token that will allow you to script issue updates |
12 | ** login http://tracker.ceph.com/ |
||
13 | ** visit http://tracker.ceph.com/my/account |
||
14 | ** look for *API access key* in the page (Control-f) |
||
15 | ** click on the *Show* link just under *API access key* |
||
16 | ** copy the hexadecimal number it shows |
||
17 | ** redmine_key=b586ce6a7a936e71f351c93ac0b65a588d4333 |
||
18 | 10 | Loïc Dachary | * create a pull request from the *wip-$issue-$release* branch with the same title as the issue |
19 | 7 | Loïc Dachary | <pre> |
20 | 10 | Loïc Dachary | account=myaccount |
21 | 7 | Loïc Dachary | eval title=$(curl --silent 'http://tracker.ceph.com/issues/'$issue.json?key=$redmine_key | jq .issue.subject) ; echo $title |
22 | 10 | Loïc Dachary | number=$(curl --silent --data-binary '{"title":"'"$title"'","head":"'$account':wip-'$issue-$release'","base":"'$release'","body":"http://tracker.ceph.com/issues/'$issue'"}' 'https://api.github.com/repos/ceph/ceph/pulls?access_token='$github_token | jq .number) |
23 | </pre> |
||
24 | 13 | Loïc Dachary | * assigned the pull request to yourself (because it needs to got through integration tests before it can be approved by the original author), add the relevant labels (rgw, core, bug fix, feature...) and set the milestone to $release (requires write permission to the ceph repository) |
25 | 10 | Loïc Dachary | <pre> |
26 | component=core ; curl --silent --data-binary '{"milestone":"'$release_number'","assignee":"'$account'","labels":["bug fix","'$component'"]}' 'https://api.github.com/repos/ceph/ceph/issues/'$number'?access_token='$github_token |
||
27 | </pre> |
||
28 | * wait for the make check bot to run the *run-make-check.sh* script on the branch that was pushed and verify it works |
||
29 | 18 | Loïc Dachary | * Set the issue description to only contain the URL to the pull request |
30 | 10 | Loïc Dachary | <pre> |
31 | 18 | Loïc Dachary | curl --verbose -X PUT --header 'Content-type: application/json' --data-binary '{"issue":{"description":"https://github.com/ceph/ceph/pull/'$number'"}}' 'http://tracker.ceph.com/issues/'$issue.json?key=$redmine_key |
32 | 2 | Loïc Dachary | </pre> |
33 | * if there is a conflict explain how it was resolved in the commit message, below the Conflicts line. For instance: |
||
34 | <pre> |
||
35 | commit c60da2f3c34e7325c748d2d6e55140a0a30013fd |
||
36 | Author: Samuel Just <sjust@redhat.com> |
||
37 | Date: Thu Nov 20 15:15:08 2014 -0800 |
||
38 | 1 | Loïc Dachary | |
39 | PGLog: include rollback_info_trimmed_to in (read|write)_log |
||
40 | |||
41 | Fixes: #10157 |
||
42 | Backport: firefly, giant |
||
43 | Signed-off-by: Samuel Just <sjust@redhat.com> |
||
44 | (cherry picked from commit 1fe8b846641486cc294fe7e1d2450132c38d2dba) |
||
45 | |||
46 | Conflicts: |
||
47 | src/osd/PGLog.cc |
||
48 | in the context coll_t::META_COLL was replaced with META_COLL |
||
49 | </pre> |
||
50 | * The difference between the original commit and the one including a conflict resolution can be displayed with |
||
51 | 11 | Loïc Dachary | <pre> |
52 | commit=c7d0d51cb574594de6f09457c960347b11fc2474 ; picked_from=$(git show --no-patch --pretty=%b $commit | perl -ne 'print if(s/.*cherry picked from commit (\w+).*/$1/)') ; diff -u --ignore-matching-lines '^[^+-]' <(git show $picked_from) <(git show $commit) |
||
53 | </pre> |
||
54 | 18 | Loïc Dachary | * if the conflict is difficult to resolve, seek help from the author of the original commit (see "librbd: deadlock in image refresh":https://github.com/ceph/ceph/pull/4176 for instance) and assign the issue to her/him, or to a [[HOWTO#Leads|lead]] |
55 | * after the backport passed [[HOWTO run integration and upgrade tests|integration and upgrade tests]], ask for approval from [[HOWTO#Leads|lead]] of the corresponding component before merging it in the stable branch |
||
56 | 1 | Loïc Dachary | |
57 | 10 | Loïc Dachary | All commits being backported must be cherry-picked from master. There are exceptions to this rule (see https://github.com/ceph/ceph/pull/4175 for instance: it fixes a regression introduced by an incorrect resolution of a backport) but they are rare. When a backport is done to fix a bug that shows in the integration tests or upgrade tests run by cron, testing the backport in an integration branch is redundant because the existing tests will keep failing. |
58 | |||
59 | 17 | Nathan Cutler | Here are the snippets above grouped together for easier copy/paste: |
60 | 10 | Loïc Dachary | <pre> |
61 | redmine_key=b586c588d4333 |
||
62 | github_token=bc275830c635 |
||
63 | 12 | Loïc Dachary | github_user=dachary |
64 | 10 | Loïc Dachary | issue=$1 |
65 | # can't seem to extract the release number with the api |
||
66 | release=giant ; release_number=2 |
||
67 | 1 | Loïc Dachary | release=firefly ; release_number=3 |
68 | release=hammer ; release_number=5 |
||
69 | 20 | Abhishek Lekshmanan | [ $(curl --silent http://tracker.ceph.com/issues/$issue.json | jq -r .issue.tracker.name) == "Backport" ] || echo "not a backport issue"; exit 1 |
70 | 12 | Loïc Dachary | git checkout -f -b wip-$issue-$release ceph/$release |
71 | git cherry-pick -x ..... |
||
72 | 10 | Loïc Dachary | git push loic wip-$issue-$release ; sleep 2 # let github catch up |
73 | 1 | Loïc Dachary | title=$(curl --silent 'http://tracker.ceph.com/issues/'$issue.json?key=$redmine_key | jq .issue.subject | tr -d '\\"') |
74 | 17 | Nathan Cutler | echo "Issue title: $title" |
75 | number=$(curl --silent --data-binary '{"title":"'"$title"'","head":"'$github_repo':wip-'$issue-$release'","base":"'$release'","body":"http://tracker.ceph.com/issues/'$issue'"}' 'https://api.github.com/repos/ceph/ceph/pulls?access_token='$github_token | jq .number) |
||
76 | echo "Opened pull request $number" |
||
77 | 12 | Loïc Dachary | component=core ; curl --silent --data-binary '{"milestone":"'$release_number'","assignee":"'$github_user'","labels":["bug fix","'$component'"]}' 'https://api.github.com/repos/ceph/ceph/issues/'$number'?access_token='$github_token |
78 | 10 | Loïc Dachary | firefox https://github.com/ceph/ceph/pull/$number |
79 | 18 | Loïc Dachary | curl --verbose -X PUT --header 'Content-type: application/json' --data-binary '{"issue":{"description":"https://github.com/ceph/ceph/pull/'$number'"}}' 'http://tracker.ceph.com/issues/'$issue.json?key=$redmine_key |
80 | 10 | Loïc Dachary | firefox http://tracker.ceph.com/issues/$issue |
81 | </pre> |