Project

General

Profile

HOWTO backport commits » History » Version 11

Loïc Dachary, 04/09/2015 03:20 AM

1 1 Loïc Dachary
h3. Backport issues
2
3 9 Loïc Dachary
* Pick one entry with the highest *Severity* field in the list of issues linked from [[HOWTO|the top level page]] (for instance "firefly issues":http://tracker.ceph.com/projects/ceph/issues?query_id=75) and look for more information about it in the inventory page (for instance the "firefly inventory page":http://workbench.dachary.org/ceph/ceph-backports/wikis/firefly#issues-that-need-backporting not only shows issues but also discovers pull requests, commits and backports to other stable branches). Note that *Severity* is different from *Priority*. *Severity* is not used while working on the bug, it's used to prioritize backports only. An issue marked with a high *Priority* may not need to be backported with the same priority.
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 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
8
* create a pull request from the *wip-$issue-$release* branch with the same title as the issue
9 7 Loïc Dachary
<pre>
10 10 Loïc Dachary
account=myaccount
11 7 Loïc Dachary
eval title=$(curl --silent 'http://tracker.ceph.com/issues/'$issue.json?key=$redmine_key | jq .issue.subject) ; echo $title
12 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)
13
</pre>
14
* 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
15
<pre>
16
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
17
</pre>
18
* wait for the make check bot to run the *run-make-check.sh* script on the branch that was pushed and verify it works
19
* Add a link to the pull request in the issue formatted as follows : *$release backport URL to the pull request*
20
<pre>
21 7 Loïc Dachary
curl --verbose -X PUT --header 'Content-type: application/json' --data-binary '{"issue":{"notes":"* '$release' backport https://github.com/ceph/ceph/pull/'$number'"}}' 'http://tracker.ceph.com/issues/'$issue.json?key=$redmine_key
22 2 Loïc Dachary
</pre>
23
* if there is a conflict explain how it was resolved in the commit message, below the Conflicts line. For instance:
24
<pre>
25
commit c60da2f3c34e7325c748d2d6e55140a0a30013fd
26
Author: Samuel Just <sjust@redhat.com>
27
Date:   Thu Nov 20 15:15:08 2014 -0800
28 1 Loïc Dachary
29
    PGLog: include rollback_info_trimmed_to in (read|write)_log
30
    
31
    Fixes: #10157
32
    Backport: firefly, giant
33
    Signed-off-by: Samuel Just <sjust@redhat.com>
34
    (cherry picked from commit 1fe8b846641486cc294fe7e1d2450132c38d2dba)
35
    
36
    Conflicts:
37
    	src/osd/PGLog.cc
38
            in the context coll_t::META_COLL was replaced with META_COLL
39
</pre>
40 11 Loïc Dachary
* The difference between the original commit and the one including a conflict resolution can be displayed with
41
<pre>
42
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)
43
</pre>
44 1 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)
45
* assign the pull request to the [[HOWTO#Leads|lead]] after it passed [[HOWTO run integration and upgrade tests|integration and upgrade tests]]
46
47
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.
48 10 Loïc Dachary
49
50
Here are the snippets above groupped together for easier copy/paste:
51
<pre>
52
redmine_key=b586c588d4333
53
github_token=bc275830c635
54
issue=$1
55
component=rgw
56
# can't seem to extract the release number with the api
57
release=giant ; release_number=2
58
release=firefly ; release_number=3
59
git checkout -b wip-$issue-$release origin/$release
60
git cherry-pick -x .....
61
git push origin wip-$issue-$release ; sleep 2 # let github catch up
62
eval title=$(curl --silent 'http://tracker.ceph.com/issues/'$issue.json?key=$redmine_key | jq .issue.subject) ; echo $title
63
number=$(curl --silent --data-binary '{"title":"'"$title"'","head":"dachary: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)
64
component=core ; curl --silent --data-binary '{"milestone":"'$release_number'","assignee":"dachary","labels":["bug fix","'$component'"]}' 'https://api.github.com/repos/ceph/ceph/issues/'$number'?access_token='$github_token
65
firefox https://github.com/ceph/ceph/pull/$number
66
curl --verbose -X PUT --header 'Content-type: application/json' --data-binary '{"issue":{"notes":"* '$release' backport https://github.com/ceph/ceph/pull/'$number'"}}' 'http://tracker.ceph.com/issues/'$issue.json?key=$redmine_key
67
firefox http://tracker.ceph.com/issues/$issue
68
</pre>