Skip to content

Conversation

@sm29105
Copy link

@sm29105 sm29105 commented Nov 7, 2025

fix(bedrock-agentcore-alpha): AssetImage artifact causes pipeline self-mutation on folder content change

Issue # (if applicable)

Closes #35968.

Reason for this change

When using an AssetImage based artifact for the runtime agent a change to the folder contents will change the asset's name which causes a CDK pipeline self-mutation.
This is unexpected behaviour and does not align with similar use-cases like image-based Lambda functions.

Description of changes

Remove MD5 hash component from the image asset's name - like e.g. the case for image assets for AWS Lambda functions

Describe any new or updated permissions being added

None

Description of how you validated changes

Manual test of solution with a company internal pipeline that showed the unexpected behaviour.

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team November 7, 2025 15:51
@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Nov 7, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@sm29105 sm29105 changed the title fix(bedrock-agentcore-alpha): AssetImage artifact causes pipeline sel… fix(bedrock-agentcore-alpha): AssetImage artifact causes pipeline sel… Nov 10, 2025
@sm29105
Copy link
Author

sm29105 commented Nov 10, 2025

Exemption Request:
Integration tests were actually updated.
For the implemented change only an update to the snapshots was required, not to the the test itself (just naming changed, names just tested via snapshot files).

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run and removed pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Nov 10, 2025
Copy link
Contributor

@mazyu36 mazyu36 left a comment

Choose a reason for hiding this comment

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

The change itself is LGTM.
Warnings are issued if changes to integ.*.ts are not included.
If you consider it unnecessary, it would be good to add an exemption request.

https://github.com/aws/aws-cdk/blob/main/tools/@aws-cdk/prlint/lint.ts#L394

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. and removed pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run labels Nov 12, 2025
@Abogical Abogical added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Nov 14, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review November 14, 2025 15:38

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Copy link
Member

@Abogical Abogical left a comment

Choose a reason for hiding this comment

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

Integ test can be exempted, but a simpler unit test to check the name will be needed. This is just to make sure that we don't change the naming behavior in the future.

@Abogical Abogical self-assigned this Nov 14, 2025
@sm29105
Copy link
Author

sm29105 commented Nov 14, 2025

Integ test can be exempted, but a simpler unit test to check the name will be needed. This is just to make sure that we don't change the naming behavior in the future.

Hi - not sure how to test this with a unit test. I'm absolutely no CDK developer (not even a TypeScript expert) - what I saw is that the interally created DockerImageAsset is a private member of the AssetImage and _render() does not expose the name so I can't check the name here. As the integration test snapshot were updated also a name change would break the integration test in the first moment.

If still an unit test is needed, I would need detailed advice how to do.

Thanks for understanding.

@mergify mergify bot dismissed Abogical’s stale review November 14, 2025 17:41

Pull request has been modified.

@Abogical
Copy link
Member

@sm29105

  • The list of unit tests are in runtime.test.ts. A single jest test case will only be needed to be added here.
  • The test case will only assert that the template's asset image name will not have the md5 and simply have the correct name. See how assertions are made here.

If you still need help, let us know.

Copy link
Member

@Abogical Abogical left a comment

Choose a reason for hiding this comment

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

See above, unit tests to be added.

@sm29105
Copy link
Author

sm29105 commented Nov 18, 2025

@sm29105

  • The list of unit tests are in runtime.test.ts. A single jest test case will only be needed to be added here.
  • The test case will only assert that the template's asset image name will not have the md5 and simply have the correct name. See how assertions are made here.

If you still need help, let us know.

@Abogical

Had a look and tried to figure out what to do but failed after 1h now. :(

As mentioned I don't know any dev internals of CDK or TypeScript - don't even know how to run tests locally or so.
Also not plan to become a CDK developer.
As the fix itself was straight-forward I offered to create the PR by myself, but cannot spend more time for digging into how exactly the testing mechanisms are working.

Can please somebody else take over? I would assume it takes 5 minutes for somebody that know what to touch.

Thanks for understanding ;)

@Abogical Abogical added the pr-linter/do-not-close The PR linter will not close this PR while this label is present label Nov 19, 2025
@Abogical
Copy link
Member

Ok no problem, I'll keep this PR open so anyone could take over.

@sm29105 sm29105 force-pushed the fix/bedrock-agentcore-alpha/pipeline-mutate branch from 1074a65 to 4dae263 Compare November 26, 2025 19:46
@alvazjor
Copy link
Contributor

alvazjor commented Dec 1, 2025

Hi @sm29105
Thanks for this initial step. I continued your PR here and added the unit tests. Will close this PR in favor of the new one
@Abogical feel free to review the new PR

@alvazjor alvazjor closed this Dec 1, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 pr-linter/do-not-close The PR linter will not close this PR while this label is present pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(bedrock-agentcore-alpha): image asset based runtime artifacts cause pipeline self-mutation

5 participants