Commit Graph

43 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov 47651ec906 Respect EOM tag for branches in unmaintained status
With the new unmaintained process [1], branches are being tagged with
EOM before being removed.

This behaviour breaks reno, making it struggle to find respective origin
and leads to releasenotes job failure.

In order to overcome the issue we add eom tag to the list of expected ones
when we can not find the refferenced branch.

With that, EOL tag will have prescedence over EOM one.

[1] https://governance.openstack.org/tc/resolutions/20230724-unmaintained-branches.html

Change-Id: Ic641af5aa65add9751b49fb47691a98f80a7c5a8
2024-02-29 11:29:56 +00:00
Zuul 81587f616f Merge "Add support for subsections" 2023-03-30 12:03:32 +00:00
Zuul 166bc6a3dc Merge "Refactor Section config to use NamedTuple" 2023-03-23 14:51:51 +00:00
Eric Arellano ee73c9409e
Add support for subsections
Subsections will appear underneath their top-level section, in
the order defined in the config file. They will use a ^ or ~
underline rather than -.

Users define subsections by adding a number to the end
of the section entry, either 2 or 3. It will be a subsection
of the parent section above it. This syntax is simpler than others
considered, like nesting lists inside a top-level section. It also
makes it easy for us to support deeper levels of nesting if we'd like.

Like normal sections, in users' notes files, they will use the
ID they define for each subsection.

Change-Id: Ib7b4781de81e19d11a7acb863204067c0946827b
Story: 2010375
2023-03-07 13:56:39 -06:00
Dr. Jens Harbott 64f649cd72 Order branches according to OpenStack release names
OpenStack has changed the naming scheme for stable branches after
reaching the end of the alphabet. In order to make sure that the new
branches like stable/2023.1 are sorted after the previous names like
stable/zed, two new variables are introduced that control the sorting
behaviour.

Change-Id: I489dd7a811ebd09c16ecb1f85a0a2e162146962a
2023-03-07 13:41:11 +00:00
Eric Arellano 919210c386 Refactor Section config to use NamedTuple
Users configure the sections as a List[List[str]]. That continues
to be the case.

But now we parse that raw list into a list of a NamedTuple
called Section. This makes our consuming code, `formatter.py`
and `linter.py` more clear because we can access the values
by name, rather than index.

But more importantly, this is a "prefactor" to add support
for nested headers. In a followup, we will add the field
'top_level: bool' so that `formatter.py` can know how to
render the section. This factoring simplifies that
change.

Change-Id: Ie80a525af61e879dd872079b2b9d0513db40e82d
2023-02-08 10:54:47 -07:00
Matthew Treinish ed6bbae82e
Handle repositories with a default branch other than master
This commit adds a new configuration option `default_branch`, which is
used to specify the default/base branch a repository is using.
Previously reno assumed the default branch was always named 'master'
which causes commands such as 'reno lint' to fail when it is run on a
repository that uses a different default branch name such as 'main'.
This config option gives users an option to specify which branch should
be used for cases like that.

Change-Id: I08f258206290fdc1dcb9fcfc078e30384667c925
2021-04-20 14:26:18 -04:00
Takashi Kajinami 7dc390e6a6 Deny creating subdirectories
Currently if we put a path separator in slug, "reno new" command
creates subdirectories under the notes subdirectory. This usually
results in the situation where the note file is put to an unexpected
place.
For example we have seen several cases with reno files placed under
releasenote/notes/releasenote/notes directory because the notes
subdirectory path is accidentally included in slug, like;

$ reno new releasenotes/notes/something-new
no configuration file in: ./releasenotes/config.yaml, ./reno.yaml
Created new notes file in releasenotes/notes/releasenotes/notes/something-new-2ff053c99583fc69.yaml

This change prohibits users from creating such subdirectries under
the notes subdirectory. The previous behavior can be restored by
the allow_subdirectories config option.

Change-Id: I30b5de3d5f35abb3b903e9ed9e4db42671421e88
2021-02-19 22:52:50 +09:00
Doug Hellmann 789ecb12d2
add `semver-next` command
Add a sub-command for computing the next release version number by
applying Semantic Versioning rules to the release notes added to a
project since the last published release.

Add configuration options to control which notes sections trigger
updates to each level of the version number.

Change-Id: I96be0c81a3947aaa0bf9080b500cf1bc77abe655
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2020-08-29 17:41:39 -04:00
Matthew Treinish 984bcba17e
Add config option to set default character encoding
This commit adds a new config option 'encoding' which when set will take
a codec string from the stdlib codec library and use it as the encoding
kwarg for all open() calls that are part of the reno commands. This will
let a project assert a specific encoding for all release note files,
which can be important if the project is using special characters and
have contributors using multiple platforms or locales.

Change-Id: If90422fa95cb4eabc4c1722104cef3b28b7fca2d
Story: #2007757
Task: #39959
2020-07-10 10:13:37 -04:00
Zuul 9410229b83 Merge "Handle empty config files" 2020-04-30 06:52:28 +00:00
Sean McGinnis 54b59a6928
Handle empty config files
Current code was assuming if a reno.yaml file was found that it could
load that file to read config options. While probably a safe assumption
in the majority of cases, someone that isn't aware of this could modify
their config file to remove settings, leaving an empty or comment-only
file that when read does not actually load any yaml that can be used.

This adds protection for that to make reno does not try to use an empty
file.

Change-Id: I0ae0bcc93a79bbf66735833b654964b494485ee1
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-27 13:29:07 -05:00
Niraj Tolia b51591b4f3 Add support for release dates
- Adds a new config option (default is false)
- Adds ability to go from a tag to a date

Change-Id: I14c566dc6b0220999dd803be5c7374c05acb4748
2020-04-20 23:09:23 -07:00
Andreas Jaeger 5264d8d889 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: I43ce218444e5a66b4589facf344b6a3a5481d12b
2020-04-07 14:22:23 +02:00
Doug Hellmann 9f866b35a1 only override config values from command line if they are actually set
If we set defaults for the query configuration options and then pass
the namespace created by parsing the command line options to the
config object it cannot tell the difference between values set on the
command line and defaults. That means we may override settings in the
configuration file with defaults from the command line parser.

This change sets all of the defaults for command line options to None
as a sentinel value and then updates the Config class to ignore
command line option values of None. It also adds tests to verify that
we get the expected override behavior with boolean and string options.

Change-Id: I1c9ce668b5e5c372d1c861bcae6e6de05a8ebc0c
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-10-10 12:55:11 -04:00
Doug Hellmann 1fa03dc495 refactor handling of missing config files for better testing
Rather than testing that we log a message, place the handling in its
own method and verify that we call that. This allows us to change the
logging in the configuration class without counting messages and
updating the test.

Change-Id: Ic3067d8ab6699ceb82db7dd64f892a757f5cc12f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-10-10 12:46:55 -04:00
Thanh Ha 9b1c353bd0
Allow tags prefixed with v in default regex
The version scheme v1.0.0 is not an uncommon way to tag versions
and used to be part of the semver spec. This patch allows the
optional v prefix in the default version scheme.

ref: https://github.com/semver/semver/blob/master/semver.md#is-v123-a-semantic-version

Change-Id: I4a99bda8b788ee5fd2a8aca3463eb548d07f1313
Signed-off-by: Thanh Ha <zxiiro@linux.com>
2018-08-27 10:12:45 -04:00
Doug Hellmann 187d586d5f add unreleased_version_title configuration option
Added configuration option ``unreleased_version_title`` with
associated Sphinx directive argument to control whether to show the
computed version number for changes that have not been tagged, or to
show a static title string specified in the option value.

Change-Id: I3069a008451e93cb62e5e43611cf62de5026952f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-04-03 17:42:00 -04:00
Doug Hellmann b9cf9a7371 support scanning closed stable branches
The scanner was stopping too soon when reviewing the history of a
branch for which the previous branch had been "closed" by deleting the
branch and tagging it with an -eol tag. This fix treats closed -eol
branches the same way as open stable branches, using new configuration
options to allow projects that use different naming conventions to
have the same benefits.

Change-Id: I8024929a2a95e00df48ce56939d54c1569fe18c5
Fixes-Bug: #1746076
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-01-29 14:53:28 -05:00
Doug Hellmann 32b5405d0e improve output messages
Change the order of initialization so the logging module is configured
before the configuration file is read. This lets us log debug messages
from the config module.

Add some information from the config module about which configuration
file is loaded, and in verbose mode which files we're looking for.

Add some information to the scanner output to show whether
collapse_pre_releases is set to true.

Change-Id: Ia78bc63e2c29de2ac8771b46397a63639012bb90
Addresses-Bug: #1743202
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-01-14 10:15:32 -05:00
Doug Hellmann 7d419d4df6 add an internal sphinx extension to show the configuration defaults
Rather than relying on contributors to add configuration data to the
usage page by hand, extract the information from the help text for the
configuration options.

Merge some of the existing documentation text with the old comments
that were turned into help text (and remove the comment markers left
behind in the last patch).

Change-Id: Ic89e6f0a083648d332ae81d20b2adbf59e4207ce
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-11-21 15:46:31 -05:00
Doug Hellmann fab39dfcc8 define options with help text
Expand the way options are defined to include help text so we can
eventually include that in generated configuration files and in online
documentation.

Change-Id: I0636f5e2fb9b21519f6cdda25a1ac546a3ffe174
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-11-21 14:46:57 -05:00
Jenkins 0864c37b73 Merge "Allow users to change prelude section name" 2017-07-05 22:08:23 +00:00
Jenkins 7ab07f1d26 Merge "Support repodir config files" 2017-07-01 07:21:17 +00:00
Rajath Agasthya 4003fc1321 Allow users to change prelude section name
Convert note template to a format string. Also include prelude
section in the report generated and update docs.

Closes-Bug: #1698203
Change-Id: I7bef68bfb518dd8554d56cb200f2844e7d395fc8
2017-06-30 17:31:23 -07:00
Stephen Finucane b2aadef726 loader: Extract cache filename from config object
The only places that this is called, we already have a
reno.config.Config instance available. Simply use that instead.

We also include a note of the 'conf.notespath' property, because the odd
behavior of this caught me out for a bit, and call 'os.path.normpath',
because the default path included redundant up-level references.

Change-Id: I58948cd8fad55d29bd30c65653630bd466259cdc
2017-06-29 11:19:01 +01:00
Stephen Finucane ecd1a171ba Support repodir config files
Not everyone wants to use build release notes separately from their main
documentation. For these users, having a 'notes' directory inside the
'releasenotes' directory is unnecessary. However, this also means we
must be able to move the config file out of the 'releasesnotes'
directory to avoid it being picked up as a release note.

Make this possible by adding support for a 'reno.yaml' file in the root
directory of the project.

Sadly it is not possible to apply this change to reno itself - doing so
would cause the files to be picked up as belonging to the current
release - but other projects can benefit from this.

Change-Id: Ie96103b85d70592dd766e5174784b992fe7782c5
2017-06-29 11:17:01 +01:00
Stephen Finucane 18df043b5a Move notesdir default to 'defaults' module
We're going to use this shortly.

Change-Id: I7382ee143c7fb19b19e52ac6c37960242fde8628
2017-06-15 14:33:18 +01:00
Doug Hellmann f957e74ff9 add option for ignoring some notes files
Make it easier to produce clean release notes by ignoring files
mistakenly edited on the wrong branch.

Change-Id: I74fb9e6c74af0b9de8cfe0d9c07ecfbd09cae925
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-13 13:42:07 -04:00
Doug Hellmann bd6fecc858 ignore null-merges
OpenStack used to use null-merges to bring final release tags from
stable branches back into the master branch. This confuses the regular
traversal because it makes that stable branch appear to be part of
master and/or the later stable branch. Update the scanner so that when
it hit one of those merge commits, it skips it and take the first parent
so it continues to traverse the branch being scanned.

Change-Id: I90722a3946f691e8f58a52e68ee455d6530f047a
Closes-Bug: #1695057
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-02 10:18:04 -04:00
Adam Spiers ce925cca93 clarify automatic inclusion of prelude section
As suggested in the previous review:

  https://review.openstack.org/#/c/436639/2/reno/config.py@146

it is worth clarifying that the prelude section will always be included.

Change-Id: Iaae88434e02df5c7eb38a639c3dcb0ead6464c6c
2017-02-23 18:29:37 -05:00
Adam Spiers 081a4145e1 make sections configurable
The list of section identifiers and corresponding display names, and the
order in which they are rendered, was hard-coded.  Some projects want to
customise this, so move it into the Config object so that it can now be
specified via config.yaml, e.g.

    sections:
      - [features, New Features]
      - [issues, Known Issues]
      - [upgrade, Upgrade Notes]
      - [api, API Changes]
      - [security, Security Issues]
      - [fixes, Bug Fixes]

Change-Id: I914572c6a07ca81c54965b4b5a6b6aba50b3a787
2017-02-23 15:04:22 -05:00
Doug Hellmann 1db83bde73 fix logic for deciding when to stop scanning a branch
When scanning a given branch, we don't want to stop at the base of the
current branch, we want to stop at the base of the *previous* branch on
master. That pulls in the full history of the current branch from where
the older branch diverged.

Given this history:

  (master)
     |
   1.0.0
     | \  (stable/a)
     |  \
     |   1.0.1
   2.0.0
     |
   2.0.1
     | \ (stable/b)
     |  \
     |   2.0.2
   2.1.0

The notes for stable/b branch should include versions 2.0.2, 2.0.1, and
2.0.0 (which is on master) but not 1.0.0 which is the previous release.

Change-Id: If1feddadc1a8e24b163667cd84f5b9e098951c69
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-02-01 13:10:30 -05:00
git-harry 5003ea2c91 Add support for custom tag version schemes
This change adds the ability to specify regular expressions to define a
customised versioning scheme for release tags and pre-release tags.

By default this change supports the current versioning scheme used by
OpenStack.

To customise, update the config.yaml file with the appropriate values.
For example, for tags with versions like 'v1.0.0' and pre-release
versions like 'v1.0.0rc1' the following could be added to config.yaml:

release_tag_re: 'v\d\.\d\.\d(rc\d+)?'
pre_release_tag_re: '(?P<pre_release>rc\d+$)'

Change-Id: I7539fdeada14a73ae4e18a125bb0e3947f08e8d1
2017-01-05 18:22:29 +00:00
Doug Hellmann 8756c1dd2a tone down the warning for missing configuration file
The warning logged when we can't load a configuration file looks like an
error because it has "Errno" in it. It's not really an error, though, so
log a more gentle message saying that the configuration file does not
exist where we expect to find it.

Change-Id: I30698162615b494f4ed2d23f119309e9fcdf3edd
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-12-22 13:49:06 -05:00
Cedric Brandily 4964ab786d Support to set a custom template used to create new notes
Currently the template used to create new notes is hardcoded in reno
source code. It's fine when reno is used inside OpenStack community but
external projects would perhaps like to use a custom template in order
to better match their needs.

This change supports to set through "template" attribute in config.yaml
a custom template which will be used by reno new to create new notes.

Change-Id: I83a870eb9906c26e5ee946d53b9c154867180971
2016-11-11 16:16:36 +01:00
Doug Hellmann 7ee2a78a8a add configuration option to not stop at branch base
The previous commit changes the default behavior to always stop scanning
at the base of a branch. This change adds a configuration option to
allow that behavior to be disabled, so that revisions along the history
of the branch prior to the point where it diverged from master can be
included. The new default behavior established in the previous commit is
not changed.

Change-Id: I2c4968e1291c1b7d268896cfbb79e320d4085bce
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-10-13 18:55:40 +00:00
Doug Hellmann 7f7d4a3267 set relnotesdir to default inside config
Rather than using a default value in the function signature, look for
None and set the default. This allows callers to not have to look for an
option to be defined to decide when to pass relnotesdir or not.

Change-Id: I8535db2f35fa69faa009b4d368b21e25735016ee
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-08-03 18:04:08 -04:00
Doug Hellmann c022901e2e use Config instead of individual args with parameters
Instead of passing an increasing number of arguments around through the
system, set up the Config instance correctly and use it.

Also make the reporoot a required argument for Config, and let the
release note subdirectory be an optional argument with a default.

Change-Id: I5fc6358bb496f44e3fd68c89ad71b06067dd7425
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-07-22 18:45:05 -04:00
Doug Hellmann 0355be32b4 let the Config object give us the path to the notes
Add a property to combine the release notes subdirectory and the notes
directory within it to build the path to look for notes files. Remove
the old utils function for doing the same work.

Change-Id: I7f6aa8c7e59f6e4559a583cad4b9bc5b574c77e0
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-07-22 18:30:37 -04:00
Doug Hellmann d32fda8b34 let the Config class clean up the reporoot we're given
Instead of repeating the cleanup logic in all of the commands, let the
Config class do it in one place.

Change-Id: I3d3d4484b2656b54650e196e058c26c4c3dcdeb6
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-07-22 17:56:31 -04:00
Doug Hellmann 82c8025e2e define Config class
Define a class to hold all of the configuration settings, with methods
to read a configuration file and to change the option values based on
command line arguments.

Change-Id: I70b3ebdb5f5c3cc6a9386ae947aaeeb912bae39c
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-07-22 17:56:30 -04:00
Ian Cordasco 750bdc021b Add YAML configuration parsing
While discussing I7539fdeada14a73ae4e18a125bb0e3947f08e8d1 Doug and
Harry realized that it would be much better if some of these values
could be specified in a config file, whether INI or YAML.

This adds a simple function to allow options to be specified in the
config file named "config.yml" in the --rel-notes-dir.

Change-Id: Ie25e1eb3da66cc627d93af585b0893469d6a7b2e
2016-07-22 17:56:30 -04:00