1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. SPDX-License-Identifier: CC-BY-4.0
3 .. (c) 2017 Mirantis Inc., Enea AB and others.
5 Fuel@OPNFV submodule fetching and patching
6 ==========================================
8 This directory holds submodule fetching/patching scripts, intended for
9 working with upstream Fuel/MCP components (e.g.: reclass-system-salt-model) in
10 developing/applying OPNFV patches (backports, custom fixes etc.).
12 The scripts should be friendly to the following 2 use-cases:
13 - development work: easily cloning, binding repos to specific commits,
14 remote tracking, patch development etc.;
15 - to provide parent build scripts an easy method of tracking upstream
16 references and applying OPNFV patches on top;
18 Also, we need to support at least the following modes of operations:
19 - submodule bind - each submodule patches will be based on the commit ID
20 saved in the .gitmodules config file;
21 - remote tracking - each submodule will sync with the upstream remote
22 and patches will be applied on top of <sub_remote>/<sub_branch>/HEAD;
24 Workflow (development)
25 ----------------------
26 The standard development workflow should look as follows:
28 1. Decide whether remote tracking should be active or not:
29 NOTE: Setting the following var to any non-empty str enables remote track.
30 NOTE: Leaving unset will enable remote track for anything but stable branch.
32 $ export FUEL_TRACK_REMOTES=""
34 2. All Fuel sub-projects are registered as submodules. To initialize them, call:
35 If remote tracking is active, upstream remote is queried and latest remote
36 branch HEAD is fetched. Otherwise, checkout commit IDs from .gitmodules.
40 3. Apply patches from `patches/<sub-project>/*` to respective submodules via:
44 This will result in creation of:
45 - a tag called `${FUEL_MAIN_TAG}-opnfv-root` at the same commit as Fuel@OPNFV
46 upstream reference (bound to git submodule OR tracking remote HEAD);
47 - a new branch `opnfv-fuel` which will hold all the OPNFV patches,
48 each patch is applied on this new branch with `git-am`;
49 - a tag called `${FUEL_MAIN_TAG}-opnfv` at `opnfv-fuel/HEAD`;
51 4. Modify sub-projects for whatever you need.
52 Commit your changes when you want them taken into account in the build.
54 5. Re-create patches via:
58 Each commit on `opnfv-fuel` branch of each subproject will be
59 exported to `patches/subproject/` via `git format-patch`.
61 NOTE: Only commit (-f) submodules when you need to bump upstream ref.
62 NOTE: DO NOT commit patched submodules!
64 6. Clean workbench branches and tags with:
68 7. De-initialize submodules and force a clean clone with:
72 Sub-project maintenance
73 -----------------------
74 1. Adding a new submodule
75 If you need to add another subproject, you can do it with `git submodule`.
76 Make sure that you specify branch (with `-b`), short name (with `--name`):
78 $ git submodule -b master add --name reclass-system-salt-model \
79 https://github.com/Mirantis/reclass-system-salt-model \
80 relative/path/to/submodule
82 2. Working with remote tracking for upgrading Fuel components
83 Enable remote tracking as described above, which at `make sub` will update
84 ALL submodules (e.g. reclass-system-salt-model) to remote branch (set in
87 * If upstream has NOT already tagged a new version, we can still work on
88 our patches, make sure they apply etc., then check for new upstream
89 changes (and that our patches still apply on top of them) by:
91 $ make deepclean patches-import
93 * If upstream has already tagged a new version we want to pick up, checkout
94 the new tag in each submodule:
96 $ git submodule foreach 'git checkout <newtag>'
98 * Once satisfied with the patch and submodule changes, commit them:
99 - enforce FUEL_TRACK_REMOTES to "yes" if you want to constatly use the
100 latest remote branch HEAD (as soon as upstream pushes a change on that
101 branch, our next build will automatically include it - risk of our
102 patches colliding with new upstream changes);
103 - stage patch changes if any;
104 - if submodule tags have been updated (relevant when remote tracking is
105 disabled, i.e. we have a stable upstream baseline), add submodules:
107 $ make deepclean sub && git add -f relative/path/to/submodule