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

fix: Fix SDK version metadata in UserAgent header #1775

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sichanyoo
Copy link
Contributor

@sichanyoo sichanyoo commented Sep 25, 2024

Issue #

1729

Description of changes

  • During prepare release, write the new current version to AWSClientRuntime/Resources/sdk-version.txt as well, and use that to initialize user agent middleware during runtime similar to how partitions data is loaded.

New/existing dependencies impact assessment, if applicable

Conventional Commits

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sichan Yoo added 2 commits September 24, 2024 17:03
…on.txt as well, and use that to initialize user agent middleware during runtime.
Comment on lines +168 to +175
if (repoType == .awsSdkSwift) {
try "\(newVersion)".write(
toFile: "Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Resources/sdk-version.txt",
atomically: true,
encoding: .utf8
)
log("Updated AWSClientRuntime/Resources/Package.version: \(newVersion)")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Non-Blocking: This may be the best solution but it gives me pause that we will be storing a duplicate of package.version in a sdk-version.txt. I understand the reasons for doing so but I wonder if there is either a better way or an opportunity for refactoring so that we only have a single file with the version.

Copy link
Contributor

@jbelkins jbelkins left a comment

Choose a reason for hiding this comment

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

I don't want to mix auto-generated files into AWSClientRuntime. That complicates our build/release pipeline.

I thought we had discussed using the contents of Package.version.next to write the version string into the client during codegen. Did that approach not work?

@sichanyoo
Copy link
Contributor Author

sichanyoo commented Oct 3, 2024

@jbelkins
I decided to take this route instead of using Package.version.next during codegen, after finding out that reading a file in Kotlin that's not placed under resources/ is tricky / dangerous. You can give it relative path or an absolute path of the file to read. Relative path gets resolved against where-ever the program was initiated from (e.g., from ~ if it was initiated from there, instead of project root). And as for absolute path, we don't have that available during codegen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants