Skip to content

Commit

Permalink
[chloggen] Add ability to generate multiple changelog files
Browse files Browse the repository at this point in the history
  • Loading branch information
djaglowski committed Jul 27, 2023
1 parent 37d80b2 commit af2aca2
Show file tree
Hide file tree
Showing 26 changed files with 856 additions and 172 deletions.
16 changes: 16 additions & 0 deletions .chloggen/chloggen-multiple-logs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. crosslink)
component: chloggen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add ability to configure separate changelogs for different audiences

# One or more tracking issues related to the change
issues: [364]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
27 changes: 23 additions & 4 deletions chloggen/cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,41 @@ func entryWithSubtext() *chlog.Entry {
}
}

func entryForChangelogs(changeType string, issue int, keys ...string) *chlog.Entry {
keyStr := "default"
if len(keys) > 0 {
keyStr = strings.Join(keys, ",")
}
return &chlog.Entry{
ChangeLogs: keys,
ChangeType: changeType,
Component: "receiver/foo",
Note: fmt.Sprintf("Some change relevant to [%s]", keyStr),
Issues: []int{issue},
}
}

func setupTestDir(t *testing.T, entries []*chlog.Entry) {
require.NotNil(t, globalCfg, "test should instantiate globalCfg before calling setupTestDir")

// Create a known dummy changelog which may be updated by the test
changelogBytes, err := os.ReadFile(filepath.Join("testdata", config.DefaultChangelogMD))
// Create dummy changelogs which may be updated by the test
changelogBytes, err := os.ReadFile(filepath.Join("testdata", config.DefaultChangeLogFilename))
require.NoError(t, err)
require.NoError(t, os.WriteFile(globalCfg.ChangelogMD, changelogBytes, os.FileMode(0755)))
for _, filename := range globalCfg.ChangeLogs {
require.NoError(t, os.MkdirAll(filepath.Dir(filename), os.FileMode(0755)))
require.NoError(t, os.WriteFile(filename, changelogBytes, os.FileMode(0755)))
}

require.NoError(t, os.Mkdir(globalCfg.ChlogsDir, os.FileMode(0755)))
// Create the chlogs directory
require.NoError(t, os.MkdirAll(globalCfg.ChlogsDir, os.FileMode(0755)))

// Copy the entry template, for tests that ensure it is not deleted
templateInRootDir := config.New("testdata").TemplateYAML
templateBytes, err := os.ReadFile(filepath.Clean(templateInRootDir))
require.NoError(t, err)
require.NoError(t, os.WriteFile(globalCfg.TemplateYAML, templateBytes, os.FileMode(0755)))

// Write the entries to the chlogs directory
for i, entry := range entries {
entryBytes, err := yaml.Marshal(entry)
require.NoError(t, err)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions chloggen/cmd/testdata/multiple_changelogs/CHANGELOG-API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Changelog

<!-- next version -->

## v0.45.0

### 🛑 Breaking changes 🛑

- `receiver/foo`: Some change relevant to [api] (#125)
- `receiver/foo`: Some change relevant to [user,api] (#11)

### 🚩 Deprecations 🚩

- `receiver/foo`: Some change relevant to [api] (#223)
- `receiver/foo`: Some change relevant to [user,api] (#234)

### 💡 Enhancements 💡

- `receiver/foo`: Some change relevant to [api,user] (#333)
- `receiver/foo`: Some change relevant to [api] (#555)

### 🧰 Bug fixes 🧰

- `receiver/foo`: Some change relevant to [api] (#111)
- `receiver/foo`: Some change relevant to [api] (#777)

## v0.44.0

### 🛑 Breaking changes 🛑

- `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950)

### 💡 Enhancements 💡

- `filterprocessor`: Ability to filter `Spans` (#6341)
- `flinkmetricsreceiver`: add attribute values to metadata #11520

### 🧰 Bug fixes 🧰

- `redactionprocessor`: respect allow_all_keys configuration (#11542)
39 changes: 39 additions & 0 deletions chloggen/cmd/testdata/multiple_changelogs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

<!-- next version -->

## v0.45.0

### 🛑 Breaking changes 🛑

- `receiver/foo`: Some change relevant to [user,api] (#11)

### 🚩 Deprecations 🚩

- `receiver/foo`: Some change relevant to [user] (#123)
- `receiver/foo`: Some change relevant to [user,api] (#234)

### 💡 Enhancements 💡

- `receiver/foo`: Some change relevant to [user] (#21)
- `receiver/foo`: Some change relevant to [api,user] (#333)

### 🧰 Bug fixes 🧰

- `receiver/foo`: Some change relevant to [user] (#32)
- `receiver/foo`: Some change relevant to [user] (#222)

## v0.44.0

### 🛑 Breaking changes 🛑

- `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950)

### 💡 Enhancements 💡

- `filterprocessor`: Ability to filter `Spans` (#6341)
- `flinkmetricsreceiver`: add attribute values to metadata #11520

### 🧰 Bug fixes 🧰

- `redactionprocessor`: respect allow_all_keys configuration (#11542)
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Changelog

<!-- next version -->

## v0.45.0

### 🛑 Breaking changes 🛑

- `receiver/foo`: Some change relevant to [api] (#125)
- `receiver/foo`: Some change relevant to [user,api] (#11)

### 🚩 Deprecations 🚩

- `receiver/foo`: Some change relevant to [default] (#123)
- `receiver/foo`: Some change relevant to [api] (#223)
- `receiver/foo`: Some change relevant to [user,api] (#234)

### 💡 Enhancements 💡

- `receiver/foo`: Some change relevant to [default] (#21)
- `receiver/foo`: Some change relevant to [api,user] (#333)
- `receiver/foo`: Some change relevant to [api] (#555)

### 🧰 Bug fixes 🧰

- `receiver/foo`: Some change relevant to [default] (#32)
- `receiver/foo`: Some change relevant to [default] (#222)
- `receiver/foo`: Some change relevant to [api] (#111)
- `receiver/foo`: Some change relevant to [api] (#777)

## v0.44.0

### 🛑 Breaking changes 🛑

- `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950)

### 💡 Enhancements 💡

- `filterprocessor`: Ability to filter `Spans` (#6341)
- `flinkmetricsreceiver`: add attribute values to metadata #11520

### 🧰 Bug fixes 🧰

- `redactionprocessor`: respect allow_all_keys configuration (#11542)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

<!-- next version -->

## v0.45.0

### 🛑 Breaking changes 🛑

- `receiver/foo`: Some change relevant to [user,api] (#11)

### 🚩 Deprecations 🚩

- `receiver/foo`: Some change relevant to [default] (#123)
- `receiver/foo`: Some change relevant to [user,api] (#234)

### 💡 Enhancements 💡

- `receiver/foo`: Some change relevant to [default] (#21)
- `receiver/foo`: Some change relevant to [api,user] (#333)

### 🧰 Bug fixes 🧰

- `receiver/foo`: Some change relevant to [default] (#32)
- `receiver/foo`: Some change relevant to [default] (#222)

## v0.44.0

### 🛑 Breaking changes 🛑

- `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950)

### 💡 Enhancements 💡

- `filterprocessor`: Ability to filter `Spans` (#6341)
- `flinkmetricsreceiver`: add attribute values to metadata #11520

### 🧰 Bug fixes 🧰

- `redactionprocessor`: respect allow_all_keys configuration (#11542)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Changelog

<!-- next version -->

## v0.45.0

### 🛑 Breaking changes 🛑

- `receiver/foo`: Some change relevant to [api] (#125)
- `receiver/foo`: Some change relevant to [user,api] (#11)

### 🚩 Deprecations 🚩

- `receiver/foo`: Some change relevant to [api] (#223)
- `receiver/foo`: Some change relevant to [user,api] (#234)

### 💡 Enhancements 💡

- `receiver/foo`: Some change relevant to [api,user] (#333)
- `receiver/foo`: Some change relevant to [api] (#555)

### 🧰 Bug fixes 🧰

- `receiver/foo`: Some change relevant to [api] (#111)
- `receiver/foo`: Some change relevant to [api] (#777)

## v0.44.0

### 🛑 Breaking changes 🛑

- `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950)

### 💡 Enhancements 💡

- `filterprocessor`: Ability to filter `Spans` (#6341)
- `flinkmetricsreceiver`: add attribute values to metadata #11520

### 🧰 Bug fixes 🧰

- `redactionprocessor`: respect allow_all_keys configuration (#11542)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

<!-- next version -->

## v0.45.0

### 🛑 Breaking changes 🛑

- `receiver/foo`: Some change relevant to [user,api] (#11)

### 🚩 Deprecations 🚩

- `receiver/foo`: Some change relevant to [default] (#123)
- `receiver/foo`: Some change relevant to [user,api] (#234)

### 💡 Enhancements 💡

- `receiver/foo`: Some change relevant to [default] (#21)
- `receiver/foo`: Some change relevant to [api,user] (#333)

### 🧰 Bug fixes 🧰

- `receiver/foo`: Some change relevant to [default] (#32)
- `receiver/foo`: Some change relevant to [default] (#222)

## v0.44.0

### 🛑 Breaking changes 🛑

- `prometheusexporter`: Automatically rename metrics with units to follow Prometheus naming convention (#8950)

### 💡 Enhancements 💡

- `filterprocessor`: Ability to filter `Spans` (#6341)
- `flinkmetricsreceiver`: add attribute values to metadata #11520

### 🧰 Bug fixes 🧰

- `redactionprocessor`: respect allow_all_keys configuration (#11542)
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit af2aca2

Please sign in to comment.