-
Notifications
You must be signed in to change notification settings - Fork 25.3k
New release notes generator tasks #71125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pugnascotia
merged 31 commits into
elastic:master
from
pugnascotia:67335-new-changelog-process
Jul 28, 2021
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
54f0b83
Define tasks for handling release notes
pugnascotia 507142d
Revise generated changelog files
pugnascotia 288efb7
Fixing YAML files
pugnascotia 21c44b2
Leave only a test set of yaml files
pugnascotia c0f241b
Merge remote-tracking branch 'upstream/master' into 67335-new-changel…
pugnascotia c715d20
Address review feedback
pugnascotia 0f98874
Link validateChangelogs task to precommit
pugnascotia da15f7e
Merge remote-tracking branch 'upstream/master' into 67335-new-changel…
pugnascotia fef52ec
Fix property name, auto-generate anchor value
pugnascotia 7bc66a3
Tweaks to schema
pugnascotia a608417
Add further validation beyond schema check
pugnascotia 4db9aca
Merge remote-tracking branch 'upstream/master' into 67335-new-changel…
pugnascotia ef4969f
Merge remote-tracking branch 'upstream/master' into 67335-new-changel…
pugnascotia ed70b89
Fixes after merge
pugnascotia 6b54e2e
Tweaks
pugnascotia 22a0e8c
Switch to using SimpleTemplateEngine
pugnascotia 6e24def
Various fixes
pugnascotia f715472
Support 'security' and 'known-issue' entries
pugnascotia a3c3109
Make it possible to test generator code
pugnascotia 8831b10
Merge remote-tracking branch 'upstream/master' into 67335-new-changel…
pugnascotia f489015
Test changelog files
pugnascotia d3ee9b7
Review feedback
pugnascotia 4f05927
Merge remote-tracking branch 'upstream/master' into 67335-new-changel…
pugnascotia 3e4d604
Merge remote-tracking branch 'upstream/master' into 67335-new-changel…
pugnascotia 2d52eed
Run changelogs tasks via precommit
pugnascotia 1a0a734
Version parsing fixes
pugnascotia 2f0e923
Actually commit my changes
pugnascotia 7b697c2
Remove copy of VersionTests.java
pugnascotia ca19c41
Merge branch 'master' into 67335-new-changelog-process
elasticmachine dfeaae2
Merge remote-tracking branch 'upstream/master' into 67335-new-changel…
pugnascotia f2125e3
Remove test yaml files
pugnascotia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../main/java/org/elasticsearch/gradle/internal/precommit/ValidateYamlAgainstSchemaTask.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.gradle.internal.precommit; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
|
||
/** | ||
* Incremental task to validate a set of YAML files against against a schema. | ||
*/ | ||
public class ValidateYamlAgainstSchemaTask extends ValidateJsonAgainstSchemaTask { | ||
@Override | ||
protected String getFileType() { | ||
return "YAML"; | ||
} | ||
|
||
protected ObjectMapper getMapper() { | ||
return new ObjectMapper(new YAMLFactory()); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
...nal/src/main/java/org/elasticsearch/gradle/internal/release/BreakingChangesGenerator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.gradle.internal.release; | ||
|
||
import groovy.text.SimpleTemplateEngine; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
|
||
import org.elasticsearch.gradle.Version; | ||
import org.elasticsearch.gradle.VersionProperties; | ||
|
||
import java.io.File; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.TreeMap; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Generates the page that lists the breaking changes and deprecations for a minor version release. | ||
*/ | ||
public class BreakingChangesGenerator { | ||
|
||
static void update(File templateFile, File outputFile, List<ChangelogEntry> entries) throws IOException { | ||
try (FileWriter output = new FileWriter(outputFile)) { | ||
generateFile(Files.readString(templateFile.toPath()), output, entries); | ||
} | ||
} | ||
|
||
@VisibleForTesting | ||
private static void generateFile(String template, FileWriter outputWriter, List<ChangelogEntry> entries) throws IOException { | ||
final Version version = VersionProperties.getElasticsearchVersion(); | ||
|
||
final Map<Boolean, Map<String, List<ChangelogEntry.Breaking>>> breakingChangesByNotabilityByArea = entries.stream() | ||
.map(ChangelogEntry::getBreaking) | ||
.filter(Objects::nonNull) | ||
.collect( | ||
Collectors.groupingBy( | ||
ChangelogEntry.Breaking::isNotable, | ||
Collectors.groupingBy(ChangelogEntry.Breaking::getArea, TreeMap::new, Collectors.toList()) | ||
) | ||
); | ||
|
||
final Map<String, List<ChangelogEntry.Deprecation>> deprecationsByArea = entries.stream() | ||
.map(ChangelogEntry::getDeprecation) | ||
.filter(Objects::nonNull) | ||
.collect(Collectors.groupingBy(ChangelogEntry.Deprecation::getArea, TreeMap::new, Collectors.toList())); | ||
|
||
final Map<String, Object> bindings = new HashMap<>(); | ||
bindings.put("breakingChangesByNotabilityByArea", breakingChangesByNotabilityByArea); | ||
bindings.put("deprecationsByArea", deprecationsByArea); | ||
bindings.put("isElasticsearchSnapshot", VersionProperties.isElasticsearchSnapshot()); | ||
bindings.put("majorDotMinor", version.getMajor() + "." + version.getMinor()); | ||
bindings.put("majorMinor", String.valueOf(version.getMajor()) + version.getMinor()); | ||
bindings.put("nextMajor", (version.getMajor() + 1) + ".0"); | ||
bindings.put("version", version); | ||
|
||
try { | ||
final SimpleTemplateEngine engine = new SimpleTemplateEngine(); | ||
engine.createTemplate(template).make(bindings).writeTo(outputWriter); | ||
} catch (ClassNotFoundException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.