fix: Use posix path for dockerfile path passed to docker build API #5528
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.
Which issue(s) does this change fix?
#5345
Why is this change necessary?
When
sam build
is run for CDK projects on Windows for image-type functions with Dockerfile present in a nested directory, the command fails. Docker build API expects a posix path (with forward-slash) to be passed for dockerfile parameter but whensam build
is run for CDK on Windows, Windows format path (with backslash) is passed causing build image to fail. Non-CDK projects currently passes posix path fordockerfile
.resource_metadata_normalizer.py
is updated so thatdockerfile
path saved in build.toml is consistent with the value passed to docker API and with how non CDK templates saves this parameter.app_builder.py
is updated so that any new workflow callingbuild
passes a posix path and does not break this behavior in Windows.How does it address the issue?
Fixes the issue mentioned above
What side effects does this change have?
There should not be any side effects. Integration tests have been added to test the new behavior.
Mandatory Checklist
PRs will only be reviewed after checklist is complete
make pr
passesmake update-reproducible-reqs
if dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.