Skip to content

Commit 611a589

Browse files
authored
Generate separate changelog for end users and Go API consumers (open-telemetry#8153)
Corresponds to open-telemetry/opentelemetry-collector-contrib#24771
1 parent 441f3d5 commit 611a589

File tree

11 files changed

+103
-19
lines changed

11 files changed

+103
-19
lines changed

.chloggen/TEMPLATE.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Use this changelog template to create an entry for release notes.
2+
13
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
24
change_type:
35

@@ -14,3 +16,10 @@ issues: []
1416
# These lines will be padded with 2 spaces and then inserted directly into the document.
1517
# Use pipe (|) for multiline entries.
1618
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: []

.chloggen/chloggen-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: changelog
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Generate separate changelogs for end users and package consumers
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [8153]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [api]

.chloggen/config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# The directory that stores individual changelog entries.
2+
# Each entry is stored in a dedicated yaml file.
3+
# - 'chloggen new' will copy the 'template_yaml' to this directory as a new entry file.
4+
# - 'chloggen validate' will validate that all entry files are valid.
5+
# - 'chloggen update' will read and delete all entry files in this directory, and update 'changelog_md'.
6+
# Specify as relative path from root of repo.
7+
# (Optional) Default: .chloggen
8+
entries_dir: .chloggen
9+
10+
# This file is used as the input for individual changelog entries.
11+
# Specify as relative path from root of repo.
12+
# (Optional) Default: .chloggen/TEMPLATE.yaml
13+
template_yaml: .chloggen/TEMPLATE.yaml
14+
15+
# The CHANGELOG file or files to which 'chloggen update' will write new entries
16+
# (Optional) Default filename: CHANGELOG.md
17+
change_logs:
18+
user: CHANGELOG.md
19+
api: CHANGELOG-API.md
20+
21+
# The default change_log or change_logs to which an entry should be added.
22+
# If 'change_logs' is specified in this file, and no value is specified for 'default_change_logs',
23+
# then 'change_logs' MUST be specified in every entry file.
24+
default_change_logs: [user]

.github/workflows/changelog.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ jobs:
3737
~/go/pkg/mod
3838
key: changelog-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3939

40-
- name: Ensure no changes to the CHANGELOG
40+
- name: Ensure no changes to the CHANGELOG.md or CHANGELOG-API.md
4141
run: |
42-
if [[ $(git diff --name-only $(git merge-base origin/main ${{ github.event.pull_request.head.sha }}) ${{ github.event.pull_request.head.sha }} ./CHANGELOG.md) ]]
42+
if [[ $(git diff --name-only $(git merge-base origin/main ${{ github.event.pull_request.head.sha }}) ${{ github.event.pull_request.head.sha }} ./CHANGELOG*.md) ]]
4343
then
44-
echo "The CHANGELOG should not be directly modified."
44+
echo "CHANGELOG.md and CHANGELOG-API.md should not be directly modified."
4545
echo "Please add a .yaml file to the ./.chloggen/ directory."
4646
echo "See CONTRIBUTING.md for more details."
4747
echo "Alternately, add either \"[chore]\" to the title of the pull request or add the \"Skip Changelog\" label if this job should be skipped."
4848
false
4949
else
50-
echo "The CHANGELOG was not modified."
50+
echo "CHANGELOG.md and CHANGELOG-API.md were not modified."
5151
fi
5252
5353
- name: Ensure ./.chloggen/*.yaml addition(s)

CHANGELOG-API.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- This file is autogenerated. See CONTRIBUTING.md for instructions to add an entry. -->
2+
3+
# Go API Changelog
4+
5+
This changelog includes only developer-facing changes.
6+
If you are looking for user-facing changes, check out [CHANGELOG.md](./CHANGELOG.md).
7+
8+
<!-- next version -->

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
# Changelog
44

5+
Starting with version v0.83.0, this changelog includes only user-facing changes.
6+
If you are looking for developer-facing changes, check out [CHANGELOG-API.md](./CHANGELOG-API.md).
7+
58
<!-- next version -->
69

710
## v1.0.0-rcv0014/v0.82.0

CONTRIBUTING.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,28 +505,39 @@ prior to inclusion in a stable release of the specification.
505505

506506
## Changelog
507507

508+
### Overview
509+
510+
There are two Changelogs for this repository:
511+
512+
- `CHANGELOG.md` is intended for users of the collector and lists changes that affect the behavior of the collector.
513+
- `CHANGELOG-API.md` is intended for developers who are importing packages from the collector codebase.
514+
515+
### When to add a Changelog Entry
516+
508517
An entry into the changelog is required for the following reasons:
509518

510519
- Changes made to the behaviour of the component
511520
- Changes to the configuration
512521
- Changes to default settings
513522
- New components being added
523+
- Changes to exported elements of a package
514524

515525
It is reasonable to omit an entry to the changelog under these circuimstances:
516526

517527
- Updating test to remove flakiness or improve coverage
518528
- Updates to the CI/CD process
529+
- Updates to internal packages
519530

520531
If there is some uncertainty with regards to if a changelog entry is needed, the recomendation is to create
521532
an entry to in the event that the change is important to the project consumers.
522533

523534
### Adding a Changelog Entry
524535

525-
The [CHANGELOG.md](./CHANGELOG.md) file in this repo is autogenerated from `.yaml` files in the `./.chloggen` directory.
536+
The [CHANGELOG.md](./CHANGELOG.md) and [CHANGELOG-API.md](./CHANGELOG-API.md) files in this repo is autogenerated from `.yaml` files in the `./.chloggen` directory.
526537

527538
Your pull-request should add a new `.yaml` file to this directory. The name of your file must be unique since the last release.
528539

529-
During the collector release process, all `./chloggen/*.yaml` files are transcribed into `CHANGELOG.md` and then deleted.
540+
During the collector release process, all `./chloggen/*.yaml` files are transcribed into `CHANGELOG.md` and `CHANGELOG-API.md` and then deleted.
530541

531542
**Recommended Steps**
532543
1. Create an entry file using `make chlog-new`. This generates a file based on your current branch (e.g. `./.chloggen/my-branch.yaml`)

Makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -534,22 +534,23 @@ crosslink: $(CROSSLINK)
534534
$(CROSSLINK) --root=$(shell pwd) --prune
535535

536536

537-
FILENAME?=$(shell git branch --show-current).yaml
537+
FILENAME?=$(shell git branch --show-current)
538538
.PHONY: chlog-new
539-
chlog-new: $(CHLOG)
540-
$(CHLOG) new --filename $(FILENAME)
539+
chlog-new: $(CHLOGGEN)
540+
$(CHLOGGEN) new --config $(CHLOGGEN_CONFIG) --filename $(FILENAME)
541541

542542
.PHONY: chlog-validate
543-
chlog-validate: $(CHLOG)
544-
$(CHLOG) validate
543+
chlog-validate: $(CHLOGGEN)
544+
$(CHLOGGEN) validate --config $(CHLOGGEN_CONFIG)
545545

546546
.PHONY: chlog-preview
547-
chlog-preview: $(CHLOG)
548-
$(CHLOG) update --dry
547+
chlog-preview: $(CHLOGGEN)
548+
$(CHLOGGEN) update --config $(CHLOGGEN_CONFIG) --dry
549549

550550
.PHONY: chlog-update
551-
chlog-update: $(CHLOG)
552-
$(CHLOG) update --version $(VERSION)
551+
chlog-update: $(CHLOGGEN)
552+
$(CHLOGGEN) update --config $(CHLOGGEN_CONFIG) --version $(VERSION)
553+
553554

554555
.PHONY: builder-integration-test
555556
builder-integration-test: $(ENVSUBST)

Makefile.Common

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ TOOLS_BIN_DIR := $(PWD)/.tools
1414
TOOLS_MOD_REGEX := "\s+_\s+\".*\""
1515
TOOLS_PKG_NAMES := $(shell grep -E $(TOOLS_MOD_REGEX) < $(TOOLS_MOD_DIR)/tools.go | tr -d " _\"" | grep -vE '/v[0-9]+$$')
1616
TOOLS_BIN_NAMES := $(addprefix $(TOOLS_BIN_DIR)/, $(notdir $(shell echo $(TOOLS_PKG_NAMES))))
17+
CHLOGGEN_CONFIG := .chloggen/config.yaml
1718

1819
ADDLICENSE := $(TOOLS_BIN_DIR)/addlicense
1920
APIDIFF := $(TOOLS_BIN_DIR)/apidiff
2021
CHECKFILE := $(TOOLS_BIN_DIR)/checkfile
21-
CHLOG := $(TOOLS_BIN_DIR)/chloggen
22+
CHLOGGEN := $(TOOLS_BIN_DIR)/chloggen
2223
CROSSLINK := $(TOOLS_BIN_DIR)/crosslink
2324
ENVSUBST := $(TOOLS_BIN_DIR)/envsubst
2425
GOIMPORTS := $(TOOLS_BIN_DIR)/goimports

internal/tools/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/mikefarah/yq/v4 v4.34.2
1313
github.com/pavius/impi v0.0.3
1414
go.opentelemetry.io/build-tools/checkfile v0.10.0
15-
go.opentelemetry.io/build-tools/chloggen v0.9.0
15+
go.opentelemetry.io/build-tools/chloggen v0.11.0
1616
go.opentelemetry.io/build-tools/crosslink v0.9.0
1717
go.opentelemetry.io/build-tools/multimod v0.9.0
1818
go.opentelemetry.io/build-tools/semconvgen v0.9.0

internal/tools/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ go.opentelemetry.io/build-tools v0.10.0 h1:5asgwud1lI/pMYQM9P/vwEgOjyv6G3nhYnwo0
652652
go.opentelemetry.io/build-tools v0.10.0/go.mod h1:GFpz8YD/DG5shfY1J2f3uuK88zr61U5rVRGOhKMDE9M=
653653
go.opentelemetry.io/build-tools/checkfile v0.10.0 h1:RjwCDirwXHFTGA3Nh6nL6P2x43abZFGiMEyk7GCQee4=
654654
go.opentelemetry.io/build-tools/checkfile v0.10.0/go.mod h1:hmR/xk4LQkhQx2hsIELlowjoc+zB/4dGUEcDnCyvKdo=
655-
go.opentelemetry.io/build-tools/chloggen v0.9.0 h1:sHdl6T5NTlGhRwy7du4APkd2GZEamI4DfBitdKlzxGU=
656-
go.opentelemetry.io/build-tools/chloggen v0.9.0/go.mod h1:zuYbAo3TkrHo3C7lCrM5dHWSS50BDr0UfRYtyBFv2dQ=
655+
go.opentelemetry.io/build-tools/chloggen v0.11.0 h1:PYbfjzw/4pHNfwH0kCAMolvmdorMVGxSSFY8A9097fw=
656+
go.opentelemetry.io/build-tools/chloggen v0.11.0/go.mod h1:zuYbAo3TkrHo3C7lCrM5dHWSS50BDr0UfRYtyBFv2dQ=
657657
go.opentelemetry.io/build-tools/crosslink v0.9.0 h1:LOeJzMxsxBG2qMKeO22fRs91QvDfY+BA5pF1skTjbx0=
658658
go.opentelemetry.io/build-tools/crosslink v0.9.0/go.mod h1:VaSi2ahs+r+v//m6OpqTkD5siSFVta9eTHhKqPsfH/Q=
659659
go.opentelemetry.io/build-tools/multimod v0.9.0 h1:Im9PCGhfmKQC2XR0aTYzADNiOZLk9QEQgibDhadH+i0=

0 commit comments

Comments
 (0)