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(ecs): expose image name in container definition #17793

Merged
merged 9 commits into from
Feb 1, 2022

Conversation

jogold
Copy link
Contributor

@jogold jogold commented Dec 1, 2021

When adding a container to a task definition it is currently impossible to retrieve
its image name because it's the container definition that is responsible for binding
the AssetImage.

Expose the imageName so that it's possible to reference it in another construct
that needs to use/depend on the asset hash. Example: a custom resource running
a Fargate task that needs to rerun if the underlying container image changes but
not necessarily when the task definition changes.


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 Dec 1, 2021

@jogold jogold changed the title chore(ecs): exposer container image name chore(ecs): expose container image name Dec 1, 2021
@jogold jogold changed the title chore(ecs): expose container image name chore(ecs): expose image name in container definition Dec 1, 2021
@jogold jogold changed the title chore(ecs): expose image name in container definition chore(ecs): expose image name in container definition Dec 3, 2021
@jogold jogold changed the title chore(ecs): expose image name in container definition chore(ecs): expose image name in container definition Dec 3, 2021
@github-actions github-actions bot added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Dec 3, 2021
@madeline-k madeline-k changed the title chore(ecs): expose image name in container definition feat(ecs): expose image name in container definition Jan 20, 2022
@madeline-k madeline-k added the pr-linter/exempt-readme The PR linter will not require README changes label Jan 20, 2022
Copy link
Contributor

@madeline-k madeline-k left a comment

Choose a reason for hiding this comment

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

Thanks, @jogold!

});

// THEN
expect(stack.resolve(container.imageName)).toEqual({
Copy link
Contributor

Choose a reason for hiding this comment

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

The unit tests for this module have been migrated to Assertions since this PR was opened! Please merge the latest from master, and update this unit test. (Should be pretty minimal effort).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's nothing to update here, it's an expectation on stack.resolve().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mergify mergify bot dismissed madeline-k’s stale review January 21, 2022 06:45

Pull request has been modified.

@jogold jogold requested a review from madeline-k January 21, 2022 08:12
Copy link
Contributor

@madeline-k madeline-k left a comment

Choose a reason for hiding this comment

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

Approved 👍 Thanks, @jogold!

@mergify
Copy link
Contributor

mergify bot commented Jan 31, 2022

Thank you for contributing! Your pull request will be updated from master 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: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: a0618b0
  • 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 1947d7c into aws:master Feb 1, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 1, 2022

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

@jogold jogold deleted the ecs-container-image-name branch February 1, 2022 06:07
kornicameister added a commit to kornicameister/aws-cdk that referenced this pull request Feb 3, 2022
* origin/master: (74 commits)
  chore: remove reliance on `decdk` in build system (aws#18760)
  chore: add repository directory for all packages.json  (aws#17203)
  docs(ecs): correct comment documentation for NetworkMode (aws#17841)
  feat(ecs): expose image name in container definition (aws#17793)
  feat(ecr): add server-side encryption configuration  (aws#16966)
  chore(region-info): ap-southeast-3 (Jakarta) ROUTE_53_BUCKET_WEBSITE_ZONE_ID (aws#18110)
  chore: reassign njlynch's ownership areas (aws#18751)
  chore(ecs-service-extensions): migrate tests to assertions (aws#18649)
  chore(s3): Fixed documentation for `InventoryFormat.ORC` (aws#18717)
  feat(iot): add Action to republish MQTT messages to another MQTT topic (aws#18661)
  chore(rds): add support for PostgreSQL 14 (aws#18713)
  fix(core): correctly reference versionless secure parameters (aws#18730)
  fix(ec2): `UserData.addSignalOnExitCommand` does not work in combination with `userDataCausesReplacement` (aws#18726)
  fix(vpc): Vpc.fromLookup should throw if subnet group name tag is explicitly given and does not exist (aws#18714)
  docs(dynamodb): add note around table encryption (aws#18721)
  chore: override `markdown-it` version (aws#18723)
  docs(cfnspec): update CloudFormation documentation (aws#18741)
  chore(release): 1.142.0
  chore(lambda-layer-awscli): contains a CLI version with a CVE (aws#18727)
  chore(lambda-python): remove Pillow dependency (aws#18722)
  ...
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
When adding a container to a task definition it is currently impossible to retrieve
its image name because it's the container definition that is responsible for binding
the `AssetImage`.

Expose the `imageName` so that it's possible to reference it in another construct
that needs to use/depend on the asset hash. Example: a custom resource running
a Fargate task that needs to rerun if the underlying container image changes but
not necessarily when the task definition changes.

----

*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
@aws-cdk/aws-ecs Related to Amazon Elastic Container pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants