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

Unclear how to use different build-image values for sam build call #6961

Closed
hanninen opened this issue Apr 18, 2024 · 3 comments
Closed

Unclear how to use different build-image values for sam build call #6961

hanninen opened this issue Apr 18, 2024 · 3 comments
Labels

Comments

@hanninen
Copy link

hanninen commented Apr 18, 2024

I am not able to get the sam build command to parse correctly the values for different --build-image values using specific images for certain functions using their logical IDs and providing a default image.

The documentation from sam build --help describes that this is possible, but does not provide an example.

I try to use the following commands without success to get Function1 and Function2 builds to use nodejs18.x images and all other remaining functions to use the build-python3.8 image with specific versions of the images:

  • sam build --use-container --parallel --template template.yaml --build-image "public.ecr.aws/sam/build-python3.8:1.113,Function1=public.ecr.aws/sam/build-nodejs18.x:1.113,Function2=public.ecr.aws/sam/build-nodejs18.x:1.113"
  • sam build --use-container --parallel --template template.yaml --build-image "public.ecr.aws/sam/build-python3.8:1.113 Function1=public.ecr.aws/sam/build-nodejs18.x:1.113 Function2=public.ecr.aws/sam/build-nodejs18.x:1.113"

I've also tried to configure the build_image option in samconfig.toml with these variations without success.

Can you provide information what is the expected syntax for the CLI option & in samconfig.toml?

@hanninen hanninen added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Apr 18, 2024
@hnnasit
Copy link
Contributor

hnnasit commented Apr 18, 2024

Hi @hanninen, thanks for reporting the issue. You can try running the following commands:

  • sam build --use-container --parallel --template template.yaml --build-image Function1=public.ecr.aws/sam/build-nodejs18.x:1.113 --build-image Function2=public.ecr.aws/sam/build-nodejs18.x:1.113
  • sam build --use-container --parallel --template template.yaml --build-image public.ecr.aws/sam/build-nodejs18.x:1.113
  • Save the following line in the samconfig.toml file under [default.build.parameters]: build_image = ["Function1=public.ecr.aws/sam/build-nodejs18.x:1.113", "Function2=public.ecr.aws/sam/build-nodejs18.x:1.113"]

I have tested these commands on my machine and it was working fine. Let me know if you still face issues after trying the above commands.

@hnnasit hnnasit added type/question area/build sam build command and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Apr 18, 2024
@hanninen
Copy link
Author

Thanks @hnnasit , that helped a lot. The docs refer the build_image value as String and that confused me, thinking that I need to pass it as one (similar to AWS CLI).

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants