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

feat(batch): add default AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set #21041

Merged
merged 41 commits into from
Jul 21, 2022
Merged

feat(batch): add default AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set #21041

merged 41 commits into from
Jul 21, 2022

Conversation

Dzhuneyt
Copy link
Contributor

@Dzhuneyt Dzhuneyt commented Jul 7, 2022

Closes #10952


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

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

Dzhuneyt and others added 9 commits January 31, 2022 14:49
…ion with `userDataCausesReplacement` (#18726)

If both `addSignalOnExitCommand` _and_ `userDataCausesReplacement` are
 used it results in an invalid logicalId being used in the
`cfn-signal` call. This is due to `addSignalOnExitCommand` getting the
logicalID from `Stack.getLogicalId` which does not take into
consideration logicalId overrides which `userDataCausesReplacement`
uses.

This updates `addSignalOnExitCommand` to use the `logicalId` of the
resource which is evaluated lazily and happens after all overrides.

fixes #12749


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@gitpod-io
Copy link

gitpod-io bot commented Jul 7, 2022

@github-actions github-actions bot added the p2 label Jul 7, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team July 7, 2022 18:21
@Dzhuneyt Dzhuneyt changed the title Dzhuneyt/issue 10952 aws batch env name feat: Add fallback AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set Jul 7, 2022
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. labels Jul 7, 2022
@Dzhuneyt Dzhuneyt changed the title feat: Add fallback AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set chore: Add fallback AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set Jul 7, 2022
@Dzhuneyt Dzhuneyt changed the title chore: Add fallback AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set feat: Add fallback AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set Jul 12, 2022
@Dzhuneyt Dzhuneyt changed the title feat: Add fallback AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set fix: Add fallback AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set Jul 12, 2022
@TheRealAmazonKendra
Copy link
Contributor

Thank you for your contribution! I'll wait on the build succeeding to do a thorough review here, but just a few quick comments while you're still making updates:

  1. Please see our contributing guide for formatting the title of PRs and for the information required in the body of the PR.
  2. It looks like you've debated about whether this is a chore, feat, or fix. I'd classify this as a feat.
  3. Some of the formatting updates you've done are great but most aren't necessary and make finding/reviewing the actual change much harder. Please either make those formatting changes as a separate PR or minimize them so we can focus on the change in functionality.
  4. I think there's a typo in the readme update. It doesn't quite make sense to me.

@Dzhuneyt Dzhuneyt changed the title fix: Add fallback AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set feat: add default AWS_ACCOUNT and AWS_REGION to Batch container, if they are not explicitly set Jul 13, 2022
Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Looks like other services integration tests are impacted by these changes. Please update those as well. Running a full build locally will help you identify each of those instances. It takes longer, but it will mean less churn.

@mergify mergify bot dismissed TheRealAmazonKendra’s stale review July 18, 2022 20:47

Pull request has been modified.

@Dzhuneyt
Copy link
Contributor Author

Thank you for all the patience @TheRealAmazonKendra! This is my first time doing a CDK contribution that involves writing integration tests, so I need some time to learn the ropes.

Hopefully, I can wrap up this PR in a day or two.

@TheRealAmazonKendra
Copy link
Contributor

Thank you for all the patience @TheRealAmazonKendra! This is my first time doing a CDK contribution that involves writing integration tests, so I need some time to learn the ropes.

Hopefully, I can wrap up this PR in a day or two.

We are more than happy both to have you as a contributor and to answer questions while you're figuring stuff out! If you have any questions about why certain tests are failing, feel free to ping me and I'll be more than happy to help troubleshoot. In this case, I see that it's because the expected values are hardcoded instead of being a reference to region and account. I'm pretty sure updating lines 11 and 15 in BatchDefaultEnvVarsStack.template.json and lines 50 and 54 in tree.json will get that test passing. I'm not sure if tests further down will then fail, though.

@Dzhuneyt
Copy link
Contributor Author

@TheRealAmazonKendra the build seems to succeed now. Again, thank you for being so patient on this. :)

return {
command: container.command,
environment: this.deserializeEnvVariables(container.environment),
environment,
Copy link
Contributor

Choose a reason for hiding this comment

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

So, I'm wondering if always having values here is a breaking change for customers currently using this. Breaking changes are OK in an experimental module, but I'm wondering if we should make setting these defaults an option in the props instead of just doing it 100% of the time. I'm also wondering if there are use cases where a user would want this undefined. I'm not super familiar with AWS Batch so I think I need to consult with others on this.

Copy link
Contributor Author

@Dzhuneyt Dzhuneyt Jul 21, 2022

Choose a reason for hiding this comment

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

I'm not 100% sure about this specific scenario, but generally speaking, from my experience - when we talk about breaking change in the code of some library - it's usually the removal of parameters, functions, classes, or a modification of their existing behavior, whereas additions of fields, parameters, methods are not considered a breaking change.

But again, that's just my perspective, looking at other libraries I've consumed in my projects as a developer. With CDK it's slightly different since we are considering not just the code but also things that users might have deployed using that code, and I realize it's a slightly more flavored and opinionated discussion.

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

After talking with the Batch team, I don't see any scenarios where this would cause an issue. Approving.

@mergify
Copy link
Contributor

mergify bot commented Jul 21, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: be06bff
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit eed854e into aws:main Jul 21, 2022
@mergify
Copy link
Contributor

mergify bot commented Jul 21, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@Dzhuneyt Dzhuneyt deleted the dzhuneyt/issue-10952-aws-batch-env-name branch July 22, 2022 15:51
comcalvi pushed a commit to comcalvi/aws-cdk that referenced this pull request Jul 25, 2022
…r, if they are not explicitly set (aws#21041)

Closes aws#10952

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [X] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [X] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
josephedward pushed a commit to josephedward/aws-cdk that referenced this pull request Aug 30, 2022
…r, if they are not explicitly set (aws#21041)

Closes aws#10952

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [X] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [X] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[batch] Pass AWS_REGION by default to containers
5 participants