Add breaking changes to changelog (#2908)

This commit is contained in:
Julio Castillo
2025-02-18 19:09:13 +01:00
committed by GitHub
parent 4e965f1b62
commit 4c6e6d6791
3 changed files with 52 additions and 10 deletions

View File

@@ -20,9 +20,9 @@ Uncomment and complete the upgrade notes section below (if applicable), followin
** Upgrade Notes ** ** Upgrade Notes **
```upgrade-note ```upgrade-note
fast/stages/0-boostrap: example upgrade note 1. `fast/stages/0-boostrap`: example upgrade note 1.
``` ```
```upgrade-note ```upgrade-note
modules/project: example upgrade note 2. `modules/project`: example upgrade note 2.
``` ```
--> -->

View File

@@ -5,8 +5,20 @@ All notable changes to this project will be documented in this file.
## [Unreleased] <!-- from: 2025-02-12 13:19:03+00:00 to: None since: v37.3.0 --> ## [Unreleased] <!-- from: 2025-02-12 13:19:03+00:00 to: None since: v37.3.0 -->
### BREAKING CHANGES
- `modules/iam-service-account`: Removed service account key generation functionality [[#2907](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2907)]
- `modules/net-lb-app-ext`: Adds the two missing fields for locality_lb_policy and locality_lb_policies with field and block set, validation for both and tests. [[#2898](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2898)]
### BLUEPRINTS
- [[#2907](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2907)] Remove Service Account key generation ([wiktorn](https://github.com/wiktorn)) <!-- 2025-02-18 17:02:39+00:00 -->
### MODULES ### MODULES
- [[#2907](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2907)] **incompatible change:** Remove Service Account key generation ([wiktorn](https://github.com/wiktorn)) <!-- 2025-02-18 17:02:39+00:00 -->
- [[#2886](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2886)] Increase the default complexity of Cloud SQL DB passwords ([lyricnz](https://github.com/lyricnz)) <!-- 2025-02-18 10:46:29+00:00 -->
- [[#2901](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2901)] Add CA chain output to CAS module ([ludoo](https://github.com/ludoo)) <!-- 2025-02-18 07:05:29+00:00 --> - [[#2901](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2901)] Add CA chain output to CAS module ([ludoo](https://github.com/ludoo)) <!-- 2025-02-18 07:05:29+00:00 -->
- [[#2898](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2898)] Add support for locality policies to net-lb-app-ext module ([jacklever-hub24](https://github.com/jacklever-hub24)) <!-- 2025-02-18 06:25:45+00:00 --> - [[#2898](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/2898)] Add support for locality policies to net-lb-app-ext module ([jacklever-hub24](https://github.com/jacklever-hub24)) <!-- 2025-02-18 06:25:45+00:00 -->

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Copyright 2023 Google LLC # Copyright 2025 Google LLC
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -74,6 +74,7 @@ import logging
import requests import requests
import iso8601 import iso8601
import marko
HEADING = ( HEADING = (
'# Changelog\n\n' '# Changelog\n\n'
@@ -89,8 +90,8 @@ CHANGE_URL = f'[{{name}}]: {URL}/compare/v{{release_from}}...{{release_to}}'
FileRelease = collections.namedtuple('FileRelease', FileRelease = collections.namedtuple('FileRelease',
'name published content link', 'name published content link',
defaults=([], None)) defaults=([], None))
PullRequest = collections.namedtuple('PullRequest', PullRequest = collections.namedtuple(
'id base author title merged_at labels') 'PullRequest', 'id base author title merged_at labels upgrade_notes')
class Error(Exception): class Error(Exception):
@@ -139,9 +140,10 @@ def format_pull(pull, group=None):
f'([{pull.author}]({url}/{pull.author})) <!-- {pull.merged_at} -->') f'([{pull.author}]({url}/{pull.author})) <!-- {pull.merged_at} -->')
def format_release(pull_groups, release_as, release_to, release_from, date_to, def format_release(pull_groups, upgrade_notes, release_as, release_to,
date_from): release_from, date_to, date_from):
'Format release changelog heading and text.' 'Format release changelog heading and text.'
pull_url = f'https://github.com/{ORG}/{REPO}/pull'
if release_as: if release_as:
# if we're releasing date to is today # if we're releasing date to is today
date_to = datetime.date.today() date_to = datetime.date.today()
@@ -151,6 +153,13 @@ def format_release(pull_groups, release_as, release_to, release_from, date_to,
else: else:
buffer = [(f'## [{_strip_relname(release_to or release_as)}] - ' buffer = [(f'## [{_strip_relname(release_to or release_as)}] - '
f'{date_to.strftime("%Y-%m-%d")} {comment}')] f'{date_to.strftime("%Y-%m-%d")} {comment}')]
if upgrade_notes:
buffer.append('\n### BREAKING CHANGES\n')
for pr in upgrade_notes:
for note in pr.upgrade_notes:
buffer.append(f'- {note} [[#{pr.id}]({pull_url}/{pr.id})]')
buffer.append('')
for group in sorted(pull_groups.keys(), key=lambda s: s or ''): for group in sorted(pull_groups.keys(), key=lambda s: s or ''):
if group is not None: if group is not None:
buffer.append(f'### {group.upper()}\n') buffer.append(f'### {group.upper()}\n')
@@ -160,6 +169,22 @@ def format_release(pull_groups, release_as, release_to, release_from, date_to,
return '\n'.join(buffer) return '\n'.join(buffer)
def get_upgrade_notes(body):
notes = []
if body is None:
return notes
parser = marko.parser.Parser()
doc = parser.parse(body)
for child in doc.children:
if not isinstance(child, marko.block.FencedCode):
continue
if child.lang != "upgrade-note":
continue
note = child.children[0].children.strip(" \n\t")
notes.append(note)
return notes
def get_pulls(token, date_from, date_to, merged_to, exclude_pulls=None): def get_pulls(token, date_from, date_to, merged_to, exclude_pulls=None):
'Get and normalize pull requests from the Github API.' 'Get and normalize pull requests from the Github API.'
exclude_pulls = exclude_pulls exclude_pulls = exclude_pulls
@@ -172,12 +197,16 @@ def get_pulls(token, date_from, date_to, merged_to, exclude_pulls=None):
for r in pulls: for r in pulls:
pull_id = r['number'] pull_id = r['number']
merged_at = r['merged_at'] merged_at = r['merged_at']
body = r['body']
upgrade_notes = get_upgrade_notes(r['body'])
if merged_at is None: if merged_at is None:
unmerged += 1 unmerged += 1
continue continue
pull = PullRequest(pull_id, r['base']['ref'], r['user']['login'], pull = PullRequest(pull_id, r['base']['ref'], r['user']['login'],
r['title'], iso8601.parse_date(merged_at), r['title'], iso8601.parse_date(merged_at),
[l['name'].lower() for l in r['labels']]) [l['name'].lower() for l in r['labels']],
upgrade_notes)
if pull.id in exclude_pulls: if pull.id in exclude_pulls:
excluded += 1 excluded += 1
continue continue
@@ -321,8 +350,9 @@ def main(token, changelog_file='CHANGELOG.md', exclude_pull=None,
exclude_pull)) exclude_pull))
logging.info(f'number of pulls: {len(pulls)}') logging.info(f'number of pulls: {len(pulls)}')
pull_groups = group_pulls(pulls) pull_groups = group_pulls(pulls)
rel_changes = format_release(pull_groups, release_as, release_to, upgrade_notes = [pr for pr in pulls if pr.upgrade_notes]
release_from, date_to, date_from) rel_changes = format_release(pull_groups, upgrade_notes, release_as,
release_to, release_from, date_to, date_from)
if not write: if not write:
print(rel_changes) print(rel_changes)
raise SystemExit(0) raise SystemExit(0)