From 89c6dc770fb606e00ff0f98d5bea872fc3153263 Mon Sep 17 00:00:00 2001 From: George McCabe <23407799+georgemccabe@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:21:58 -0700 Subject: [PATCH] Feature #2562 version lookup documentation and automated tests (#2773) * set default input version to the latest official release, which is the 2nd highest coordinated release version number in the version lookup table. This assumes that the highest version is what is being developed towards * per #2562, update Release Guide to include instructions for updating the component versions lookup table in the METplus repository * Per #2562 and #2597, replace automated test logic that used manage_externals to use component version lookup to get versions of METplotpy/METcalcpy/METdataio * clean up SonarQube complaints * turn on some use cases to test changes * fix clone * do not get python dependencies for METplotpy/METcalcpy/METdataio installs * use full path to package to import * clone METplus Analysis repos on the same level as METplus to match previous location using manage_externals, remove manage_externals config files that are no longer used by the automated tests * clean up linter complaints * turn off use cases after confirming that they run successfully * clean up usage statement formatting * remove info about updating manage_externals config files used in automated tests that have been removed * added description of component versions script to Contributor's Guide and added stubs for other utility descriptions * change format of example results and add text to describe what is being demonstrated from each example * fix formatting * fixed bad variable replacement * Update docs/Contributors_Guide/utilities.rst --------- Co-authored-by: Julie Prestopnik --- .github/jobs/get_use_case_commands.py | 166 +++++++------ .github/parm/Externals_metdataio.cfg | 9 - .github/parm/Externals_metdataio_stable.cfg | 9 - .github/parm/Externals_metplotcalcpy.cfg | 16 -- .../parm/Externals_metplotcalcpy_stable.cfg | 16 -- .github/parm/use_case_groups.json | 2 +- docs/Contributors_Guide/index.rst | 1 + docs/Contributors_Guide/utilities.rst | 222 ++++++++++++++++++ docs/Release_Guide/met_bugfix.rst | 1 + docs/Release_Guide/metcalcpy_bugfix.rst | 1 + docs/Release_Guide/metdataio_bugfix.rst | 1 + docs/Release_Guide/metexpress_official.rst | 1 + docs/Release_Guide/metplotpy_bugfix.rst | 1 + docs/Release_Guide/metplus_bugfix.rst | 1 + docs/Release_Guide/metplus_official.rst | 1 + docs/Release_Guide/metviewer_bugfix.rst | 1 + .../metplus/add_next_version_to_lookup.rst | 38 +++ .../metplus/update_manage_externals.rst | 15 -- .../release_steps/update_version_lookup.rst | 46 ++++ metplus/component_versions.py | 17 +- 20 files changed, 417 insertions(+), 148 deletions(-) delete mode 100644 .github/parm/Externals_metdataio.cfg delete mode 100644 .github/parm/Externals_metdataio_stable.cfg delete mode 100644 .github/parm/Externals_metplotcalcpy.cfg delete mode 100644 .github/parm/Externals_metplotcalcpy_stable.cfg create mode 100644 docs/Contributors_Guide/utilities.rst create mode 100644 docs/Release_Guide/release_steps/metplus/add_next_version_to_lookup.rst create mode 100644 docs/Release_Guide/release_steps/update_version_lookup.rst diff --git a/.github/jobs/get_use_case_commands.py b/.github/jobs/get_use_case_commands.py index 7212019889..1c69828aa4 100755 --- a/.github/jobs/get_use_case_commands.py +++ b/.github/jobs/get_use_case_commands.py @@ -17,6 +17,7 @@ from metplus.util.string_manip import expand_int_string_to_list from docker_utils import VERSION_EXT from metplus import get_metplus_version +from metplus.component_versions import get_component_version # path to METplus install location in Docker METPLUS_DOCKER_LOC = '/metplus/METplus' @@ -39,7 +40,7 @@ ] -def handle_automation_env(host_name, reqs, work_dir): +def handle_automation_env(host_name, reqs): # if no env is specified, use metplus base environment conda_env = METPLUS_BASE_ENV @@ -60,8 +61,9 @@ def handle_automation_env(host_name, reqs, work_dir): conda_env_w_ext = f'{conda_env}{VERSION_EXT}' # start building commands to run before run_metplus.py in Docker - setup_env = [] - setup_env.append(_add_to_bashrc('# BELOW WAS ADDED BY TEST SCRIPT')) + setup_env = [ + _add_to_bashrc('# BELOW WAS ADDED BY TEST SCRIPT') + ] # add conda bin to beginning of PATH python_dir = os.path.join('/usr', 'local', 'conda', 'envs', @@ -76,35 +78,34 @@ def handle_automation_env(host_name, reqs, work_dir): else: py_embed_arg = '' - # get METplus version to determine Externals file to use - # to get METplotpy/METcalcpy/METdataio + # get METplus version to determine which version of + # METplotpy/METcalcpy/METdataio to use # If stable release, get main branch, otherwise get develop - is_stable_release = len(get_metplus_version().split('-')) == 1 - externals_ext = '_stable.cfg' if is_stable_release else '.cfg' + metplus_version = get_metplus_version() # if any metplotpy/metcalcpy keywords are in requirements list, # add command to obtain and install METplotpy and METcalcpy + components = [] if any([item for item in PLOTCALC_KEYWORDS if item in str(reqs).lower()]): - ce_file = os.path.join(work_dir, '.github', 'parm', - f'Externals_metplotcalcpy{externals_ext}') - setup_env.extend(( - f'cd {METPLUS_DOCKER_LOC}', - f'{work_dir}/manage_externals/checkout_externals -e {ce_file}', - f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METplotpy', - f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METcalcpy', - 'cd -', - )) + components.extend(('METplotpy', 'METcalcpy')) # if metdataio is in requirements list, add command to obtain METdataio if 'metdataio' in str(reqs).lower(): - ce_file = os.path.join(work_dir, '.github', 'parm', - f'Externals_metdataio{externals_ext}') + components.append('METdataio') + + setup_env.append(f'cd {METPLUS_DOCKER_LOC}/..') + for component in components: + version = get_component_version(input_component='METplus', + input_version=metplus_version, + output_component=component, + output_format='main_v{X}.{Y}', + get_dev=False) setup_env.extend(( - f'cd {METPLUS_DOCKER_LOC}', - f'{work_dir}/manage_externals/checkout_externals -e {ce_file}', - f'{python_path} -m pip install {METPLUS_DOCKER_LOC}/../METdataio', - 'cd -', + 'git --version', + f'git clone --single-branch --branch {version} https://github.com/dtcenter/{component}', + f'{python_path} -m pip install --no-deps {METPLUS_DOCKER_LOC}/../{component}', )) + setup_env.append('cd -') # if metplus is in requirements list, # add top of METplus repo to PYTHONPATH so metplus can be imported @@ -118,7 +119,7 @@ def handle_automation_env(host_name, reqs, work_dir): setup_env.extend(( f'echo Using environment: dtcenter/metplus-envs:{conda_env_w_ext}', f'echo cat /usr/local/conda/envs/{conda_env_w_ext}/environments.yml', - f'echo ----------------------------------------', + 'echo ----------------------------------------', f'cat /usr/local/conda/envs/{conda_env_w_ext}/environments.yml', 'echo ----------------------------------------', )) @@ -140,6 +141,24 @@ def main(categories, subset_list, work_dir=None, test_suite = METplusUseCaseSuite() test_suite.add_use_case_groups(categories, subset_list) + for group_name, use_cases_by_req in test_suite.category_groups.items(): + for use_case_by_requirement in use_cases_by_req: + reqs = use_case_by_requirement.requirements + + setup_env, py_embed_arg = handle_automation_env(host_name, reqs) + + use_case_cmds = _get_use_case_cmds(host_name, use_case_by_requirement, work_dir, group_name, py_embed_arg) + + # add commands to set up environment before use case commands + all_commands.append((setup_env, use_case_cmds, reqs)) + + return all_commands + + +def _get_use_case_cmds(host_name, use_case_by_requirement, work_dir, group_name, py_embed_arg): + # use status variable to track if any use cases failed + use_case_cmds = [] + output_top_dir = os.environ.get('METPLUS_TEST_OUTPUT_BASE', '/data/output') # use METPLUS_TEST_SETTINGS_CONF if set @@ -150,58 +169,53 @@ def main(categories, subset_list, work_dir=None, 'parm', 'test_settings.conf') - for group_name, use_cases_by_req in test_suite.category_groups.items(): - for use_case_by_requirement in use_cases_by_req: - reqs = use_case_by_requirement.requirements + if host_name != 'docker': + use_case_cmds.append('status=0') + for use_case in use_case_by_requirement.use_cases: + # add parm/use_cases path to config args if they are conf files + config_args = _get_config_args(use_case.config_args, work_dir, host_name) + + output_base = os.path.join(output_top_dir, + group_name.split('-')[0], + use_case.name) + use_case_cmd = (f"run_metplus.py" + f" {' '.join(config_args)}" + f" {py_embed_arg}{test_settings_conf}" + f" config.OUTPUT_BASE={output_base}") + use_case_cmds.append(use_case_cmd) + # check exit code from use case command and + # set status to non-zero value on error + if host_name != 'docker': + use_case_cmds.append("if [ $? != 0 ]; then status=1; fi") + + # if any use cases failed, force non-zero exit code with false + if host_name != 'docker': + use_case_cmds.append("if [ $status != 0 ]; then false; fi") - setup_env, py_embed_arg = handle_automation_env(host_name, reqs, - work_dir) - - # use status variable to track if any use cases failed - use_case_cmds = [] - if host_name != 'docker': - use_case_cmds.append('status=0') - for use_case in use_case_by_requirement.use_cases: - # add parm/use_cases path to config args if they are conf files - config_args = [] - ci_overrides = None - for config_arg in use_case.config_args: - if config_arg.endswith('.conf'): - config_arg = os.path.join(work_dir, 'parm', - 'use_cases', config_arg) - - # look for CI overrides conf file - override_path = os.path.join(config_arg[0:-5], - 'ci_overrides.conf') - if os.path.exists(override_path): - ci_overrides = override_path - - config_args.append(config_arg) - - # add CI overrides config file if running in docker - if ci_overrides and host_name == 'docker': - config_args.append(ci_overrides) - - output_base = os.path.join(output_top_dir, - group_name.split('-')[0], - use_case.name) - use_case_cmd = (f"run_metplus.py" - f" {' '.join(config_args)}" - f" {py_embed_arg}{test_settings_conf}" - f" config.OUTPUT_BASE={output_base}") - use_case_cmds.append(use_case_cmd) - # check exit code from use case command and - # set status to non-zero value on error - if host_name != 'docker': - use_case_cmds.append("if [ $? != 0 ]; then status=1; fi") - - # if any use cases failed, force non-zero exit code with false - if host_name != 'docker': - use_case_cmds.append("if [ $status != 0 ]; then false; fi") - # add commands to set up environment before use case commands - all_commands.append((setup_env, use_case_cmds, reqs)) + return use_case_cmds - return all_commands + +def _get_config_args(input_config_args, work_dir, host_name): + config_args = [] + ci_overrides = None + for config_arg in input_config_args: + if config_arg.endswith('.conf'): + config_arg = os.path.join(work_dir, 'parm', + 'use_cases', config_arg) + + # look for CI overrides conf file + override_path = os.path.join(config_arg[0:-5], + 'ci_overrides.conf') + if os.path.exists(override_path): + ci_overrides = override_path + + config_args.append(config_arg) + + # add CI overrides config file if running in docker + if ci_overrides and host_name == 'docker': + config_args.append(ci_overrides) + + return config_args def handle_command_line_args(): @@ -232,9 +246,9 @@ def handle_command_line_args(): if __name__ == '__main__': - categories, subset_list, _ = handle_command_line_args() - all_commands = main(categories, subset_list) - for setup_commands, use_case_commands, requirements in all_commands: + input_categories, input_subset_list, _ = handle_command_line_args() + commands = main(input_categories, input_subset_list) + for setup_commands, use_case_commands, requirements in commands: print(f"REQUIREMENTS: {','.join(requirements)}") if setup_commands: command_format = ';\\\n'.join(setup_commands.split(';')) diff --git a/.github/parm/Externals_metdataio.cfg b/.github/parm/Externals_metdataio.cfg deleted file mode 100644 index b7f7544f81..0000000000 --- a/.github/parm/Externals_metdataio.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[METdataio] -local_path = ../METdataio -protocol = git -required = True -repo_url = https://github.com/dtcenter/METdataio -branch = develop - -[externals_description] -schema_version = 1.0.0 diff --git a/.github/parm/Externals_metdataio_stable.cfg b/.github/parm/Externals_metdataio_stable.cfg deleted file mode 100644 index af45402334..0000000000 --- a/.github/parm/Externals_metdataio_stable.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[METdataio] -local_path = ../METdataio -protocol = git -required = True -repo_url = https://github.com/dtcenter/METdataio -branch = main_v2.1 - -[externals_description] -schema_version = 1.0.0 diff --git a/.github/parm/Externals_metplotcalcpy.cfg b/.github/parm/Externals_metplotcalcpy.cfg deleted file mode 100644 index fdf1383555..0000000000 --- a/.github/parm/Externals_metplotcalcpy.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[METcalcpy] -local_path = ../METcalcpy -protocol = git -required = True -repo_url = https://github.com/dtcenter/METcalcpy -branch = develop - -[METplotpy] -local_path = ../METplotpy -protocol = git -required = True -repo_url = https://github.com/dtcenter/METplotpy -branch = develop - -[externals_description] -schema_version = 1.0.0 diff --git a/.github/parm/Externals_metplotcalcpy_stable.cfg b/.github/parm/Externals_metplotcalcpy_stable.cfg deleted file mode 100644 index 5aed1cb69b..0000000000 --- a/.github/parm/Externals_metplotcalcpy_stable.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[METcalcpy] -local_path = ../METcalcpy -protocol = git -required = True -repo_url = https://github.com/dtcenter/METcalcpy -branch = main_v2.1 - -[METplotpy] -local_path = ../METplotpy -protocol = git -required = True -repo_url = https://github.com/dtcenter/METplotpy -branch = main_v2.1 - -[externals_description] -schema_version = 1.0.0 diff --git a/.github/parm/use_case_groups.json b/.github/parm/use_case_groups.json index 8d12b81db2..31f9bc4aad 100644 --- a/.github/parm/use_case_groups.json +++ b/.github/parm/use_case_groups.json @@ -112,7 +112,7 @@ }, { "category": "medium_range", - "index_list": "3-5,10", + "index_list": "3-5,10", "run": false }, { diff --git a/docs/Contributors_Guide/index.rst b/docs/Contributors_Guide/index.rst index 2dabc2a162..fb321c1f78 100644 --- a/docs/Contributors_Guide/index.rst +++ b/docs/Contributors_Guide/index.rst @@ -7,6 +7,7 @@ Contributor's Guide :numbered: coding_standards + utilities basic_components create_wrapper conda_env diff --git a/docs/Contributors_Guide/utilities.rst b/docs/Contributors_Guide/utilities.rst new file mode 100644 index 0000000000..9d576142a7 --- /dev/null +++ b/docs/Contributors_Guide/utilities.rst @@ -0,0 +1,222 @@ +.. _cg_util: + +********* +Utilities +********* + +.. _cg_util_version: + +Component Versions Script +========================= + +**metplus/component_versions.py** + +This script is used to query a METplus coordinated release component version +number lookup table to determine a corresponding version number for another +METplus component. + +This script can be called directly from a script or the command line. +It returns the version of the requested (output) METplus component. +This functionality can also be imported in a Python script. +See below for examples. + +Usage Statement +--------------- +:: + + usage: component_versions.py [-h] [-i INPUT_COMPONENT] [-v INPUT_VERSION] -o + OUTPUT_COMPONENT [-f OUTPUT_FORMAT] + [--get_dev_version | --no-get_dev_version] + + options: + -h, --help show this help message and exit + -i INPUT_COMPONENT, --input_component INPUT_COMPONENT + Name of METplus component to use to find version. Default + is METplus. + -v INPUT_VERSION, --input_version INPUT_VERSION + version of input_component to search. Default is latest + official release + -o OUTPUT_COMPONENT, --output_component OUTPUT_COMPONENT + name of METplus component to obtain version + -f OUTPUT_FORMAT, --output_format OUTPUT_FORMAT + format to use to output version number.{X}, {Y}, and {Z} + will be replaced with x, y, and z version numbers from + X.Y.Z. {N} will be replaced with development version if + found in the input version, e.g. "-beta3" or "-rc1" + Default is v{X}.{Y}.{Z}{N} + --get_dev_version, --no-get_dev_version + If True, get corresponding -beta or -rc version. If + False, return develop if development version. (default: + True) + +Examples +-------- + +These examples do not include the full path to the script. + +Get MET vX.Y.Z version from METplus release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + $ component_versions.py -v 5.1.0 -o MET + v11.1.1 + +If the input component is not specified, it will use the METplus version. +The default output format is v{X}.{Y}.{Z}{N}. + +Get MET vX.Y.Z version from coordinated release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + $ component_versions.py -v 5.1 -o MET + v11.1.1 + +The coordinated release version matches the METplus X.Y version, +so the coordinated release version can also be used as the input version. + +Get MET vX.Y.Z development version from beta release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + $ component_versions.py -v 6.0.0-beta3 -o MET + v12.0.0-beta3 + +If a beta release version is provided as the input, the output will include +the same beta version. + +Get MET vX.Y.Z development version from -dev version +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + $ component_versions.py -v 6.0.0-beta3-dev -o MET + develop + +If the input version includes -dev, the result will always be *develop*. + +Get MET vX.Y.Z development version from beta version +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + $ component_versions.py -v 6.0.0-beta3 -o MET --no-get_dev_version + develop + +If the *--no-get_dev_version* argument is provided, +an input version that includes -betaN or -rcN will return *develop*. + +Get MET main_vX.Y version from METplus release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + $ component_versions.py -v 5.1.0 -o MET -f main_v{X}.{Y} + main_v11.1 + +The output format can be specified using the *-f* argument. +{X}, {Y}, {Z}, and {N} will be substituted with values based on the input. + +Get METplotpy main_vX.Y version from METviewer release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + $ component_versions.py -i METviewer -v 5.1.0 -o METplotpy -f main_v{X}.{Y} + main_v2.1 + +The *-i* argument can be used to specify the input component that corresponds +to the input version number. + +Get METplotpy main_vX.Y version from METviewer main_vX.Y branch +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + $ component_versions.py -i METviewer -v main_v5.1 -o METplotpy -f main_v{X}.{Y} + main_v2.1 + +The input version number can be provided in different formats, +including **main_vX.Y** and **vX.Y.Z**. + +Using Python Function +^^^^^^^^^^^^^^^^^^^^^ +:: + + >>> from metplus.component_versions import get_component_version + >>> version = get_component_version(input_component='METplus', + input_version='6.0.0', + output_component='MET', + output_format='main_v{X}.{Y}', + get_dev=False) + >>> print(version) + main_v12.0 + + +METplus Utils +============= + +These files are found under **metplus/util**. + +Utility scripts used by the METplus Wrappers. + +**MORE INFO COMING SOON** + +config_metplus.py +----------------- + +config_util.py +-------------- + +config_validate.py +------------------ + +constants.py +------------ + +diff_util.py +------------ + +field_util.py +------------- + +met_config.py +------------- + +metplus_check.py +---------------- + +run_util.py +----------- + +string_manip.py +--------------- + +string_template_substitution.py +------------------------------- + +system_util.py +-------------- + +time_looping.py +--------------- + +time_util.py +------------ + +wrapper_init.py +--------------- + +Internal Development Tools +========================== + +These utilities scripts can be found in **internal/scripts/dev_tools**. +They were written to assist with common development tasks. + +Add MET Config Helper +--------------------- + +**internal/scripts/dev_tools/add_met_config_helper.py** + +**MORE INFO COMING SOON** + +Generate Release Notes +---------------------- + +**internal/scripts/dev_tools/generate_release_notes.py** + +**MORE INFO COMING SOON** diff --git a/docs/Release_Guide/met_bugfix.rst b/docs/Release_Guide/met_bugfix.rst index 6861bc8b76..d70e91427e 100644 --- a/docs/Release_Guide/met_bugfix.rst +++ b/docs/Release_Guide/met_bugfix.rst @@ -15,4 +15,5 @@ Create a new vX.Y.Z bugfix release from the main_vX.Y branch. .. include:: release_steps/create_release_on_github.rst .. include:: release_steps/create_release_extra.rst .. include:: release_steps/met/update_dtc_website.rst +.. include:: release_steps/update_version_lookup.rst .. include:: release_steps/finalize_release_on_github_bugfix.rst diff --git a/docs/Release_Guide/metcalcpy_bugfix.rst b/docs/Release_Guide/metcalcpy_bugfix.rst index b224fdb209..62d6ade67e 100644 --- a/docs/Release_Guide/metcalcpy_bugfix.rst +++ b/docs/Release_Guide/metcalcpy_bugfix.rst @@ -15,4 +15,5 @@ Create a new vX.Y.Z bugfix release from the main_vX.Y branch. .. include:: release_steps/create_release_on_github.rst .. include:: release_steps/create_release_extra.rst .. include:: release_steps/update_dtc_website.rst +.. include:: release_steps/update_version_lookup.rst .. include:: release_steps/finalize_release_on_github_official.rst diff --git a/docs/Release_Guide/metdataio_bugfix.rst b/docs/Release_Guide/metdataio_bugfix.rst index 096e9c260a..992e44b48f 100644 --- a/docs/Release_Guide/metdataio_bugfix.rst +++ b/docs/Release_Guide/metdataio_bugfix.rst @@ -18,4 +18,5 @@ Create a new vX.Y.Z bugfix release from the main_vX.Y branch. .. include:: release_steps/create_release_on_github.rst .. include:: release_steps/create_release_extra.rst .. include:: release_steps/common/update_dtc_website.rst +.. include:: release_steps/update_version_lookup.rst .. include:: release_steps/finalize_release_on_github_bugfix.rst diff --git a/docs/Release_Guide/metexpress_official.rst b/docs/Release_Guide/metexpress_official.rst index 256c143a68..20cfcc1520 100644 --- a/docs/Release_Guide/metexpress_official.rst +++ b/docs/Release_Guide/metexpress_official.rst @@ -18,5 +18,6 @@ Create a new vX.Y.Z official release from the develop branch. .. include:: release_steps/metexpress/pull_changes_and_merge_to_dev.rst .. include:: release_steps/update_docs_official.rst .. include:: release_steps/metexpress/update_dtc_website.rst +.. include:: release_steps/update_version_lookup.rst .. include:: release_steps/metexpress/announce_release.rst .. include:: release_steps/set_beta_deletion_reminder_official.rst diff --git a/docs/Release_Guide/metplotpy_bugfix.rst b/docs/Release_Guide/metplotpy_bugfix.rst index ec177ee9b9..f9609dcdec 100644 --- a/docs/Release_Guide/metplotpy_bugfix.rst +++ b/docs/Release_Guide/metplotpy_bugfix.rst @@ -14,5 +14,6 @@ Create a new vX.Y.Z bugfix release from the main_vX.Y branch. .. include:: release_steps/create_release_on_github.rst .. include:: release_steps/create_release_extra.rst .. include:: release_steps/update_dtc_website.rst +.. include:: release_steps/update_version_lookup.rst .. include:: release_steps/finalize_release_on_github_official.rst diff --git a/docs/Release_Guide/metplus_bugfix.rst b/docs/Release_Guide/metplus_bugfix.rst index f4635dae4c..ecc08da001 100644 --- a/docs/Release_Guide/metplus_bugfix.rst +++ b/docs/Release_Guide/metplus_bugfix.rst @@ -15,4 +15,5 @@ Create a new vX.Y.Z bugfix release from the main_vX.Y branch. .. include:: release_steps/create_release_on_github.rst .. include:: release_steps/metplus/create_release_extra.rst .. include:: release_steps/metplus/update_dtc_website.rst +.. include:: release_steps/update_version_lookup.rst .. include:: release_steps/finalize_release_on_github_official.rst diff --git a/docs/Release_Guide/metplus_official.rst b/docs/Release_Guide/metplus_official.rst index 5d4b02a952..8c2a210e16 100644 --- a/docs/Release_Guide/metplus_official.rst +++ b/docs/Release_Guide/metplus_official.rst @@ -21,5 +21,6 @@ Create a new vX.Y.Z official release from the develop branch. .. include:: release_steps/metplus/update_dtc_website.rst .. include:: release_steps/finalize_release_on_github_official.rst .. include:: release_steps/update_docs_official.rst +.. include:: release_steps/metplus/add_next_version_to_lookup.rst .. include:: release_steps/metplus/update_web_server_data.rst .. include:: release_steps/set_beta_deletion_reminder_official.rst diff --git a/docs/Release_Guide/metviewer_bugfix.rst b/docs/Release_Guide/metviewer_bugfix.rst index e8f5a35c1d..39a1705a00 100644 --- a/docs/Release_Guide/metviewer_bugfix.rst +++ b/docs/Release_Guide/metviewer_bugfix.rst @@ -15,4 +15,5 @@ Create a new vX.Y.Z bugfix release from the main_vX.Y branch. .. include:: release_steps/create_release_on_github.rst .. include:: release_steps/create_release_extra.rst .. include:: release_steps/update_dtc_website.rst +.. include:: release_steps/update_version_lookup.rst .. include:: release_steps/finalize_release_on_github_official.rst diff --git a/docs/Release_Guide/release_steps/metplus/add_next_version_to_lookup.rst b/docs/Release_Guide/release_steps/metplus/add_next_version_to_lookup.rst new file mode 100644 index 0000000000..006d56c45d --- /dev/null +++ b/docs/Release_Guide/release_steps/metplus/add_next_version_to_lookup.rst @@ -0,0 +1,38 @@ +Add Next Version to Lookup Table +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In the develop branch, modify the **metplus/component_versions.py** file to +add an entry for the next coordinated release. + +If the X.0 release was just created, add an entry for the X.1 release. + +If the X.1 release was just created, add an entry for the X+1.0 release. + +Set the appropriate X.Y.0 versions for each component. +Maybe sure to set the Z number to 0. + +Set the version for metexpress to None (not a string). + +For example, if the coordinated 6.0 release was just created, add:: + + '6.1': { + 'metplus': '6.1.0', + 'met': '12.1.0', + 'metplotpy': '3.1.0', + 'metcalcpy': '3.1.0', + 'metdataio': '3.1.0', + 'metviewer': '6.1.0', + 'metexpress': None, + }, + +For example, if the coordinated 6.1 release was just created, add:: + + '7.0': { + 'metplus': '7.0.0', + 'met': '13.0.0', + 'metplotpy': '4.0.0', + 'metcalcpy': '4.0.0', + 'metdataio': '4.0.0', + 'metviewer': '7.0.0', + 'metexpress': None, + }, diff --git a/docs/Release_Guide/release_steps/metplus/update_manage_externals.rst b/docs/Release_Guide/release_steps/metplus/update_manage_externals.rst index adc564a516..d063602d37 100644 --- a/docs/Release_Guide/release_steps/metplus/update_manage_externals.rst +++ b/docs/Release_Guide/release_steps/metplus/update_manage_externals.rst @@ -43,18 +43,3 @@ Update build_components/Externals_stable.cfg Ensure the *tag* for each component is correct. It should match the format **vX.Y.Z** where X.Y.Z is the version of that component. For example, MET should be **v11.0.0** for METplus 5.0.0. - - -Update .github/parm/Externals_metdataio_stable.cfg -"""""""""""""""""""""""""""""""""""""""""""""""""" - -Ensure the *branch* value is correct. It should match the format -**main_vX.Y** where X.Y is the version of that component. -For example, METdataio should be **main_v2.0** for METplus 5.0.0. - -Update .github/parm/Externals_metplotcalcpy_stable.cfg -"""""""""""""""""""""""""""""""""""""""""""""""""""""" - -Ensure the *branch* for each component is correct. It should match the format -**main_vX.Y** where X.Y is the version of that component. -For example, METplotpy and METcalcpy should be **main_v2.0** for METplus 5.0.0. diff --git a/docs/Release_Guide/release_steps/update_version_lookup.rst b/docs/Release_Guide/release_steps/update_version_lookup.rst new file mode 100644 index 0000000000..d465b1ee2a --- /dev/null +++ b/docs/Release_Guide/release_steps/update_version_lookup.rst @@ -0,0 +1,46 @@ +Update Version Lookup Table +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Modify the version lookup table in the METplus repository to include the +correct version. + +.. dropdown:: Instructions + + * Clone the METplus repository. + + Using SSH: + + .. parsed-literal:: + + git clone git@github.com:dtcenter/METplus + + Using HTTP: + + .. parsed-literal:: + + git clone https://github.com/dtcenter/METplus + + * Enter the METplus repository directory: + + .. parsed-literal:: + + cd METplus + + * Checkout the develop branch + + .. parsed-literal:: + + git checkout develop + + * Create a branch off of develop to update. + Include the name of the repository and version in the name. + + .. parsed-literal:: + + git checkout -b update_version_vX.Y.Z_repo + + * Open **metplus/component_versions.py** and increment the version for the + appropriate |projectRepo| entry. + + * Commit change, push to GitHub, and create a pull request to merge change + into the **develop** branch. diff --git a/metplus/component_versions.py b/metplus/component_versions.py index 518bcc88f0..be8d2c406f 100755 --- a/metplus/component_versions.py +++ b/metplus/component_versions.py @@ -34,6 +34,10 @@ }, } +# assumes the 2nd highest version in the table is the latest +# the highest version in the table is in development +LATEST_OFFICIAL_RELEASE = sorted(VERSION_LOOKUP.keys(), reverse=True)[1] + DEFAULT_OUTPUT_FORMAT = "v{X}.{Y}.{Z}{N}" def get_component_version(input_component, input_version, output_component, @@ -96,12 +100,12 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--input_component', default='metplus', - help='Name of METplus component to use to find version,' - ' default is METplus.') + help='Name of METplus component to use to find version.' + ' Default is METplus.') parser.add_argument('-v', '--input_version', - default=next(iter(VERSION_LOOKUP)), - help='version of input_component to search,' - ' default is upcoming version') + default=LATEST_OFFICIAL_RELEASE, + help='version of input_component to search.' + ' Default is latest official release') parser.add_argument('-o', '--output_component', required=True, help='name of METplus component to obtain version') parser.add_argument('-f', '--output_format', @@ -110,7 +114,8 @@ def main(): '{X}, {Y}, and {Z} will be replaced with x, y, and' ' z version numbers from X.Y.Z. {N} will be ' 'replaced with development version if found in the' - 'input version, e.g. "-beta3" or "-rc1"') + ' input version, e.g. "-beta3" or "-rc1".' + ' Default is v{X}.{Y}.{Z}{N}') parser.add_argument('--get_dev_version', action=argparse.BooleanOptionalAction, default=True, help='If True, get corresponding -beta or -rc version. '