Skip to content

Commit 9a7f60d

Browse files
author
codeboten
committed
[chore] add chloggen for changelog
This change updates the changelog process in this repo to match the process in the contrib repo.
1 parent a9f41a2 commit 9a7f60d

File tree

10 files changed

+136
-19
lines changed

10 files changed

+136
-19
lines changed

.chloggen/TEMPLATE.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type:
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
5+
component:
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note:
9+
10+
# One or more tracking issues or pull requests related to the change
11+
issues: []
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

.chloggen/instrument-otel-go.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
5+
component: obsreport
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Instrument `obsreport.Receiver` metrics with otel-go"
9+
10+
# One or more tracking issues or pull requests related to the change
11+
issues: [6222]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:

.github/workflows/changelog.yml

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,63 @@ jobs:
2020
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}}
2121

2222
steps:
23-
- uses: actions/checkout@v3
23+
- name: Checkout Repo
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0
27+
- name: Setup Go
28+
uses: actions/setup-go@v3
29+
with:
30+
go-version: 1.19
31+
- name: Cache Go
32+
id: go-cache
33+
uses: actions/cache@v3
34+
with:
35+
path: |
36+
~/go/bin
37+
~/go/pkg/mod
38+
key: changelog-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
2439

25-
- name: Check for CHANGELOG changes
40+
- name: Ensure no changes to the CHANGELOG
2641
run: |
27-
# Only the latest commit of the feature branch is available
28-
# automatically. To diff with the base branch, we need to
29-
# fetch that too (and we only need its latest commit).
30-
git fetch origin ${{ github.base_ref }} --depth=1
31-
if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]]
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) ]]
3243
then
33-
echo "A CHANGELOG was modified. Looks good!"
44+
echo "The CHANGELOG should not be directly modified."
45+
echo "Please add a .yaml file to the ./.chloggen/ directory."
46+
echo "See CONTRIBUTING.md for more details."
47+
echo "Alternately, add either \"[chore]\" to the title of the pull request or add the \"Skip Changelog\" label if this job should be skipped."
48+
false
3449
else
35-
echo "No CHANGELOG was modified."
36-
echo "Please add a CHANGELOG entry, or add either \"[chore]\" to the title of the pull request or add the \"Skip Changelog\" label if not required."
50+
echo "The CHANGELOG was not modified."
51+
fi
52+
53+
- name: Ensure ./.chloggen/*.yaml addition(s)
54+
run: |
55+
if [[ 1 -gt $(git diff --diff-filter=A --name-only $(git merge-base origin/main ${{ github.event.pull_request.head.sha }}) ${{ github.event.pull_request.head.sha }} ./.chloggen | grep -c \\.yaml) ]]
56+
then
57+
echo "No changelog entry was added to the ./.chloggen/ directory."
58+
echo "Please add a .yaml file to the ./.chloggen/ directory."
59+
echo "See CONTRIBUTING.md for more details."
60+
echo "Alternately, add either \"[chore]\" to the title of the pull request or add the \"Skip Changelog\" label if this job should be skipped."
3761
false
62+
else
63+
echo "A changelog entry was added to the ./.chloggen/ directory."
3864
fi
65+
66+
- name: Validate ./.chloggen/*.yaml changes
67+
run: |
68+
make chlog-validate \
69+
|| { echo "New ./.chloggen/*.yaml file failed validation."; exit 1; }
70+
71+
# In order to validate any links in the yaml file, render the config to markdown
72+
- name: Render .chloggen changelog entries
73+
run: make chlog-preview > changelog_preview.md
74+
- name: Install markdown-link-check
75+
run: npm install -g markdown-link-check
76+
- name: Run markdown-link-check
77+
run: |
78+
markdown-link-check \
79+
--verbose \
80+
--config .github/workflows/check_links_config.json \
81+
changelog_preview.md \
82+
|| { echo "Check that anchor links are lowercase"; exit 1; }

CHANGELOG.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# Changelog
2-
3-
## Unreleased
1+
<!-- This file is autogenerated. See CONTRIBUTING.md for instructions to add an entry. -->
42

5-
### 💡 Enhancements 💡
3+
# Changelog
64

7-
- Instrument `obsreport.Receiver` metrics with otel-go (#6222)
5+
<!-- next version -->
86

97
## v0.62.0 Beta
108

CONTRIBUTING.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ changes in the specification can result in breaking changes to the implementatio
492492
policy of the Collector SIG to not implement, or accept implementations of, new or changed specification language
493493
prior to inclusion in a stable release of the specification.
494494

495-
## Updating Changelog
495+
## Changelog
496496

497-
An entry into the [Changelog](./CHANGELOG.md) is required for the following reasons:
497+
An entry into the changelog is required for the following reasons:
498498

499499
- Changes made to the behaviour of the component
500500
- Changes to the configuration
@@ -509,6 +509,22 @@ It is reasonable to omit an entry to the changelog under these circuimstances:
509509
If there is some uncertainty with regards to if a changelog entry is needed, the recomendation is to create
510510
an entry to in the event that the change is important to the project consumers.
511511

512+
### Adding a Changelog Entry
513+
514+
The [CHANGELOG.md](./CHANGELOG.md) file in this repo is autogenerated from `.yaml` files in the `./.chloggen` directory.
515+
516+
Your pull-request should add a new `.yaml` file to this directory. The name of your file must be unique since the last release.
517+
518+
During the collector release process, all `./chloggen/*.yaml` files are transcribed into `CHANGELOG.md` and then deleted.
519+
520+
**Recommended Steps**
521+
1. Create an entry file using `make chlog-new`. This generates a file based on your current branch (e.g. `./.chloggen/my-branch.yaml`)
522+
2. Fill in all fields in the new file
523+
3. Run `make chlog-validate` to ensure the new file is valid
524+
4. Commit and push the file
525+
526+
Alternately, copy `./.chloggen/TEMPLATE.yaml`, or just create your file from scratch.
527+
512528
## Release
513529

514530
See [release](docs/release.md) for details.

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ install-tools:
134134
cd $(TOOLS_MOD_DIR) && $(GOCMD) install github.com/tcnksm/ghr
135135
cd $(TOOLS_MOD_DIR) && $(GOCMD) install github.com/wadey/gocovmerge
136136
cd $(TOOLS_MOD_DIR) && $(GOCMD) install go.opentelemetry.io/build-tools/checkdoc
137+
cd $(TOOLS_MOD_DIR) && $(GOCMD) install go.opentelemetry.io/build-tools/chloggen
137138
cd $(TOOLS_MOD_DIR) && $(GOCMD) install go.opentelemetry.io/build-tools/semconvgen
138139
cd $(TOOLS_MOD_DIR) && $(GOCMD) install golang.org/x/exp/cmd/apidiff
139140
cd $(TOOLS_MOD_DIR) && $(GOCMD) install golang.org/x/tools/cmd/goimports
@@ -441,3 +442,24 @@ checklinks:
441442
crosslink:
442443
@echo "Executing crosslink"
443444
crosslink --root=$(shell pwd) --prune
445+
446+
.PHONY: chlog-install
447+
chlog-install:
448+
cd $(TOOLS_MOD_DIR) && $(GOCMD) install go.opentelemetry.io/build-tools/chloggen
449+
450+
FILENAME?=$(shell git branch --show-current)
451+
.PHONY: chlog-new
452+
chlog-new: chlog-install
453+
chloggen new --filename $(FILENAME)
454+
455+
.PHONY: chlog-validate
456+
chlog-validate: chlog-install
457+
chloggen validate
458+
459+
.PHONY: chlog-preview
460+
chlog-preview: chlog-install
461+
chloggen update --dry
462+
463+
.PHONY: chlog-update
464+
chlog-update: chlog-install
465+
chloggen update --version $(VERSION)

docs/release.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ It is possible that a core approver isn't a contrib approver. In that case, the
3737

3838
1. Prepare Core for release.
3939

40-
* Update CHANGELOG.md file and rename the Unreleased section to the new release name. Add a new unreleased section at top. Use commit history feature to get the list of commits since the last release to help understand what should be in the release notes, e.g.: https://github.com/open-telemetry/opentelemetry-collector/compare/v0.44.0...main. Commit the changes.
40+
* Update CHANGELOG.md file, this is done via `chloggen`. Run the following command from the root of the opentelemetry-collector-contrib repo:
41+
* `make chlog-update VERSION=v0.55.0`
4142

4243
* Run `make prepare-release PREVIOUS_VERSION=0.52.0 RELEASE_CANDIDATE=0.53.0`
4344

@@ -59,7 +60,7 @@ It is possible that a core approver isn't a contrib approver. In that case, the
5960

6061
1. Prepare Contrib for release.
6162

62-
* Update CHANGELOG.md file, this is now done via `chloggen`. Run the following command from the root of the opentelemetry-collector-contrib repo:
63+
* Update CHANGELOG.md file, this is done via `chloggen`. Run the following command from the root of the opentelemetry-collector-contrib repo:
6364
* `make chlog-update VERSION=v0.55.0`
6465

6566
* Use multimod to update the version of the collector package:

internal/tools/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
github.com/tcnksm/ghr v0.16.0
1313
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad
1414
go.opentelemetry.io/build-tools/checkdoc v0.1.0
15+
go.opentelemetry.io/build-tools/chloggen v0.1.0
1516
go.opentelemetry.io/build-tools/crosslink v0.1.0
1617
go.opentelemetry.io/build-tools/multimod v0.1.0
1718
go.opentelemetry.io/build-tools/semconvgen v0.1.0

internal/tools/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,8 @@ go.opentelemetry.io/build-tools v0.1.0 h1:igm6n4IH+RNuwHDtcHFuO6UoGcY7ndZQoIxIL2
701701
go.opentelemetry.io/build-tools v0.1.0/go.mod h1:DrJ+yXmVxJFBLsfINMJ5XS9SF5tszV+Hnz/BgehnN70=
702702
go.opentelemetry.io/build-tools/checkdoc v0.1.0 h1:CJ9Bwu+DK97IPTpQKck748TAuZqcWuZCsVvh32D80/w=
703703
go.opentelemetry.io/build-tools/checkdoc v0.1.0/go.mod h1:su7j2uCbwFLI+wY9OI75qoCIehufSjd8SMTZgNGF67s=
704+
go.opentelemetry.io/build-tools/chloggen v0.1.0 h1:535UasQVHK3DC2SZKNYlGy3BeKusvmc8/vamZmvipfE=
705+
go.opentelemetry.io/build-tools/chloggen v0.1.0/go.mod h1:qsKC2l0n7+Pta8GqKN9vHxMPHwknQH0tjAfJaW1KWaU=
704706
go.opentelemetry.io/build-tools/crosslink v0.1.0 h1:yiPARvwtw7AI2uIafkodREE7Hl1AFmmTka32EqTYktA=
705707
go.opentelemetry.io/build-tools/crosslink v0.1.0/go.mod h1:xkaBbu3Q/ZBUYoP8IrKAwp6u4LHvElymHUccqdK5hC4=
706708
go.opentelemetry.io/build-tools/multimod v0.1.0 h1:TXxCjq00Lc/YYHUZ4DE8gNi+oYlpqgu2b7GXIt5oitk=

internal/tools/tools.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
_ "github.com/tcnksm/ghr"
3333
_ "github.com/wadey/gocovmerge"
3434
_ "go.opentelemetry.io/build-tools/checkdoc"
35+
_ "go.opentelemetry.io/build-tools/chloggen"
3536
_ "go.opentelemetry.io/build-tools/crosslink"
3637
_ "go.opentelemetry.io/build-tools/multimod"
3738
_ "go.opentelemetry.io/build-tools/semconvgen"

0 commit comments

Comments
 (0)