fix(container): only ensure build-context .dockerignore after the Dockerfile is validated#1749
Open
aidandaly24 wants to merge 1 commit into
Open
fix(container): only ensure build-context .dockerignore after the Dockerfile is validated#1749aidandaly24 wants to merge 1 commit into
aidandaly24 wants to merge 1 commit into
Conversation
…idated The preflight Container loop ran warnDeprecatedBaseImage and ensureBuildContextDockerignore unconditionally, so with buildContextPath set and a missing/typo'd Dockerfile it could write a stray .dockerignore into the repo on a failing deploy (and risk masking the friendly "Dockerfile not found" error). Guard both behind an else branch so they run only when the Dockerfile exists. Also reject a dockerfile value of "." in isValidDockerfilePath (names the build-context dir itself -> broken `docker build -f .`). Add tests: the preflight ordering guard (ensure skipped when Dockerfile missing), "." rejection, "./"-prefix acceptance, and the build-arg key >255 length bound (from the EnvVarNameSchema reuse).
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
Contributor
Package TarballHow to installgh release download pr-1749-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.24.0.tgz |
Contributor
Coverage Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #1284 (merged). In the deploy preflight
validateContainerAgentsloop,warnDeprecatedBaseImageandensureBuildContextDockerignoreran unconditionally after the DockerfileexistsSynccheck. WithbuildContextPathset and a missing/typo'd Dockerfile, preflight would write a.dockerignoreinto the build-context root even though the deploy aborts — dirtying the working tree on a failed deploy. Guard both behind anelsebranch so they run only once the Dockerfile is confirmed to exist.Also rejects a
dockerfilevalue of"."inisValidDockerfilePath(it names the build-context directory itself → a brokendocker build -f .), keeping the guard in lockstep with the sibling@aws/agentcore-cdkschema.Related Issue
Follow-up to #1284 (merged); no separate issue.
Documentation PR
N/A — no user-facing behavior change.
Type of Change
Testing
How have you tested the change?
npm run test:unitnpm run typechecknpm run lintAdded tests: the preflight ordering guard (ensure is skipped when the Dockerfile is missing),
"."rejection,"./"-prefix acceptance, and the build-arg key length bound.Checklist