Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
# New changelog process
# Apache Solr Changelog

We are in the process of migrating to a new way of managing our changelog. Please see [dev-docs/changelog.adoc](../dev-docs/changelog.adoc) for details.

In a transition period it is still possible to merge your changelog entry to `solr/CHANGES.txt`, but then you can only use the new process.
This is the home of the Solr changelog, in logchange format.
Please see [dev-docs/changelog.adoc](../dev-docs/changelog.adoc) for details.
2 changes: 1 addition & 1 deletion changelog/unreleased/PR#3778.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ type: added # added, changed, fixed, deprecated, removed, dependency_update, sec
authors:
- name: Eric Pugh
- name: Andreas Rütten
merge_requests:
issues:
- 3778
7 changes: 4 additions & 3 deletions dev-docs/changelog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ solr/
└── changelog/
├── unreleased/ ← new fragments live here
| └── SOLR-12345-fix-memory-leak.yml
├── v10.0.0/ ← changes in already released version
└── v10.0.1/
├── v9.8.0/ ← changes in already released versions
├── v9.8.0/
└── v9.9.0/
----

== 3. The YAML format

Below is an example of a changelog yaml fragment. The full yaml format is xref:https://logchange.dev/tools/logchange/reference/#tasks[documented here], but we normally only need `title`, `type`, `authors` and `links`:
Below is an example of a changelog yaml fragment. The full yaml format is xref:https://logchange.dev/tools/logchange/reference/#tasks[documented here], but we normally only need `title`, `type`, `authors` and `links`. For a change without a JIRA, you can add the PR number in `issues`:

[source, yaml]
----
Expand Down
22 changes: 16 additions & 6 deletions gradle/changelog.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,33 @@ logchange {
task writeChangelog {
description = 'Generates a change/log description file (YAML)'
doLast {
def gitBranchFull = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()

// Prevent running on main or branches prefixed with 'branch_'
if (gitBranchFull == 'main' || gitBranchFull.startsWith('branch_')) {
throw new GradleException("Cannot create changelog on branch '${gitBranchFull}'. This task should only be run on feature branches.")
}

def gitBranch = gitBranchFull.replaceFirst(/^.*\//, "")

def gitUserName = 'git config user.name'.execute().text.trim()
def configuredName = providers.gradleProperty("user.name").getOrElse(gitUserName)
def githubId = providers.gradleProperty("user.githubid").getOrElse(null)
def nick = githubId ? "\n nick: ${githubId}" : ""
def asfId = providers.gradleProperty("user.asfid").getOrElse(null)
def asfIdUrl = asfId ? "\n url: https://home.apache.org/phonebook.html?uid=${asfId}" : ""
def gitBranch = 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
def jiraMatcher = gitBranch.toUpperCase() =~ /SOLR-\d\d\d+/
def jiraRef = jiraMatcher ? jiraMatcher[0] : "SOLR-XXXX"
def jiraMatcher = gitBranch =~ /(?i)SOLR-\d\d\d+/
def jiraRef = jiraMatcher ? jiraMatcher[0].toUpperCase() : "SOLR-XXXX"
def jiraUrl = "https://issues.apache.org/jira/browse/${jiraRef}"
def jiraLinks = jiraMatcher ? "links:\n - name: ${jiraRef}\n url: ${jiraUrl}" : ""
def branchWithoutJira = gitBranch.replaceFirst(/(?i)SOLR-\d\d\d+-/, "").replace("-", " ").capitalize()
def fileName = "changelog/unreleased/${gitBranch}.yml"
def title = gitBranch.replaceFirst(/(?i)SOLR-\d\d\d+-/, "").replace("-", " ").capitalize()
// Strip everything before and including '/', then sanitize special characters
def sanitizedBranchName = gitBranch.replaceAll(/^.*\//, "").replaceAll(/[^a-zA-Z0-9._-]/, "-")
def fileName = "changelog/unreleased/${sanitizedBranchName}.yml"
def file = new File(fileName)
file.parentFile.mkdirs()
file.text = """# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
title: ${branchWithoutJira}
title: ${title}
type: other # added, changed, fixed, deprecated, removed, dependency_update, security, other
authors:
- name: ${configuredName}${nick}${asfIdUrl}
Expand Down
1 change: 1 addition & 0 deletions gradle/validation/rat-sources.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ allprojects {
exclude "CHANGELOG.md"
exclude "changelog/**/version-summary.md"
exclude "changelog/.templates/*.md"
exclude "changelog/archive.md"

// The root project also includes patterns for the include composite
// projects. Include their sources in the scan.
Expand Down
Loading