Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 1 | .. _coding-release-bugfix: |
| 2 | |
| 3 | Create a patch on a release branch |
| 4 | ================================== |
| 5 | |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 6 | .. code-block:: shell-session |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame^] | 7 | :caption: Clone repository |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 8 | |
| 9 | # ------------------------------------------------ |
| 10 | # Clone a repostiory of interest (ex: votlha-lib-go) |
| 11 | # Checkout release branch voltha-2.12 for patching |
| 12 | # ------------------------------------------------ |
| 13 | % git clone "ssh://gerrit.opencord.org:29418/voltha-lib-go.git" |
| 14 | % cd voltha-lib-go |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame^] | 15 | |
| 16 | # Pull in all remote tags/branches |
| 17 | % git fetch --all |
| 18 | |
| 19 | .. code-block:: shell-session |
| 20 | :caption: Create a dev branch for the patch |
| 21 | |
| 22 | # ---------------------------------- |
| 23 | # Display available release branches |
| 24 | # ---------------------------------- |
| 25 | % git branch -a |
| 26 | |
| 27 | master |
| 28 | remotes/origin/HEAD -> origin/master |
| 29 | remotes/origin/master |
| 30 | remotes/origin/voltha-2.11 |
| 31 | remotes/origin/voltha-2.12 |
| 32 | |
| 33 | # --------------------------------------- |
| 34 | # Create a dev branch anchored to release |
| 35 | # --------------------------------------- |
| 36 | % git checkout -b dev-joey voltha-2.12 |
| 37 | |
| 38 | .. code-block:: shell-session |
| 39 | :caption: Sanity check branch parent |
| 40 | |
| 41 | # ---------------------------------------------------------------------- |
| 42 | # git --graph: Verify tag and branch values make sense: |
| 43 | # (HEAD -> dev-joey, tag: v2.12.0, origin/voltha-2.12) |
| 44 | # ---------------------------------------------------------------------- |
| 45 | # Finding 'origin/master' as the ancestor for a release patch checkout |
| 46 | # is a red flag something is amiss. |
| 47 | # ---------------------------------------------------------------------- |
| 48 | |
| 49 | % git log --graph --decorate --oneline $@ |
| 50 | * 653504fa (HEAD -> dev-joey, tag: v2.12.0, origin/voltha-2.12*) [VOL-5247] repo:voltha-go release patching prep |
| 51 | |
| 52 | % git branch -vv |
| 53 | * dev-joey 253fa01b [origin/voltha-2.12: ahead 1] repo:voltha-go Post tag & branch activity |
| 54 | help 253fa01b repo:voltha-go Post tag & branch activity |
| 55 | master 4e0e0347 [origin/master] [VOL-5247] repo:voltha-go release patching prep |
| 56 | |
| 57 | HEAD will be attached to origin/voltha-2.12 and the latest release tag v7.5.3 |
| 58 | |
| 59 | :: |
| 60 | |
| 61 | git log --graph --decorate --oneline $@ |
| 62 | |
| 63 | * aeb3c4f (HEAD -> voltha-2.12, tag: v7.5.3, origin/voltha-2.12) [VOL-5245] -- release patch |
| 64 | * ad265dd (tag: v7.5.2) [VOL-5245] - branch and release repo:voltha-lib-go |
| 65 | * 9cdee9f (tag: v7.5.1, tag: v2.12.0) [VOL-5245] branch and release repo:voltha-lib-go |
| 66 | |
| 67 | .. code-block:: shell-session |
| 68 | :caption: Sanity check dev sandbox attributes |
| 69 | |
| 70 | # ------------------------------------------------------ |
| 71 | # Sanity check your sanbox |
| 72 | # ------------------------------------------------------ |
| 73 | # 1) VERSION file: no conflicts (master > release) |
| 74 | # master=x.y.0 > release=x.{y-1}.z |
| 75 | % cat VERSION |
| 76 | |
| 77 | # .gitreview - commit, rebase, merge will be applied to the release branch |
| 78 | % grep -i branch .gitreview |
| 79 | defaultbranch=master |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 80 | |
| 81 | # ------------------------------------------------------ |
| 82 | # Or if something is amiss checkout by tag for diagnosis |
| 83 | # ------------------------------------------------------ |
| 84 | % cat VERSION |
| 85 | % git checkout tags/v{VERSION-FILE-STRING} |
| 86 | |
| 87 | Command output |
| 88 | |
| 89 | :: |
| 90 | % git checkout voltha-2.12 |
| 91 | Branch 'voltha-2.12' set up to track remote branch 'voltha-2.12' from 'origin'. |
| 92 | Switched to a new branch 'voltha-2.12' |
| 93 | |
| 94 | |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 95 | Edit and commit |
| 96 | --------------- |
| 97 | |
| 98 | .. code-block:: shell-session |
| 99 | :caption: Edit, commit, rebase and review |
| 100 | |
| 101 | # ---------------------------------------------------------------- |
| 102 | # Edit sources to taste |
| 103 | # ---------------------------------------------------------------- |
| 104 | {emacs,vi,$EDITOR} ... |
| 105 | |
| 106 | # :ref:`pull-request--commit-message` |
| 107 | % git commit -F ./commit-message |
| 108 | |
| 109 | |
| 110 | Rebase against the release branch |
| 111 | --------------------------------- |
| 112 | |
| 113 | .. code-block:: shell-session |
| 114 | :caption: Rebase against release branch ``NOT branch=master`` |
| 115 | |
| 116 | # Run one of |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame^] | 117 | % git checkout voltha-2.12 |
| 118 | % git pull --ff-only origin voltha-2.12 |
| 119 | % git checkout dev-joey |
| 120 | % git rebase -i "origin/voltha-2.12" |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 121 | |
| 122 | |
| 123 | Code Review |
| 124 | ----------- |
| 125 | |
| 126 | .. code-block:: shell-session |
| 127 | :caption: Push to gerrit, code review |
| 128 | |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame^] | 129 | % git review --reviewers "foo@bar.org" |
Joey Armstrong | 54fd779 | 2024-01-18 09:12:30 -0500 | [diff] [blame] | 130 | |
| 131 | |
| 132 | Verify Patch |
| 133 | ------------ |
| 134 | |
| 135 | Now visit gerrit and verify your release bugfix is correctly decorated. |
| 136 | In gerrit, review the 'Repo|Branch' item in the top left corner. |
| 137 | 'votlha-2.12' or the release tag will be visible. If branch 'master' is |
Joey Armstrong | ad86210 | 2024-01-28 15:36:40 -0500 | [diff] [blame^] | 138 | listed abandon the patch, it will not be applied to the proper branch. |