Skip to content

Conversation

@pugnascotia
Copy link
Contributor

The changelog generation process currently relies on version information being present in the changelog YAML descriptors. However, this makes them difficult to update in some scenarios. For example, if a PR is merged and subsequently labelled for backporting, our automation won't update the versions in the changelog YAML.

We can make the process more flexible by removing version data from the changelog YAML files, and instead inferring the versions from each changelog YAML file's existence in the git tree at each tag in the minor series.

This change makes the process more ergonomic for developers, but harder to test, since I can't simply concoct YAML data for a range of versions. Instead, I've added a number of unit tests, and tried to exercise all the relevant parts. I haven't (yet) got to the trouble of building a test git repository, but I suppose I could do that.

Also, this PR makes it an error to include versions the YAML file, which probably makes it harder to merge since our automation still generates that field. We may want to actually remove that field in a subsequent PR.

@pugnascotia pugnascotia added >enhancement v8.0.0 :Delivery/Tooling Developer tooliing and automation labels Aug 26, 2021
@elasticmachine elasticmachine added the Team:Delivery Meta label for Delivery team label Aug 26, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor comments. I assume we'll follow up with a PR to HOMER to omit this from generated changelog entries?

* with how {@link Version} is used in the build. It also retains any qualifier (prerelease) information, and uses
* that information when comparing instances.
*/
public final class QualifiedVersion implements Comparable<QualifiedVersion> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Version class already seems to capture a qualifier. Can we just add what we need to that existing class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... they're not equivalent. Version will parse and store the qualifier, but does nothing else with it. It doesn't use it in toString() or in compareTo(). It also allows free-form qualifiers in relaxed mode, which I believe we use when parsing the Docker version. I didn't want to get into the potential problems of unifying them as part of this work. I'm most worried about the toString() difference.

* @return whether fetching git tags is required
*/
@VisibleForTesting
static boolean needsGitTags(String versionString) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me why this is. Also, wouldn't it be better to parse the version string and just check the patch version segment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I understand now. For the first release in a series, we know all the changelogs are going to be for that version. Can we clarify that with some comments?

changelogsByVersion
);

LOGGER.info("Generating release highlights...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So release highlights and breaking changes include all versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All patch versions, yes.

TYPE_LABELS.put("deprecation", "Deprecations");
TYPE_LABELS.put("enhancement", "Enhancements");
TYPE_LABELS.put("feature", "New features");
TYPE_LABELS.put("new-aggregation", "New aggregation");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a unique label just for new aggs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently. Maybe in practice it'll be combined with e.g. >feature, but my test code printed null without a mapping for it.

@pugnascotia
Copy link
Contributor Author

I'll prepare a PR for HOMER, then we can merge this PR as soon that the HOMER change is deployed.

@pugnascotia pugnascotia merged commit ac803f0 into elastic:master Sep 1, 2021
@pugnascotia pugnascotia deleted the generate-changelog-drop-version-field branch September 1, 2021 06:25
pugnascotia added a commit that referenced this pull request Sep 1, 2021
The changelog generation process currently relies on version
information being present in the changelog YAML descriptors. However,
this makes them difficult to update in some scenarios. For example,
if a PR is merged and subsequently labelled for backporting, our
automation won't update the versions in the changelog YAML.

We can make the process more flexible by removing version data from
the changelog YAML files, and instead inferring the versions from
each changelog YAML file's existence in the git tree at each tag
in the minor series.

This change makes the process more ergonomic for developers, but
harder to test, since I can't simply concoct YAML data for a range
of versions. Instead, I've added a number of unit tests, and tried
to exercise all the relevant parts.

It is now an error to include `versions` the YAML file.
@pugnascotia
Copy link
Contributor Author

Backported to 7.x in fec4df1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Delivery/Tooling Developer tooliing and automation >enhancement Team:Delivery Meta label for Delivery team v7.16.0 v8.0.0-alpha2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants