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

Override codegen version commit hash in PR diffs #1636

Merged
merged 2 commits into from
Aug 17, 2022

Conversation

unexge
Copy link
Contributor

@unexge unexge commented Aug 16, 2022

Motivation and Context

After #1621 we started inserting codegen versions to generated packages. Those versions also include git commit hash and that causes PR Bot to generate diffs for every PR even when there are no changes in generated packages (example). In order to prevent that we want to have a fixed commit hash while generating diffs for generated packages.

Description

This PR allows overriding commit hash used in codegen versions via SMITHY_RS_VERSION_COMMIT_HASH_OVERRIDE env variable. We provide that value in PR Bot to fix commit hash used in PR Bot diffs.

Testing

You can provide that env variable while generating packages to see whether codegen version is changed.

$ cd rust-runtime/aws-smithy-http-server/examples
$ SMITHY_RS_VERSION_COMMIT_HASH_OVERRIDE=test make
$ rg -B1 -u codegen-version
pokemon-service-client/Cargo.toml
9-[package.metadata.smithy]
10:codegen-version = "0.47.0-test"

pokemon-service-server-sdk/Cargo.toml
9-[package.metadata.smithy]
10:codegen-version = "0.47.0-test"

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@unexge unexge requested a review from a team as a code owner August 16, 2022 11:12
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@unexge
Copy link
Contributor Author

unexge commented Aug 16, 2022

I had to move env variable to shell script because env variables in GitHub action is not propagated to script. Could you please review it again?

@unexge unexge requested review from crisidev and Velfi August 16, 2022 15:29
@jdisanti
Copy link
Collaborator

I had to move env variable to shell script because env variables in GitHub action is not propagated to script. Could you please review it again?

This is because the diff script is run inside the build Docker image. Another way you could approach this is have the execution of gradle from within the script set the environment variable.

@unexge unexge force-pushed the unexge/hardcode-commit-in-version-for-pr-diffs branch from 14a40cb to 088ab65 Compare August 17, 2022 09:22
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@unexge unexge merged commit 7731b3f into main Aug 17, 2022
@unexge unexge deleted the unexge/hardcode-commit-in-version-for-pr-diffs branch August 17, 2022 10:24
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.

4 participants