Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating release-notes tool to account for new changelog format #309

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 13 additions & 13 deletions tools/release-notes/release_notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,25 @@ func (r *releaseNotesGenerator) generateReleaseNotes(md io.Reader) (string, erro
func (r *releaseNotesGenerator) parseMD(md io.Reader) (string, error) {
sc := bufio.NewScanner(md)

// Extract the first second-level heading
var heading string
for sc.Scan() {
// Search the changelog for the header matching releaseVersion
found := false
for !found && sc.Scan() {
// Only consider second-level headers
if strings.HasPrefix(sc.Text(), "## ") {
heading = strings.TrimSpace(strings.TrimPrefix(sc.Text(), "## "))
break
heading := strings.TrimSpace(strings.TrimPrefix(sc.Text(), "## "))

// Expected heading would be something like "16.0.4 (MM/DD/YY)"
parts := strings.SplitN(heading, " ", 2)
if parts[0] == r.releaseVersion { // header matches releaseVersion
found = true
}
}
}
if err := sc.Err(); err != nil {
return "", trace.Wrap(err)
}
if heading == "" {
return "", trace.BadParameter("no second-level heading found in changelog")
}

// Expected heading would be something like "16.0.4 (MM/DD/YY)"
parts := strings.SplitN(heading, " ", 2)
if parts[0] != r.releaseVersion {
return "", trace.BadParameter("changelog version number did not match expected version number: %q != %q", parts[0], r.releaseVersion)
if !found {
return "", trace.BadParameter("could not find an entry for version %q in the changelog", r.releaseVersion)
}

// Write everything until next header to buffer
Expand Down
15 changes: 11 additions & 4 deletions tools/release-notes/release_notes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@ func Test_generateReleaseNotes(t *testing.T) {
wantErr bool
}{
{
name: "happy path",
name: "happy path - v17", // Tests that latest version works
releaseVersion: "17.1.3",
clFile: mustOpen(t, "test-changelog.md"),
want: mustRead(t, "expected-release-notes-v17.md"),
wantErr: false,
},
{
name: "happy path - v16", // Tests that an earlier version works
releaseVersion: "16.0.1",
clFile: mustOpen(t, "test-changelog.md"),
want: mustRead(t, "expected-release-notes.md"),
want: mustRead(t, "expected-release-notes-v16.md"),
wantErr: false,
},
{
Expand All @@ -53,8 +60,8 @@ func Test_generateReleaseNotes(t *testing.T) {
wantErr: false,
},
{
name: "version mismatch",
releaseVersion: "15.0.1", // test-changelog has 16.0.1
name: "version does not exist",
releaseVersion: "14.0.1", // test-changelog has 16.0.1
clFile: mustOpen(t, "test-changelog.md"),
want: "",
wantErr: true,
Expand Down
22 changes: 22 additions & 0 deletions tools/release-notes/testdata/expected-release-notes-v17.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Description

* Fixes a bug where v16 Teleport cannot connect to v17.1.0, v17.1.1 and v17.1.2 clusters. [#50658](https://github.com/gravitational/teleport/pull/50658)
* Prevent panicking during shutdown when SQS consumer is disabled. [#50648](https://github.com/gravitational/teleport/pull/50648)
* Add a --labels flag to the tctl tokens ls command. [#50624](https://github.com/gravitational/teleport/pull/50624)

## Download

Download the current and previous releases of Teleport at https://goteleport.com/download.

## Plugins

Download the current release of Teleport plugins from the links below.
* Slack [Linux amd64](https://cdn.teleport.dev/teleport-access-slack-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/teleport-access-slack-v17.1.3-linux-arm64-bin.tar.gz)
* Mattermost [Linux amd64](https://cdn.teleport.dev/teleport-access-mattermost-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/teleport-access-mattermost-v17.1.3-linux-arm64-bin.tar.gz)
* Discord [Linux amd64](https://cdn.teleport.dev/teleport-access-discord-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/teleport-access-discord-v17.1.3-linux-arm64-bin.tar.gz)
* Terraform Provider [Linux amd64](https://cdn.teleport.dev/terraform-provider-teleport-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/terraform-provider-teleport-v17.1.3-linux-arm64-bin.tar.gz) | [macOS amd64](https://cdn.teleport.dev/terraform-provider-teleport-v17.1.3-darwin-amd64-bin.tar.gz) | [macOS arm64](https://cdn.teleport.dev/terraform-provider-teleport-v17.1.3-darwin-arm64-bin.tar.gz) | [macOS universal](https://cdn.teleport.dev/terraform-provider-teleport-v17.1.3-darwin-universal-bin.tar.gz)
* Event Handler [Linux amd64](https://cdn.teleport.dev/teleport-event-handler-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/teleport-event-handler-v17.1.3-linux-arm64-bin.tar.gz) | [macOS amd64](https://cdn.teleport.dev/teleport-event-handler-v17.1.3-darwin-amd64-bin.tar.gz)
* PagerDuty [Linux amd64](https://cdn.teleport.dev/teleport-access-pagerduty-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/teleport-access-pagerduty-v17.1.3-linux-arm64-bin.tar.gz)
* Jira [Linux amd64](https://cdn.teleport.dev/teleport-access-jira-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/teleport-access-jira-v17.1.3-linux-arm64-bin.tar.gz)
* Email [Linux amd64](https://cdn.teleport.dev/teleport-access-email-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/teleport-access-email-v17.1.3-linux-arm64-bin.tar.gz)
* Microsoft Teams [Linux amd64](https://cdn.teleport.dev/teleport-access-msteams-v17.1.3-linux-amd64-bin.tar.gz) | [Linux arm64](https://cdn.teleport.dev/teleport-access-msteams-v17.1.3-linux-arm64-bin.tar.gz)
20 changes: 20 additions & 0 deletions tools/release-notes/testdata/test-changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 17.1.3 (1/2/25)

* Fixes a bug where v16 Teleport cannot connect to v17.1.0, v17.1.1 and v17.1.2 clusters. [#50658](https://github.com/gravitational/teleport/pull/50658)
* Prevent panicking during shutdown when SQS consumer is disabled. [#50648](https://github.com/gravitational/teleport/pull/50648)
* Add a --labels flag to the tctl tokens ls command. [#50624](https://github.com/gravitational/teleport/pull/50624)

## 16.0.1 (06/17/24)

* `tctl` now ignores any configuration file if the auth_service section is disabled, and prefer loading credentials from a given identity file or tsh profile instead. [#43115](https://github.com/gravitational/teleport/pull/43115)
Expand All @@ -21,3 +27,17 @@ Teleport 16 brings the following new features and improvements:
- Access requests from the resources view
- `tctl` for Windows
- Teleport plugins improvements

## 15.4.17 (08/28/24)

* Prevent connections from being randomly terminated by Teleport proxies when `proxy_protocol` is enabled and TLS is terminated before Teleport Proxy. [#45993](https://github.com/gravitational/teleport/pull/45993)
* Fixed an issue where host_sudoers could be written to Teleport proxy server sudoer lists in Teleport v14 and v15. [#45961](https://github.com/gravitational/teleport/pull/45961)
* Prevent interactive sessions from hanging on exit. [#45953](https://github.com/gravitational/teleport/pull/45953)
* Fixed kernel version check of Enhanced Session Recording for distributions with backported BPF. [#45942](https://github.com/gravitational/teleport/pull/45942)
* Added a flag to skip a relogin attempt when using `tsh ssh` and `tsh proxy ssh`. [#45930](https://github.com/gravitational/teleport/pull/45930)
* Fixed an issue WebSocket upgrade fails with MiTM proxies that can remask payloads. [#45900](https://github.com/gravitational/teleport/pull/45900)
* When a database is created manually (without auto-discovery) the teleport.dev/db-admin and teleport.dev/db-admin-default-database labels are no longer ignored and can be used to configure database auto-user provisioning. [#45892](https://github.com/gravitational/teleport/pull/45892)
* Slack plugin now lists logins permitted by requested roles. [#45854](https://github.com/gravitational/teleport/pull/45854)
* Fixed an issue that prevented the creation of AWS App Access for an Integration that used digits only (eg, AWS Account ID). [#45818](https://github.com/gravitational/teleport/pull/45818)
* For new EKS Cluster auto-enroll configurations, the temporary Access Entry is tagged with `teleport.dev/` namespaced tags. For existing set ups, please add the `eks:TagResource` action to the Integration IAM Role to get the same behavior. [#45726](https://github.com/gravitational/teleport/pull/45726)
* Added support for importing S3 Bucket Tags into Teleport Policy's Access Graph. For existing configurations, ensure that the `s3:GetBucketTagging` permission is manually included in the Teleport Access Graph integration role. [#45550](https://github.com/gravitational/teleport/pull/45550)
Loading