Reactor: Log commands in file, correctly compute changelog range
- Configured the `releaser.commands` logger to redirect to a file only - Made use of new tags listing features to find the perfect log range for the release notes task
This commit is contained in:
committed by
Marcin Grzejszczak
parent
4b01dbea64
commit
c64fa4ff0a
@@ -142,17 +142,50 @@ public class GenerateReleaseNotesTask
|
||||
Issues issuesClient = repo.issues();
|
||||
EnumMap<Type, List<ChangelogEntry>> entries = new EnumMap<>(Type.class);
|
||||
|
||||
String fromVersionTag = "v" + args.projectToRun.originalVersion.version;
|
||||
String toVersionTag = "v" + args.versionFromBom.version;
|
||||
if (args.options.dryRun == Boolean.TRUE
|
||||
&& !gitHandler.findTagSha1(args.project, toVersionTag).isPresent()) {
|
||||
toVersionTag = "HEAD";
|
||||
}
|
||||
|
||||
// eg. 3.2.1 for current 3.2.2
|
||||
String fromVersionTag = args.versionFromBom
|
||||
.computePreviousPatchTag("v", "RELEASE").orElseGet(() -> {
|
||||
Pattern pattern = args.versionFromBom
|
||||
.computePreviousMinorTagPattern("v", "RELEASE")
|
||||
.orElseGet(() -> args.versionFromBom
|
||||
.computePreviousMajorTagPattern("v", "RELEASE"));
|
||||
// eg. v3.2.*.RELEASE or v3.*.*.RELEASE
|
||||
log.info(
|
||||
"Couldn't simply compute previous version of {}, looking through tag list with pattern {}",
|
||||
args.versionFromBom.version, pattern.pattern());
|
||||
|
||||
List<String> sortedTags = gitHandler
|
||||
.findTagNamesMatching(args.project, pattern)
|
||||
.collect(Collectors.toList());
|
||||
if (sortedTags.isEmpty()) {
|
||||
throw new IllegalStateException(
|
||||
"Couldn't find a tag that matches pattern "
|
||||
+ pattern.pattern());
|
||||
}
|
||||
sortedTags.forEach(System.out::println);
|
||||
return sortedTags.get(0);
|
||||
});
|
||||
|
||||
if (Boolean.TRUE == args.options.interactive) {
|
||||
log.info("\nForce the from in log range if needed [{}]: ", fromVersionTag);
|
||||
log.info("\nComputed log range is {}..{}", fromVersionTag, toVersionTag);
|
||||
log.info("\nForce the FROM in log range if needed [{}]", fromVersionTag);
|
||||
String modifiedFrom = System.console().readLine();
|
||||
if (!modifiedFrom.trim().isEmpty()) {
|
||||
fromVersionTag = modifiedFrom;
|
||||
}
|
||||
log.info("\nForce the TO in log range if needed [{}]", toVersionTag);
|
||||
String modifiedTo = System.console().readLine();
|
||||
if (!modifiedTo.trim().isEmpty()) {
|
||||
toVersionTag = modifiedTo;
|
||||
}
|
||||
}
|
||||
log.info("Fetching the log for range {}..{}", fromVersionTag, toVersionTag);
|
||||
log.info("Will fetch the log for range {}..{}", fromVersionTag, toVersionTag);
|
||||
|
||||
// gather commits. we use tags in the format `vVERSION`
|
||||
final List<SimpleCommit> revCommits = gitHandler.commitsBetween(args.project,
|
||||
|
||||
46
projects/reactor/src/main/resources/logback.xml
Normal file
46
projects/reactor/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<!--
|
||||
~ Copyright 2013-2020 the original author or authors.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
|
||||
<appender name="COMMANDFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- <file>${java.io.tmpdir}/reactor-releaser-commands.log</file>-->
|
||||
<file>logs/reactor-releaser-commands.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<!-- Keep 3 releases worth of history -->
|
||||
<fileNamePattern>logs/reactor-releaser-commands.%i.log</fileNamePattern>
|
||||
<minIndex>1</minIndex>
|
||||
<maxIndex>3</maxIndex>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<maxFileSize>5MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="releaser.commands" level="DEBUG" additivity="false">
|
||||
<appender-ref ref="COMMANDFILE"/>
|
||||
</logger>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="COMMANDFILE"/>
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user