Skip to content

Commit 80d16ec

Browse files
committed
WIP handling multiple releases in the docs, and update release notes for 9.0.1
1 parent b642cc5 commit 80d16ec

File tree

10 files changed

+114
-40
lines changed

10 files changed

+114
-40
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/BundleChangelogsTask.java

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
1515
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
1616

17+
import org.elasticsearch.gradle.Version;
1718
import org.gradle.api.DefaultTask;
1819
import org.gradle.api.file.ConfigurableFileCollection;
1920
import org.gradle.api.file.Directory;
@@ -28,6 +29,7 @@
2829
import org.gradle.api.tasks.InputFiles;
2930
import org.gradle.api.tasks.OutputFile;
3031
import org.gradle.api.tasks.TaskAction;
32+
import org.gradle.api.tasks.options.Option;
3133
import org.gradle.process.ExecOperations;
3234

3335
import java.io.File;
@@ -38,6 +40,7 @@
3840
import java.util.List;
3941
import java.util.Properties;
4042

43+
import javax.annotation.Nullable;
4144
import javax.inject.Inject;
4245

4346
import static java.util.stream.Collectors.toList;
@@ -52,6 +55,29 @@ public class BundleChangelogsTask extends DefaultTask {
5255

5356
private final GitWrapper gitWrapper;
5457

58+
@Nullable
59+
private String branch;
60+
private boolean updateExisting;
61+
private boolean finalize;
62+
63+
@Option(
64+
option = "update-existing",
65+
description = "Only update entries that are already in the bundle. Useful for updating the bundle after a BC has been cut."
66+
)
67+
public void setUpdateExisting(boolean updateExisting) {
68+
this.updateExisting = updateExisting;
69+
}
70+
71+
@Option(option = "branch", description = "Branch (or other ref) to use for generating the changelog bundle.")
72+
public void setBranch(String branch) {
73+
this.branch = branch;
74+
}
75+
76+
@Option(option = "finalize", description = "Specify that the bundle is finalized, i.e. that the version has been released.")
77+
public void setFinalize(boolean finalize) {
78+
this.finalize = finalize;
79+
}
80+
5581
private static final ObjectMapper yamlMapper = new ObjectMapper(
5682
new YAMLFactory().enable(YAMLGenerator.Feature.MINIMIZE_QUOTES)
5783
.disable(YAMLGenerator.Feature.SPLIT_LINES)
@@ -72,13 +98,16 @@ public BundleChangelogsTask(ObjectFactory objectFactory, ExecOperations execOper
7298

7399
@TaskAction
74100
public void executeTask() throws IOException {
101+
if (branch == null) {
102+
throw new IllegalArgumentException("'branch' not specified.");
103+
}
104+
75105
final String upstreamRemote = gitWrapper.getUpstream();
76106

77-
String ref = "9.0-fix-release-notes";
78107
try {
79-
checkoutChangelogs(gitWrapper, upstreamRemote, ref);
108+
checkoutChangelogs(gitWrapper, upstreamRemote, branch);
80109
Properties props = new Properties();
81-
props.load(new StringReader(gitWrapper.runCommand("git", "show", ref + ":build-tools-internal/version.properties")));
110+
props.load(new StringReader(gitWrapper.runCommand("git", "show", branch + ":build-tools-internal/version.properties")));
82111
String version = props.getProperty("elasticsearch");
83112

84113
LOGGER.info("Finding changelog files...");
@@ -90,7 +119,27 @@ public void executeTask() throws IOException {
90119
.sorted(Comparator.comparing(ChangelogEntry::getPr))
91120
.collect(toList());
92121

93-
ChangelogBundle bundle = new ChangelogBundle(version, Instant.now().toString(), entries);
122+
ChangelogBundle existingBundle = null;
123+
124+
if (updateExisting) {
125+
var existingBundleFile = new File("docs/release-notes/changelog-bundles/" + version + ".yml");
126+
if (existingBundleFile.exists()) {
127+
var bundle = ChangelogBundle.parse(existingBundleFile);
128+
existingBundle = bundle;
129+
entries = entries.stream()
130+
.filter(e -> bundle.changelogs().stream().anyMatch(c -> c.getPr().equals(e.getPr())))
131+
.toList();
132+
}
133+
}
134+
135+
var isReleased = false;
136+
if (finalize) {
137+
isReleased = true;
138+
} else if (existingBundle != null) {
139+
isReleased = existingBundle.released();
140+
}
141+
142+
ChangelogBundle bundle = new ChangelogBundle(version, isReleased, Instant.now().toString(), entries);
94143

95144
yamlMapper.writeValue(new File("docs/release-notes/changelog-bundles/" + version + ".yml"), bundle);
96145
} finally {
@@ -102,7 +151,13 @@ private static void checkoutChangelogs(GitWrapper gitWrapper, String upstream, S
102151
gitWrapper.updateRemote(upstream);
103152
// TODO check for changes first
104153
gitWrapper.runCommand("rm", "-rf", "docs/changelog");
105-
gitWrapper.runCommand("git", "checkout", ref, "--", "docs/changelog");
154+
var refSpec = upstream + "/" + ref;
155+
if (ref.contains("upstream/")) {
156+
refSpec = ref.replace("upstream/", upstream + "/");
157+
} else if (ref.matches("^[0-9a-f]+$")) {
158+
refSpec = ref;
159+
}
160+
gitWrapper.runCommand("git", "checkout", refSpec, "--", "docs/changelog");
106161
}
107162

108163
@InputDirectory

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/ChangelogBundle.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@
2121
import java.io.UncheckedIOException;
2222
import java.util.List;
2323

24-
public record ChangelogBundle(String version, String generated, List<ChangelogEntry> changelogs) {
24+
public record ChangelogBundle(String version, boolean released, String generated, List<ChangelogEntry> changelogs) {
2525

2626
private static final Logger LOGGER = Logging.getLogger(GenerateReleaseNotesTask.class);
2727
private static final ObjectMapper yamlMapper = new ObjectMapper(
2828
new YAMLFactory().enable(YAMLGenerator.Feature.MINIMIZE_QUOTES).disable(YAMLGenerator.Feature.SPLIT_LINES)
2929
);
3030

31+
public ChangelogBundle(String version, String generated, List<ChangelogEntry> changelogs) {
32+
this(version, false, generated, changelogs);
33+
}
34+
3135
public static ChangelogBundle parse(File file) {
3236
try {
3337
return yamlMapper.readValue(file, ChangelogBundle.class);

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/GenerateReleaseNotesTask.java

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -97,42 +97,23 @@ public void executeTask() throws IOException {
9797
.getFiles()
9898
.stream()
9999
.map(ChangelogBundle::parse)
100-
.sorted(Comparator.comparing(ChangelogBundle::generated).reversed())
100+
.sorted(Comparator.comparing(ChangelogBundle::released).reversed().thenComparing(ChangelogBundle::generated).reversed())
101101
.toList();
102102

103103
// Ensure that each changelog/PR only shows up once, in its earliest release
104-
// TODO: This should only be for unreleased/non-final bundles
105104
var uniquePrs = new HashSet<Integer>();
106105
for (int i = bundles.size() - 1; i >= 0; i--) {
107106
var bundle = bundles.get(i);
108-
bundle.changelogs().removeAll(bundle.changelogs().stream().filter(c -> uniquePrs.contains(c.getPr())).toList());
107+
if (!bundle.released()) {
108+
bundle.changelogs().removeAll(bundle.changelogs().stream().filter(c -> uniquePrs.contains(c.getPr())).toList());
109+
}
109110
uniquePrs.addAll(bundle.changelogs().stream().map(ChangelogEntry::getPr).toList());
110111
}
111112

112113
LOGGER.info("Generating release notes...");
113114
ReleaseNotesGenerator.update(this.releaseNotesTemplate.get().getAsFile(), this.releaseNotesFile.get().getAsFile(), bundles);
114115
ReleaseNotesGenerator.update(this.breakingChangesTemplate.get().getAsFile(), this.breakingChangesFile.get().getAsFile(), bundles);
115116
ReleaseNotesGenerator.update(this.deprecationsTemplate.get().getAsFile(), this.deprecationsFile.get().getAsFile(), bundles);
116-
117-
// Only update breaking changes and deprecations for new minors
118-
// if (qualifiedVersion.revision() == 0) {
119-
// LOGGER.info("Generating breaking changes / deprecations notes...");
120-
// ReleaseNotesGenerator.update(
121-
// this.breakingChangesTemplate.get().getAsFile(),
122-
// this.breakingChangesFile.get().getAsFile(),
123-
// qualifiedVersion,
124-
// changelogsByVersion.getOrDefault(qualifiedVersion, Set.of()),
125-
// bundles
126-
// );
127-
//
128-
// ReleaseNotesGenerator.update(
129-
// this.deprecationsTemplate.get().getAsFile(),
130-
// this.deprecationsFile.get().getAsFile(),
131-
// qualifiedVersion,
132-
// changelogsByVersion.getOrDefault(qualifiedVersion, Set.of()),
133-
// bundles
134-
// );
135-
// }
136117
}
137118

138119
/**

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/PruneChangelogsTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static Stream<QualifiedVersion> findPreviousVersion(GitWrapper gitWrapper, Quali
149149
final String currentMajorPattern = "v" + version.major() + ".*";
150150
final String previousMajorPattern = "v" + (version.major() - 1) + ".*";
151151

152-
return Stream.concat(gitWrapper.listVersions(currentMajorPattern), gitWrapper.listVersions(previousMajorPattern))
152+
return gitWrapper.listVersions(previousMajorPattern)
153153
.filter(v -> v.isBefore(version));
154154
}
155155

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/release/ReleaseToolsPlugin.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public void apply(Project project) {
7373
task.setChangelogs(yamlFiles);
7474
task.setChangelogDirectory(changeLogDirectory);
7575
task.setBundleFile(projectDirectory.file("docs/release-notes/changelogs-" + version.toString() + ".yml"));
76+
task.getOutputs().upToDateWhen(o -> false);
7677
};
7778

7879
final Function<Boolean, Action<GenerateReleaseNotesTask>> configureGenerateTask = shouldConfigureYamlFiles -> task -> {
@@ -98,6 +99,8 @@ public void apply(Project project) {
9899

99100
task.setChangelogBundleDirectory(projectDirectory.dir("docs/release-notes/changelog-bundles"));
100101

102+
task.getOutputs().upToDateWhen(o -> false);
103+
101104
task.dependsOn(validateChangelogsTask);
102105
};
103106

build-tools-internal/src/main/resources/templates/index.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,24 @@ To check for security updates, go to [Security announcements for the Elastic sta
2323
<%
2424
for(bundle in changelogBundles) {
2525
def version = bundle.version
26-
def versionWithoutSeparator = bundle.versionWithoutSeparator
26+
def versionForIds = bundle.version.toString().equals('9.0.0') ? bundle.versionWithoutSeparator : bundle.version
2727
def changelogsByTypeByArea = bundle.changelogsByTypeByArea
2828
def notableHighlights = bundle.notableHighlights
2929
def nonNotableHighlights = bundle.nonNotableHighlights
3030
def unqualifiedVersion = bundle.unqualifiedVersion
31+
def coming = !bundle.bundle.released
32+
33+
if (coming) {
34+
print "\n"
35+
print "```{applies_to}\n"
36+
print "stack: coming ${version}\n"
37+
print "```"
38+
}
3139
%>
32-
## ${unqualifiedVersion} [elasticsearch-${versionWithoutSeparator}-release-notes]
40+
## ${unqualifiedVersion} [elasticsearch-${versionForIds}-release-notes]
3341
<%
3442
if (!notableHighlights.isEmpty() || !nonNotableHighlights.isEmpty()) {
35-
print "\n### Highlights [elasticsearch-${versionWithoutSeparator}-highlights]\n"
43+
print "\n### Highlights [elasticsearch-${versionForIds}-highlights]\n"
3644
}
3745

3846
for (highlights in [notableHighlights, nonNotableHighlights]) {
@@ -50,7 +58,7 @@ for (changeType in ['features-enhancements', 'fixes', 'regression']) {
5058
continue;
5159
}
5260
%>
53-
### ${ TYPE_LABELS.getOrDefault(changeType, 'No mapping for TYPE_LABELS[' + changeType + ']') } [elasticsearch-${versionWithoutSeparator}-${changeType}]
61+
### ${ TYPE_LABELS.getOrDefault(changeType, 'No mapping for TYPE_LABELS[' + changeType + ']') } [elasticsearch-${versionForIds}-${changeType}]
5462
<% for (team in changelogsByTypeByArea[changeType].keySet()) {
5563
print "\n${team}:\n";
5664

docs/release-notes/breaking-changes.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Breaking changes can impact your Elastic applications, potentially disrupting no
1010

1111
If you are migrating from a version prior to version 9.0, you must first upgrade to the last 8.x version available. To learn how to upgrade, check out [Upgrade](docs-content://deploy-manage/upgrade.md).
1212

13-
To learn how to upgrade, check out <upgrade docs>.
14-
1513
% ## Next version [elasticsearch-nextversion-breaking-changes]
1614

1715
## 9.0.1 [elasticsearch-901-breaking-changes]

docs/release-notes/changelog-bundles/9.0.0.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
version: 9.0.0
2+
released: true
23
generated: 2025-04-14T18:16:08.465456Z
34
changelogs:
45
- pr: 90529

docs/release-notes/changelog-bundles/9.0.1.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
version: 9.0.1
2-
generated: 2025-04-28T21:41:06.757953Z
2+
released: false
3+
generated: 2025-05-02T19:34:24.151692Z
34
changelogs:
45
- pr: 125694
56
summary: LTR score bounding
67
area: Ranking
78
type: bug
89
issues: []
10+
- pr: 125922
11+
summary: Fix text structure NPE when fields in list have null value
12+
area: Machine Learning
13+
type: bug
14+
issues: []
915
- pr: 126273
1016
summary: Fix LTR rescorer with model alias
1117
area: Ranking
@@ -130,3 +136,13 @@ changelogs:
130136
area: Ingest Node
131137
type: upgrade
132138
issues: []
139+
- pr: 127414
140+
summary: Fix npe when using source confirmed text query against missing field
141+
area: Search
142+
type: bug
143+
issues: []
144+
- pr: 127527
145+
summary: "No, line noise isn't a valid ip"
146+
area: ES|QL
147+
type: bug
148+
issues: []

docs/release-notes/index.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ To check for security updates, go to [Security announcements for the Elastic sta
2121
% ### Fixes [elasticsearch-next-fixes]
2222
% *
2323

24-
## 9.0.1 [elasticsearch-901-release-notes]
24+
```{applies_to}
25+
stack: coming 9.0.1
26+
```
27+
## 9.0.1 [elasticsearch-9.0.1-release-notes]
2528

26-
### Features and enhancements [elasticsearch-901-features-enhancements]
29+
### Features and enhancements [elasticsearch-9.0.1-features-enhancements]
2730

2831
Infra/Core:
2932
* Validation checks on paths allowed for 'files' entitlements. Restrict the paths we allow access to, forbidding plugins to specify/request entitlements for reading or writing to specific protected directories. [#126852](https://github.com/elastic/elasticsearch/pull/126852)
@@ -37,7 +40,7 @@ Search:
3740
Security:
3841
* Add Issuer to failed SAML Signature validation logs when available [#126310](https://github.com/elastic/elasticsearch/pull/126310) (issue: [#111022](https://github.com/elastic/elasticsearch/issues/111022))
3942

40-
### Fixes [elasticsearch-901-fixes]
43+
### Fixes [elasticsearch-9.0.1-fixes]
4144

4245
Aggregations:
4346
* Rare terms aggregation false **positive** fix [#126884](https://github.com/elastic/elasticsearch/pull/126884)
@@ -55,6 +58,7 @@ ES|QL:
5558
* Fix count optimization with pushable union types [#127225](https://github.com/elastic/elasticsearch/pull/127225) (issue: [#127200](https://github.com/elastic/elasticsearch/issues/127200))
5659
* Fix join masking eval [#126614](https://github.com/elastic/elasticsearch/pull/126614)
5760
* Fix sneaky bug in single value query [#127146](https://github.com/elastic/elasticsearch/pull/127146)
61+
* No, line noise isn't a valid ip [#127527](https://github.com/elastic/elasticsearch/pull/127527)
5862

5963
ILM+SLM:
6064
* Fix equality bug in `WaitForIndexColorStep` [#126605](https://github.com/elastic/elasticsearch/pull/126605)
@@ -69,12 +73,16 @@ Infra/Core:
6973

7074
Machine Learning:
7175
* Adding missing `onFailure` call for Inference API start model request [#126930](https://github.com/elastic/elasticsearch/pull/126930)
76+
* Fix text structure NPE when fields in list have null value [#125922](https://github.com/elastic/elasticsearch/pull/125922)
7277
* Leverage threadpool schedule for inference api to avoid long running thread [#126858](https://github.com/elastic/elasticsearch/pull/126858) (issue: [#126853](https://github.com/elastic/elasticsearch/issues/126853))
7378

7479
Ranking:
7580
* Fix LTR rescorer with model alias [#126273](https://github.com/elastic/elasticsearch/pull/126273)
7681
* LTR score bounding [#125694](https://github.com/elastic/elasticsearch/pull/125694)
7782

83+
Search:
84+
* Fix npe when using source confirmed text query against missing field [#127414](https://github.com/elastic/elasticsearch/pull/127414)
85+
7886
TSDB:
7987
* Improve resiliency of `UpdateTimeSeriesRangeService` [#126637](https://github.com/elastic/elasticsearch/pull/126637)
8088

0 commit comments

Comments
 (0)