Skip to content

Commit fc7a36b

Browse files
Upgrade macros and kgo (#445)
Co-authored-by: Jenny Hickson <61183013+jennyhickson@users.noreply.github.com>
1 parent d63bbbc commit fc7a36b

5 files changed

Lines changed: 114 additions & 111 deletions

File tree

source/Development/inputs.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ Please see :ref:`this page <macros>` for further information.
150150

151151
.. important::
152152

153-
If your development includes an upgrade macro, you **must** add the
154-
``macro`` keyword to your ticket.
155-
156153
**Do not** apply the upgrade macro to your dev branch prior to the review
157154
process. Instead you must create a test branch. See :ref:`testing`.
158155

source/Development/macros.rst

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ following locations:
3232
``applications/<APPLICATION>/rose-meta/lfric-<APPLICATION>/versions.py``
3333

3434
Variations on this theme occur, e.g. LFRic Apps science sections or
35-
Components in LFRic Core
35+
Components in LFRic Core. Metadata directories are also symlinked from a
36+
top level ``rose-meta`` directory.
3637

3738

3839
Within the file a blank upgrade macro will typically look like this:
@@ -65,8 +66,8 @@ Example of an upgrade macro
6566

6667
Developer Sally Smith wishes to add the logical ``l_bugfix`` to the ``&run_bl``
6768
namelist in the UM. To do this, she replaces the `XXXX` line in the upgrade
68-
macro with her ticket number and adds herself as the author. Within the Python
69-
function ``upgrade``, she adds the appropriate command to include the new
69+
macro with her PR or Issue number and adds herself as the author. Within the
70+
Python function ``upgrade``, she adds the appropriate command to include the new
7071
logical. The macro then looks like this:
7172

7273
.. code-block:: python
@@ -151,31 +152,31 @@ and test branch, but potentially not a development branch.
151152

152153
.. tip::
153154

154-
The wrapper script will read the ``dependencies.sh`` file in your LFRic
155+
The wrapper script will read the ``dependencies.yaml`` file in your LFRic
155156
Apps working copy and will checkout a temporary copy of the LFRic Core
156157
source if required. Some Core metadata changes will also modify the Core
157158
rose apps. In this case make sure to also commit these changes back to the
158159
core branch.
159160

160161
To add upgrade macros to LFRic the following steps can be followed:
161162

162-
1. In your local LFRic Apps clone update the core source in ``dependencies.sh``
163-
if you have LFRic Core changes.
163+
1. In your local LFRic Apps clone update the core source in
164+
``dependencies.yaml`` if you have LFRic Core changes.
164165

165166
2. Add your upgrade macros. These **must** be added to the ``versions.py`` file
166-
in the same directory as the metadata being changed.
167+
in the same ``rose-meta`` directory as the metadata being changed.
167168

168169
3. Run the Upgrade Macro script in a test branch(see :ref:`testing`). This is
169170
located in the `SimSys_Scripts github repo
170-
<https://github.com/MetOffice/SimSys_Scripts>`__ (at meto an up to date
171-
clone is available in $UMDIR/SimSys_Scripts). The syntax for running is:
171+
<https://github.com/MetOffice/SimSys_Scripts>`__ (at the MetOffice an up to
172+
date clone is available in $UMDIR/SimSys_Scripts). The syntax for running is:
172173

173-
.. code-block:: shell
174+
.. code-block:: shell
174175
175-
export CYLC_VERSION=8
176+
export CYLC_VERSION=8
176177
177-
SimSys_Scripts/lfric_macros/apply_macros.py vnX.Y_tZZZZ \
178-
[--apps=/path/to/apps] [--core=/path/to/core] [--jules=/path/to/jules]
178+
SimSys_Scripts/lfric_macros/apply_macros.py vnX.Y_tZZZZ \
179+
[--apps=/path/to/apps] [--core=/path/to/core] [--jules=/path/to/jules]
179180
180181
.. important::
181182

@@ -185,14 +186,9 @@ To add upgrade macros to LFRic the following steps can be followed:
185186
The Apps, Core and Jules options are paths to sources for each of these. Apps
186187
will default to the present location (so it is recommended to launch from an
187188
Apps working copy). Core and Jules will default to reading the
188-
``dependencies.sh`` file in the Apps source if not provided.
189+
``dependencies.yaml`` file in the Apps source if not provided.
189190

190191
The ``vnXX.Y_tTTTT`` option must match the After Tag of your upgrade macro.
191192
When setting this, the version is the last released version of LFRic Apps. If
192193
it's a linked Apps-Core ticket, then set the ticket number as the one where
193194
the most metadata changes are being made.
194-
195-
.. tip::
196-
197-
The apply_macros script requires python >= 3.9. At the Met Office this can
198-
be achieved by ``module load scitools``.

source/Development/testing.rst

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,42 @@ Bespoke:
4343
Test branches & Upgrade Macros
4444
------------------------------
4545

46-
There are a few cases where testing your change will require you to make
47-
changes to your branch that don't want committing to trunk. To do this you can
48-
create a test branch. This is a branch-of-branch from your development branch
49-
and allows you to make those changes in an isolated environment while leaving
50-
your original development clean.
46+
.. tip::
47+
48+
While we continue to use ``dev`` and ``test`` branch nomenclature from fcm,
49+
in github these terms have no technical meaning and are simply a way to
50+
distinguish between 2 branches.
51+
52+
There are a few cases where testing your change will require you to make changes
53+
to your branch that don't want committing to trunk. To do this you can create a
54+
test branch. This is a branch-of-branch from your development branch and allows
55+
you to make those changes in an isolated environment while leaving your original
56+
development clean.
5157

52-
To create one:
58+
To create a test branch:
5359

5460
.. code-block:: shell
5561
56-
fcm bc -t test --bob testbranchname \
57-
fcm:project.x_br/dev/yourname/devbranchname
62+
git switch -c test_branch_name [<start_point>]
5863
59-
Then check this out and use it for running any tests you'd like to carry out.
64+
If not provided ``start_point`` will default to your
65+
current branch.
6066

6167
If using a test branch then do list this on your ticket and include the results
6268
of this testing alongside those from your dev branch.
6369

6470
.. Note::
6571

66-
If your tests fail then you will need to make and commit the fixes to the
67-
development branch and create a new test branch from that latest revision
68-
to test them.
72+
If you need further updates to the dev branch which require retesting on the
73+
test branch, you can update the test branch by merging in the dev branch.
74+
75+
.. code-block::
76+
77+
git switch test_branch_name
78+
git merge dev_branch_name
79+
80+
If testing upgrade macros however, you will likely need a new test branch,
81+
as the macros can only be applied once.
6982

7083
Macros
7184
^^^^^^

source/Reviewers/howtocommit.rst

Lines changed: 69 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -71,103 +71,92 @@ Then switch to the up to date branch, e.g.
7171
**If** the ticket includes metadata changes, upgrade macro changes or a new
7272
rose-stem app then you will need to upgrade the test-suite.
7373

74-
.. dropdown:: versions.py
74+
Update the versions.py file
75+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
7576

76-
``versions.py`` contains a sequence of upgrade macros. Each macro contains
77-
a ``BEFORE_TAG`` and an ``AFTER_TAG`` which should create a single chain,
78-
starting at the last release and finishing with the ticket you are
79-
committing. The tags have the format version_ticket, i.e.
80-
``vnXX.Y_tZZZZ``.
77+
``versions.py`` contains a sequence of upgrade macros. Each macro contains a
78+
``BEFORE_TAG`` and an ``AFTER_TAG`` which should create a single chain, starting
79+
at the last release and finishing with the ticket you are committing. The tags
80+
have the format version_ticket, i.e. ``vnXX.Y_tZZZZ``.
8181

82-
When resolving conflicts in this file make sure that the new macro being
83-
added by your ticket is added to the end of the file. Modify the
84-
``BEFORE_TAG`` to match the ``AFTER_TAG`` of the previous macro in the
85-
chain.
82+
When resolving conflicts in this file make sure that the new macro being added
83+
by your ticket is added to the end of the file. Modify the ``BEFORE_TAG`` to
84+
match the ``AFTER_TAG`` of the previous macro in the chain.
8685

87-
If this is the first macro since the release then the ``BEFORE_TAG`` will
88-
be the version number with no added ticket number.
86+
If this is the first macro since the release then the ``BEFORE_TAG`` will be the
87+
version number with no added ticket number.
8988

90-
Remove the template macro if it is still present.
89+
Remove the template macro if it is still present.
9190

92-
.. dropdown:: Applying Macros
91+
Apply the upgrade macros
92+
^^^^^^^^^^^^^^^^^^^^^^^^
9393

94-
To update the test suite for an upgrade macro, please run:
94+
To update the test suite for an upgrade macro, please run:
9595

96-
.. tab-set::
97-
98-
.. tab-item:: UM
99-
100-
.. code-block:: shell
101-
102-
./admin/rose-stem/update_all.py \
103-
--path=/path/to/working/copy/of/trunk \
104-
--um=vnXX.Y_tZZZZ \
105-
[--jules-path=/path/to/working/copy/of/jules/trunk]
106-
107-
where ``-\-um=vnXX.Y_tZZZZ`` is the ``AFTER_TAG`` of the latest
108-
upgrade macro.
109-
110-
If there is a macro for fcm_make or createbc then check that the
111-
makes ``version*_*.py`` has the correct BEFORE and AFTER tags and
112-
append ``-\-makeum=vnXX.Y_tZZZZ`` and/or
113-
``-\-createbc=vnXX.Y_tZZZZ`` to the above command.
96+
.. tab-set::
11497

115-
.. warning::
98+
.. tab-item:: UM
11699

117-
Please ensure that Cylc7 is used with ``update_all.py`` @vn13.5.
100+
.. code-block:: shell
118101
119-
.. note::
102+
./admin/rose-stem/update_all.py \
103+
--path=/path/to/working/copy/of/trunk \
104+
--um=vnXX.Y_tZZZZ \
105+
[--jules-path=/path/to/working/copy/of/jules/trunk]
120106
121-
The ``-\-jules-path`` option is only required if there are
122-
linked `jules-shared
123-
<https://code.metoffice.gov.uk/trac/jules/browser/main/trunk/rose-meta/jules-shared>`__
124-
metadata changes.
107+
where ``-\-um=vnXX.Y_tZZZZ`` is the ``AFTER_TAG`` of the latest
108+
upgrade macro.
125109

126-
.. tab-item:: JULES
110+
If there is a macro for fcm_make or createbc then check that the
111+
makes ``version*_*.py`` has the correct BEFORE and AFTER tags and
112+
append ``-\-makeum=vnXX.Y_tZZZZ`` and/or
113+
``-\-createbc=vnXX.Y_tZZZZ`` to the above command.
127114

128-
.. code-block:: shell
115+
.. note::
129116

130-
./bin/upgrade_jules_test_apps vnX.Y_tZZZZ
117+
The ``-\-jules-path`` option is only required if there are
118+
linked `jules-shared
119+
<https://code.metoffice.gov.uk/trac/jules/browser/main/trunk/rose-meta/jules-shared>`__
120+
metadata changes.
131121

132-
where ``vnX.Y_tZZZZ`` is the ``AFTER_TAG`` of the latest upgrade
133-
macro. The upgrade is expected to fail for the ``fab_jules``,
134-
``metadata_checker`` and ``umdp3_checker`` apps.
122+
.. tab-item:: JULES
135123

136-
.. tab-item:: LFRic Apps + Core
124+
.. code-block:: shell
137125
138-
.. code-block:: shell
126+
./bin/upgrade_jules_test_apps vnX.Y_tZZZZ
139127
140-
apply_macros.py vnX.Y_tZZZZ [--apps=/path/to/apps] \
141-
[--core=/path/to/core] [--jules=/path/to/jules]
128+
where ``vnX.Y_tZZZZ`` is the ``AFTER_TAG`` of the latest upgrade
129+
macro. The upgrade is expected to fail for the ``fab_jules``,
130+
``metadata_checker`` and ``umdp3_checker`` apps.
142131

143-
where ``vnX.Y_tZZZZ`` is the ``AFTER_TAG`` of the latest upgrade
144-
macro and the others are paths to the relevant sources. Apps
145-
defaults to the current location. Core and Jules default to
146-
reading the ``dependencies.sh`` file in the Apps source. A copy of
147-
``apply_macros.py`` is available at
148-
``$UMDIR/SimSys_Scripts/lfric_macros``.
132+
.. tab-item:: LFRic Apps + Core
149133

150-
.. tip::
134+
.. code-block:: shell
151135
152-
``module load scitools`` will give all required dependencies
153-
for Met Office users.
136+
apply_macros.py vnX.Y_tZZZZ [--apps=/path/to/apps] \
137+
[--core=/path/to/core] [--jules=/path/to/jules]
154138
155-
.. note::
139+
where ``vnX.Y_tZZZZ`` is the ``AFTER_TAG`` of the latest upgrade
140+
macro and the others are paths to the relevant sources. Apps
141+
defaults to the current location. Core and Jules default to
142+
reading the ``dependencies.yaml`` file in the Apps source. A copy of
143+
``apply_macros.py`` is available at
144+
``$UMDIR/SimSys_Scripts/lfric_macros``.
156145

157-
All LFRic Core tickets with macros are expected to be linked
158-
with LFRic Apps, though they may not have required an LFRic
159-
Apps development branch (although an Apps ticket should be
160-
provided). This is fine - if there is no LFRic Apps branch
161-
just checkout the LFRic Apps main. Then run the apply_macros
162-
script as described above and this will share the upgrade
163-
macro across both LFRic Apps and LFRic Core as needed.
146+
.. tip::
164147

165-
.. important::
148+
``module load scitools`` will give all required dependencies
149+
for Met Office users.
166150

167-
Now commit the changes made by the macros script back to the developers
168-
branch.
151+
.. note::
169152

170-
Do not push the changes at this stage.
153+
All LFRic Core tickets with macros are expected to be linked
154+
with LFRic Apps, though they may not have required an LFRic
155+
Apps development branch (although an Apps ticket should be
156+
provided). This is fine - if there is no LFRic Apps branch
157+
just checkout the LFRic Apps main. Then run the apply_macros
158+
script as described above and this will share the upgrade
159+
macro across both LFRic Apps and LFRic Core as needed.
171160

172161
.. dropdown:: New rose-stem app?
173162

@@ -214,6 +203,13 @@ rose-stem app then you will need to upgrade the test-suite.
214203
update the `table that lists them
215204
<https://code.metoffice.gov.uk/trac/um/wiki/TempUMlogicals>`__.
216205

206+
.. important::
207+
208+
Now commit the changes made by the macros script back to the developers
209+
branch.
210+
211+
Do not push the changes at this stage.
212+
217213
3. Test (if no KGO)
218214
--------------------
219215

@@ -361,8 +357,7 @@ KGO differently*
361357
is a one-time setup step required to allow you to generate KGO using the
362358
update script.
363359

364-
Edit ``~/.metomi/rose.conf`` on *all platforms* - Desktop, XCE/F, XCS and
365-
EXZ to contain the following:
360+
Edit ``~/.metomi/rose.conf`` on *all platforms* - VDI, EXAB, EXCD, EXZ
366361

367362
.. code-block::
368363
@@ -384,7 +379,7 @@ KGO differently*
384379
a script.
385380

386381
#. Run the rose stem tasks that require a KGO update, plus any other
387-
testing required (see above) - if unsure run the `all,ex1a`.
382+
testing required (see above) - if unsure run the `all` group.
388383

389384
.. code-block:: shell
390385

source/WorkingPractices/gh_dev_init.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,15 @@ To create a branch and switch to it from the command line, the syntax is,
150150

151151
.. code-block:: shell
152152
153-
# parent_branch will default to the current branch if not provided
153+
# start_point is the point to create a branch from
154+
# It can be eg. a branch, hash, tag
155+
# It will default to the current branch if not provided
154156
# switch will automatically change to the newly created branch
155-
git switch -c <branch_name> [<parent_branch>]
157+
git switch -c <branch_name> [<start_point>]
156158
157159
# Or
158160
159-
git branch <branch_name> <parent_branch>
161+
git branch <branch_name> <start_point>
160162
git switch <branch_name>
161163
162164
Developing a Change

0 commit comments

Comments
 (0)