HOWTO populate the integration branch » History » Version 23
Loïc Dachary, 07/19/2015 01:51 PM
1 | 3 | Loïc Dachary | Before a backported commit can be merged into the release branch, it must be tested in an integration branch. It serves two purposes: |
---|---|---|---|
2 | |||
3 | * Detect trivial problems that would break the upgrade tests run on the release branch (they are run at the tip of the branch, not at the latest point release) |
||
4 | 13 | Loïc Dachary | * Do not pollute the release branch with reverted commits (commits would have to be reverted because the stable branch must never be rebased) |
5 | 1 | Loïc Dachary | |
6 | 11 | Loïc Dachary | Let say the release to be tested is *$release* (i.e. giant for instance) and your local clone has two remotes: *origin* which is your read/write fork of the official ceph repository and *ceph* which is the read only official ceph repository. |
7 | <pre> |
||
8 | ceph https://github.com/ceph/ceph.git (fetch) |
||
9 | ceph https://github.com/ceph/ceph.git (push) |
||
10 | origin git@github.com:dachary/ceph.git (fetch) |
||
11 | origin git@github.com:dachary/ceph.git (push) |
||
12 | </pre> |
||
13 | 1 | Loïc Dachary | |
14 | 22 | Loïc Dachary | * Fetch the latest $release : git fetch ceph |
15 | 23 | Loïc Dachary | * Verify each pull request have a successful make check bot report and prefix *DNM* the one that do not so they are not considered |
16 | 18 | Loïc Dachary | * Create a $release-backports branch locally if it does not already exists: *git checkout -b $release-backports ceph/$release* |
17 | 11 | Loïc Dachary | * Reset it to ceph/$release: *git reset --hard ceph/$release* |
18 | * Fetch all pull requests from github. Each pull request XXX has its own branch in the official ceph repository, named *pull/XXX* |
||
19 | 21 | Loïc Dachary | ** For finding out the pull requests in github against a milestone; Github's api can be queried (see the *collect_pr* shell function below). |
20 | 11 | Loïc Dachary | ** Retrieve the commits of the pull request XXX: *git fetch --force ceph +refs/pull/XXX/head:refs/remotes/ceph/pull/XXX/head* |
21 | 12 | Loïc Dachary | ** Get the title of the pull request: *eval title=$(curl --silent https://api.github.com/repos/ceph/ceph/pulls/XXX | jq .title)* |
22 | 11 | Loïc Dachary | ** Merge the pull request in the local integration branch. The *--no-ff* ensures that even if the merge commit could be skipped, it will not be. *git merge --no-ff -m "$(echo -e "Merge XXX: $title\n\nReviewed-by: Myself <me@me.com>")" ceph/pull/XXX/head* |
23 | * Modify the pull requests individually to fix merge conflicts (i.e. they must merge cleanly, which may involving aggregating two pull requests into a single one designed to properly resolve the conflict). |
||
24 | * Push the integration branch to github: *git push --force origin $release-backports* |
||
25 | * Verify the integration branch compiles and passes make check |
||
26 | ** On the local machine: *./run-make-check.sh* |
||
27 | ** Via the make check bot by creating a pull request with the $release-backports* integration branch |
||
28 | * Push the integration branch to the official repository: *git push --force ceph $release-backports* (requires write permission to the ceph repository) |
||
29 | 1 | Loïc Dachary | |
30 | 12 | Loïc Dachary | The following snippet summarizes all the actions above: |
31 | 9 | Loïc Dachary | <pre> |
32 | 20 | Loïc Dachary | github_token=55844b338f33e616d6fec2ee # dachary |
33 | 1 | Loïc Dachary | release=hammer |
34 | 20 | Loïc Dachary | reviewer='Loic Dachary <ldachary@redhat.com>' |
35 | 1 | Loïc Dachary | |
36 | 20 | Loïc Dachary | function collect_prs() { |
37 | local pages=$(curl -Is "https://api.github.com/repos/ceph/ceph/issues?page=1&per_page=100&access_token=$github_token" | grep ^Link | sed 's/.*?page=\([0-9]\+\).*/\1/') |
||
38 | local page |
||
39 | for page in $(seq 1 $pages) |
||
40 | do |
||
41 | curl --silent "https://api.github.com/repos/ceph/ceph/issues?page=$page&per_page=100&access_token=$github_token" | jq --arg release "$release" '.[] | select(.milestone.title == $release) | select(.title | contains("DNM") | not) | [.number, .title] | @sh' | while read line ; do |
||
42 | eval eval set $line |
||
43 | echo $1 |
||
44 | echo "https://github.com/ceph/ceph/pull/$1 $2" >&2 |
||
45 | done |
||
46 | done |
||
47 | } |
||
48 | PRS=$(collect_prs) |
||
49 | 1 | Loïc Dachary | |
50 | 22 | Loïc Dachary | git fetch ceph |
51 | 17 | Abhishek Lekshmanan | git checkout -b $release-backports ceph/$release |
52 | git reset --hard ceph/$release |
||
53 | git fetch --force ceph $(for ref in $PRS ; do echo +refs/pull/$ref/head:refs/remotes/ceph/pull/$ref/head ; echo +refs/pull/$ref/merge:refs/remotes/ceph/pull/$ref/merge ; done) |
||
54 | 20 | Loïc Dachary | for pr in $PRS ; do eval title=$(curl --silent https://api.github.com/repos/ceph/ceph/pulls/$pr?access_token=$github_token | jq .title) ; echo "$pr $title" ; git --no-pager log --oneline ceph/pull/$pr/merge^1..ceph/pull/$pr/merge^2 ; git --no-pager merge --no-ff -m "$(echo -e "Merge $pr: $title\n\nReviewed-by: $reviewer")" ceph/pull/$pr/head ; done |
55 | git push --force ceph $release-backports |
||
56 | |||
57 | # hack to figure out what conflicts with what, lot of room for improvement |
||
58 | # PRS_B are the PRS found to conflict and set aside |
||
59 | PRS_A="5171 5170 5129 5062 5056 5051 5044 5043 5039 5037 4867 4788 4771 4769 4765 4762 4642 4641 4639 4633 4632 4631 4630 4584 4583 4582 4535" PR_B="4635 4636 4597" |
||
60 | for pr_a in $PR_A ; do git reset --hard ceph/$release ; for pr_b in $PR_B ; do git --no-pager merge --no-ff -m "$(echo -e "Merge $pr_a" ceph/pull/$pr/head ; git --no-pager merge --no-ff -m "Merge $pr_b" ceph/pull/$pr/head || echo "CONFLICT $pr_a $pr_b" ; done ; done |
||
61 | |||
62 | 1 | Loïc Dachary | </pre> |