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

sdk automation, fix changelog for mpg self-serve #44523

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 14 additions & 1 deletion eng/automation/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def sdk_automation_typespec(config: dict) -> List[dict]:

def sdk_automation_typespec_project(tsp_project: str, config: dict) -> dict:

# TODO(xiaofei) support changelog, etc
base_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
sdk_root = os.path.abspath(os.path.join(base_dir, SDK_ROOT))
spec_root = os.path.abspath(config["specFolder"])
Expand Down Expand Up @@ -272,14 +271,28 @@ def sdk_automation_typespec_project(tsp_project: str, config: dict) -> dict:
# compile
succeeded = compile_arm_package(sdk_root, module)
if succeeded:
logging.info("[Changelog] Start breaking change detection for SDK automation.")
breaking, changelog, breaking_change_items = compare_with_maven_package(
sdk_root,
GROUP_ID,
service,
get_latest_ga_version(GROUP_ID, module, stable_version),
current_version,
module,
False
)
logging.info("[Changelog] Complete breaking change detection for SDK automation.")
logging.info("[Changelog] Start generating changelog.")
compare_with_maven_package(
sdk_root,
GROUP_ID,
service,
get_latest_release_version(stable_version, current_version),
current_version,
module
)
update_changelog_version(sdk_root, output_folder, current_version)
logging.info("[Changelog] Complete generating changelog.")

# output
if sdk_folder and module and service:
Expand Down
4 changes: 2 additions & 2 deletions eng/automation/generate_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def update_changelog(changelog_file, changelog):


def compare_with_maven_package(
sdk_root: str, group_id: str, service: str, previous_version: str, current_version: str, module: str
sdk_root: str, group_id: str, service: str, previous_version: str, current_version: str, module: str, write_changelog: bool = True
):
breaking = False
changelog = ""
Expand Down Expand Up @@ -221,7 +221,7 @@ def compare_with_maven_package(
if not os.path.exists(new_jar):
raise Exception("Cannot found built jar in {0}".format(new_jar))
breaking, changelog, breaking_changes = generate_changelog_and_breaking_change(sdk_root, old_jar, new_jar)
if changelog is not None:
if changelog is not None and write_changelog:
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can always write_changelog? (is the False for automation from specs repo?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the False for automation from specs repo?

Yes.
Seems update_changelog will overwrite everything for the first version. Indeed we can always write changelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

changelog_file = os.path.join(sdk_root, CHANGELOG_FORMAT.format(service=service, artifact_id=module))
update_changelog(changelog_file, changelog)
else:
Expand Down
Loading