-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Skip Docker Lambda image builds when ImageUri is a valid ECR location #2934
Comments
Going to review the PR ;) |
Hello there @qingchm @sriram-mv, regarding this issue and PR#2935, came across some integrations problems; didn't want to open a new issue. Description:As discussed above, the proposed solution fixes problems occurring in
However, attempting to deploy such a template will likely output a validation error, ...and the user will still be prompt with an image repository argument using the Steps to reproduce:
Without specifying any option, or
Observed result:Respectively,
Expected result:Both the validation and the prompt should be ignored for this kind of functions. Issue as been traced to Proposal:Will open a PR shortly regarding this integration issue. As |
* fix lambda ECR image build/validation/deploy: - change guided context to only prompt image-repository option for buildable, packageable lambda images; - change CLI 'image-repository' 'image-repositories' option validation to only check the template for buildable, packageable lambda images.
* fix lambda ECR image build/validation/deploy: - change guided context to only prompt image-repository option for buildable, packageable lambda images; - change CLI 'image-repository' 'image-repositories' option validation to only check the template for buildable, packageable lambda images.
* chore: Increase awareness of same file warning during package (#2946) * chore: increase awareness of same file warning during package * fix formatting & grammar Co-authored-by: Mathieu Grandis <[email protected]> * fix: Allow the base64Encoded field in REST Api, skip validation of unknown fields and validate missing statusCode for Http Api (#2941) * fix API Gateway emulator: - skip validating the non allowed fields for Http Api Gateway, as it always skip the unknown fields - add base64Encoded as an allowed field for Rest Api gateway - base64 decoding will be always done for Http API gateway if the lambda response isBase64Encoded is true regardless the content-type - validate if statusCode is missing in case of Http API, and payload version 1.0 * - accept "true", "True", "false", "False" as valid isBase64Encoded values. - Validate on other isBase64Encoded Values - add more integration && unit test cases * fix lint && black issues * use smaller image to test Base64 response * fix: pass copy of environment variables for keeping cache valid (#2943) * fix: pass copy of environment variables for keeping cache valid * add integ tests * update docs * make black happy Co-authored-by: Qingchuan Ma <[email protected]> * fix: Skip build of Docker image if ImageUri is a valid ECR URL (#2934) (#2935) * Add condition to managed bucket policy (#2999) * Update appveyor.yml to do docker login on both dockerhub and Public ECR (#3005) (#3006) Co-authored-by: Wing Fung Lau <[email protected]> * chore: bump version to 1.25.0 (#3007) Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> * temp: reduce python testing matrix (#3008) * temp: disable testing against python 3.8, and enabled 3.7 (#3009) * temp: disable testing against python 3.8, and enabled 3.7 * temp: disable testing against python 3.8, and enabled 3.7 & 3.6 * fix: enable all runtimes in python testing matrix (#3011) * revert: enable all runtimes in python testing matrix * fix indentation for yml * chore: update to aws-sam-translator 1.37.0 (#3019) * chore: bump version to 1.26.0 (#3020) * chore: Improved --resolve-s3 option documentation and deployment without s3 error messages (#2983) * Improve documentation on --resolve-s3 option and improve s3 failure messages * Changed indentation for integration test on s3 error message * Fixed a typo in description * Improve spacing on help text for resolve-s3 option Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Mathieu Grandis <[email protected]> Co-authored-by: Mohamed Elasmar <[email protected]> Co-authored-by: Qingchuan Ma <[email protected]> Co-authored-by: Alexis Facques <[email protected]> Co-authored-by: Wing Fung Lau <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]>
* Added ecr_bootstrap * Added companion_stack_manager * Added Companion Stack Manager * Added update_companion_stack * Updated companion_stack_builder File Name * Formatted with Black * Updated get_unreferenced_repos * Updated guided_context to Use Companion Stack * Added Delete Auto Create ECR Repo Prompt * Updated prompt_image_repository Flow * Added --resolve-image-repos * Addressed Some of Pylint Issues * Updated Helper Text * Updated Comments * Fixed Typing * Removed Unused Imports * Updated Unit Tests * Updated UX and Fixed Windows ANSI * Updated Unit Tests * Fixed Import Order * Added Ignore Import Check * Added Integration Tests * Updated help text. Co-authored-by: Chris Rehn <[email protected]> * Added Comments for Name Generation * Updated Image Option Validator * Updated CompanionStackBuilder to Use Dict instead of String * Fixed Argument Ordering * Added Mapping Information to Help Text * Updated delete_unreferenced_repos Doc String * Updated sync_repos Doc String * Added Justification for ECR Repo Physical ID * Refactored to be Less Coupled * Refactored for prompt_specify_repos * Fixed Unit Test * Moved WaiterConfig Out of Methods * Updated Typing * Updated Managed S3 Template to be Dict * Fixed Typo * Added Comments for _save_image_repositories * Fixed Pylint Issue * Added Missing Check for unreferenced_repo_uris * Updated Variable Name * Fixed Typo * Updated Windows Check to Use platform.system() * Updated update_companion_stack Logic * Fixed Comment Typo * Fixed Typos * Fixed Test Name * Added methods for cf and s3 files and init UI * Added unit tests for utils methods and s3_uploader * Removed s3_bucket and s3_prefix click options * chore: Increase awareness of same file warning during package (#2946) * chore: increase awareness of same file warning during package * fix formatting & grammar Co-authored-by: Mathieu Grandis <[email protected]> * fix: Allow the base64Encoded field in REST Api, skip validation of unknown fields and validate missing statusCode for Http Api (#2941) * fix API Gateway emulator: - skip validating the non allowed fields for Http Api Gateway, as it always skip the unknown fields - add base64Encoded as an allowed field for Rest Api gateway - base64 decoding will be always done for Http API gateway if the lambda response isBase64Encoded is true regardless the content-type - validate if statusCode is missing in case of Http API, and payload version 1.0 * - accept "true", "True", "false", "False" as valid isBase64Encoded values. - Validate on other isBase64Encoded Values - add more integration && unit test cases * fix lint && black issues * use smaller image to test Base64 response * Fixed lint errors and added few unit tests * Make black happy * Added methods for deleting template artifacts * Wait method added for delete cf api * fix: pass copy of environment variables for keeping cache valid (#2943) * fix: pass copy of environment variables for keeping cache valid * add integ tests * update docs * make black happy Co-authored-by: Qingchuan Ma <[email protected]> * Added LOG statements * Added and updated changes based on CR * Fixed the unit tests in artifact_exporter.py * Update HELP_TEXT in delete/command.py Co-authored-by: Chris Rehn <[email protected]> * fix: Skip build of Docker image if ImageUri is a valid ECR URL (#2934) (#2935) * Updated code based on Chris' comments * Added condition for resources that have deletionpolicy specified * Small changes and fixes based on the comments * Add condition to managed bucket policy (#2999) * Removed region prompt * Update appveyor.yml to do docker login on both dockerhub and Public ECR (#3005) (#3006) Co-authored-by: Wing Fung Lau <[email protected]> * chore: bump version to 1.25.0 (#3007) Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> * temp: reduce python testing matrix (#3008) * temp: disable testing against python 3.8, and enabled 3.7 (#3009) * temp: disable testing against python 3.8, and enabled 3.7 * temp: disable testing against python 3.8, and enabled 3.7 & 3.6 * fix: enable all runtimes in python testing matrix (#3011) * revert: enable all runtimes in python testing matrix * fix indentation for yml * Added unit tests for ecr delete method and typing for methods * Reformatted delete_context and added option to skip user prompts * Removed return type from artifact_exporter for delete method * Added unit tests for artifact_exporter and delete_context * Added more unit tests for delete_context and artifact_exporter * chore: update to aws-sam-translator 1.37.0 (#3019) * chore: bump version to 1.26.0 (#3020) * Added more unit tests for delete_context and artifact_exporter * Added docs and comments for artifact_exporter and ecr_uploader * Added log statements in delete_context and some updates in unit tests * Changed force to no-prompts and updated ecr delete method error handling * chore: Improved --resolve-s3 option documentation and deployment without s3 error messages (#2983) * Improve documentation on --resolve-s3 option and improve s3 failure messages * Changed indentation for integration test on s3 error message * Fixed a typo in description * Improve spacing on help text for resolve-s3 option * Created a separate function for parsing ecr url in ecr_uploader * Reformatted Template class init to pass template_str and init template_dict * Changed how s3 url is obtained for resource_zip edge-case: aws:glue:job * Fixed edge case where resource artifact points to a path style url * run Make black * Made the parse s3 url funcs protected and defined a parent method and modified delete method for ResourceImageDict * Changed parse_ecr_url function name to parse_image_url * Defined UI for auto ecr deleton and method calls from companion_stack_manager * Added code for deleting repos from companion stack * Handle json templates deployed to cf * Changed the order of companion stack and ecr repos deletion * Handle delete_failed status for ecr companion stack and changed delete_stack to include retain_resources * Reformatted auto ecr deletion to handle deleting companion stack as input stack name * Fixed and added more unit tests for delete_context * When region is not provided, prompt user to enter profile and region * Removed region prompt and reading it from current session or assign a default instead * Added ECR resource in packageable_resources and refactored ecr companion stack deletion * Added log statements and unit tests for ECRResource * Better error handling for ecr delete_artifact * Revert "Merge remote-tracking branch 'wiltons-repo/feat/auto-ecr' into auto-ecr-delete" This reverts commit 0e159c2, reversing changes made to 1675b7e. * Added unit test for delete ecr repository * Fixed small string nits and added docstring for ECRResource * Added some unit tests for s3_uploader, ecr_uploader and delete_context * Updated to context refresh only when region and profile have non None values and removed unused class variable in delete_context * Added unit test for ResourceImageDict class methods Co-authored-by: Wilton Wang <[email protected]> Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Mathieu Grandis <[email protected]> Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Mohamed Elasmar <[email protected]> Co-authored-by: Qingchuan Ma <[email protected]> Co-authored-by: Alexis Facques <[email protected]> Co-authored-by: Wing Fung Lau <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]>
* Added ecr_bootstrap * Added companion_stack_manager * Added Companion Stack Manager * Added update_companion_stack * Updated companion_stack_builder File Name * Formatted with Black * Updated get_unreferenced_repos * Updated guided_context to Use Companion Stack * Added Delete Auto Create ECR Repo Prompt * Updated prompt_image_repository Flow * Added --resolve-image-repos * Addressed Some of Pylint Issues * Updated Helper Text * Updated Comments * Fixed Typing * Removed Unused Imports * Updated Unit Tests * Updated UX and Fixed Windows ANSI * Updated Unit Tests * Fixed Import Order * Added Ignore Import Check * Added Integration Tests * Updated help text. Co-authored-by: Chris Rehn <[email protected]> * Added Comments for Name Generation * Updated Image Option Validator * Updated CompanionStackBuilder to Use Dict instead of String * Fixed Argument Ordering * Added Mapping Information to Help Text * Updated delete_unreferenced_repos Doc String * Updated sync_repos Doc String * Added Justification for ECR Repo Physical ID * Refactored to be Less Coupled * Refactored for prompt_specify_repos * Fixed Unit Test * Moved WaiterConfig Out of Methods * Updated Typing * Updated Managed S3 Template to be Dict * Fixed Typo * Added Comments for _save_image_repositories * Fixed Pylint Issue * Added Missing Check for unreferenced_repo_uris * Updated Variable Name * Fixed Typo * Updated Windows Check to Use platform.system() * Updated update_companion_stack Logic * Fixed Comment Typo * Fixed Typos * Fixed Test Name * Added methods for cf and s3 files and init UI * Added unit tests for utils methods and s3_uploader * Removed s3_bucket and s3_prefix click options * chore: Increase awareness of same file warning during package (#2946) * chore: increase awareness of same file warning during package * fix formatting & grammar Co-authored-by: Mathieu Grandis <[email protected]> * fix: Allow the base64Encoded field in REST Api, skip validation of unknown fields and validate missing statusCode for Http Api (#2941) * fix API Gateway emulator: - skip validating the non allowed fields for Http Api Gateway, as it always skip the unknown fields - add base64Encoded as an allowed field for Rest Api gateway - base64 decoding will be always done for Http API gateway if the lambda response isBase64Encoded is true regardless the content-type - validate if statusCode is missing in case of Http API, and payload version 1.0 * - accept "true", "True", "false", "False" as valid isBase64Encoded values. - Validate on other isBase64Encoded Values - add more integration && unit test cases * fix lint && black issues * use smaller image to test Base64 response * Fixed lint errors and added few unit tests * Make black happy * Added methods for deleting template artifacts * Wait method added for delete cf api * fix: pass copy of environment variables for keeping cache valid (#2943) * fix: pass copy of environment variables for keeping cache valid * add integ tests * update docs * make black happy Co-authored-by: Qingchuan Ma <[email protected]> * Added LOG statements * Added and updated changes based on CR * Fixed the unit tests in artifact_exporter.py * Update HELP_TEXT in delete/command.py Co-authored-by: Chris Rehn <[email protected]> * fix: Skip build of Docker image if ImageUri is a valid ECR URL (#2934) (#2935) * Updated code based on Chris' comments * Added condition for resources that have deletionpolicy specified * Small changes and fixes based on the comments * Add condition to managed bucket policy (#2999) * Removed region prompt * Update appveyor.yml to do docker login on both dockerhub and Public ECR (#3005) (#3006) Co-authored-by: Wing Fung Lau <[email protected]> * chore: bump version to 1.25.0 (#3007) Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> * temp: reduce python testing matrix (#3008) * temp: disable testing against python 3.8, and enabled 3.7 (#3009) * temp: disable testing against python 3.8, and enabled 3.7 * temp: disable testing against python 3.8, and enabled 3.7 & 3.6 * fix: enable all runtimes in python testing matrix (#3011) * revert: enable all runtimes in python testing matrix * fix indentation for yml * Added unit tests for ecr delete method and typing for methods * Reformatted delete_context and added option to skip user prompts * Removed return type from artifact_exporter for delete method * Added unit tests for artifact_exporter and delete_context * Added more unit tests for delete_context and artifact_exporter * chore: update to aws-sam-translator 1.37.0 (#3019) * chore: bump version to 1.26.0 (#3020) * Added more unit tests for delete_context and artifact_exporter * Added docs and comments for artifact_exporter and ecr_uploader * Added log statements in delete_context and some updates in unit tests * Changed force to no-prompts and updated ecr delete method error handling * chore: Improved --resolve-s3 option documentation and deployment without s3 error messages (#2983) * Improve documentation on --resolve-s3 option and improve s3 failure messages * Changed indentation for integration test on s3 error message * Fixed a typo in description * Improve spacing on help text for resolve-s3 option * Created a separate function for parsing ecr url in ecr_uploader * Reformatted Template class init to pass template_str and init template_dict * Changed how s3 url is obtained for resource_zip edge-case: aws:glue:job * Fixed edge case where resource artifact points to a path style url * run Make black * Made the parse s3 url funcs protected and defined a parent method and modified delete method for ResourceImageDict * Changed parse_ecr_url function name to parse_image_url * Defined UI for auto ecr deleton and method calls from companion_stack_manager * Added code for deleting repos from companion stack * Handle json templates deployed to cf * Changed the order of companion stack and ecr repos deletion * Handle delete_failed status for ecr companion stack and changed delete_stack to include retain_resources * Reformatted auto ecr deletion to handle deleting companion stack as input stack name * Fixed and added more unit tests for delete_context * When region is not provided, prompt user to enter profile and region * Removed region prompt and reading it from current session or assign a default instead * Added ECR resource in packageable_resources and refactored ecr companion stack deletion * Added log statements and unit tests for ECRResource * Better error handling for ecr delete_artifact * Revert "Merge remote-tracking branch 'wiltons-repo/feat/auto-ecr' into auto-ecr-delete" This reverts commit 0e159c2, reversing changes made to 1675b7e. * Added unit test for delete ecr repository * Fixed small string nits and added docstring for ECRResource * Added some unit tests for s3_uploader, ecr_uploader and delete_context * feat: Add SAM Pipeline commands (#3085) * sam pipeline bootstrap (#2811) * two-stages-pipeline plugin * typos * add docstring * make mypy happy * removing swap file * delete the two_stages_pipeline plugin as the pipeline-bootstrap command took over its responsibility * remove 'get_template_function_runtimes' function as the decision is made to not process the SAM template during pipeline init which was the only place we use the function * sam pipeline bootstrap command * move the pipelineconfig.toml file to .aws-sam * UX - rewriting Co-authored-by: Chris Rehn <[email protected]> * UX improvements * make black happy * apply review comments * UX - rewriting Co-authored-by: Chris Rehn <[email protected]> * refactor * Apply review comments * use python way of array elements assignments * Update samcli/lib/pipeline/bootstrap/stage.py Co-authored-by: _sam <[email protected]> * apply review comments * typo * read using utf-8 * create and user a safe version of the save_config method * apply review comments * rename _get_command_name to _get_command_names * don't save generated ARNs for now, will save during init * Revert "don't save generated ARNs for now, will save during init" This reverts commit d184e16. * Notify the user to rotate periodically rotate the IAM credentials * typo * Use AES instead of KMS for S3 SSE * rename Ecr to ECR and Iam to IAM * Grant lambda service explicit permissions to thhe ECR instead of relying on giving this permissions on ad-hoc while creating the container images Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: _sam <[email protected]> * sam pipeline init command (#2831) * sam pipeline init command * apply review comments * apply review comments * display a message that we have successfully created the pipeline configuration file(s). * doc typo * Let 'sam pipeline init' prefills pipeline's infrastructure resources… (#2894) * Let 'sam pipeline init' prefills pipeline's infrastructure resources' values from 'sam pipeline bootstrap' results. * save bootstrapped sateg region * make black happy * exclude non-dict keys from samconfig.get_env_names method. * Rename the pipeline 'Stage' concept to 'Environment' (#2908) * Rename the pipeline 'Stage' concept to 'Environment' * typo * Rename --environment-name argument to --environment * Sam pipelines ux rename ecr repo to image repository (#2910) * Rename ecr-repo to image-repository * UT Fixes * typo * typo * feat: Support creating pipeline files directly into . without hooks (#2911) * feat: Support creating pipeline files directly into . without hooks * Integration test for pipeline init and pipeline bootstrap (#2841) * Expose Environment._get_stack_name for integ test to predict stack name * Add integ test for pipeline bootstrap * Add init integ test * small UX improvements: (#2914) * small UX improvements: 1. show a message when the user cancels a bootstrapping command. 2. Don't prompt for CI/CD provider or provider templates if there is only one choice. 3. Make PipelineFileAlreadyExistsError a UserError. 4. use the Colored class instead of fg='color' when prompting a colored message. 5. Fix a bug where we were not allowing empty response for not required questions. * Fix Integration Test: We now don't ask the user to select a provider's pipeline template if there is only one * Add docs for PipelineFileAlreadyExistsError * make black happy * Sam pipelines s3 security (#2975) * Deny non https requests for the artifacts S3 bucket * enable bucket serverside logging * add integration tests for artifacts bucket SSL-only requests and access logging * typo * Ensure the ArtifactsLoggingBucket denies non ssl requests (#2976) * Sam pipelines ux round 3 (#2979) * rename customer facing message 'CI/CD provider' to 'CI/CD system' * add a note about what 'Environment Name' is during the pipeline bootstrap guided context * Apply suggestions from code review typo Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Chris Rehn <[email protected]> * let pipeline IAM user assume only IAM roles tagged with Role=pipeline-execution-role (#2982) * Adding AWS_ prefix to displayed out. (#2993) Co-authored-by: Tarun Mall <[email protected]> * Add region to pipeline bootstrap interactive flow (#2997) * Ask AWS region in bootstrap interactive flow * Read default region from boto session first * Fix a unit test * Inform write to pipelineconfig.toml at the end of bootstrap (#3002) * Print info about pipelineconfig.toml after resources are bootstrapped * Update samcli/commands/pipeline/bootstrap/cli.py Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Chris Rehn <[email protected]> * List detected env names in pipeline init when prompt to input the env name (#3000) * Allow question.question can be resolved using key path * Pass the list of env names message (environment_names_message) into pipeline init interactive flow context * Update samcli/commands/pipeline/init/interactive_init_flow.py Co-authored-by: Chris Rehn <[email protected]> * Fix unit test (trigger pr builds) * Fix integ test * Fix integ test Co-authored-by: Chris Rehn <[email protected]> * Adding account id to bootstrap message. (#2998) * Adding account id to bootstrap message. * adding docstring * Addressing PR comments. * Adding unit tests. * Fixing unit tests. Co-authored-by: Tarun Mall <[email protected]> * Cfn creds fix (#3014) * Removing pipeline user creds from cfn output. This maintains same user exp. Co-authored-by: Tarun Mall <[email protected]> * Ux bootstrap revamp 20210706 (#3021) * Add intro paragraph to bootstrap * Add switch account prompt * Revamp stage definition prompt * Revamp existing resources prompt * Revamp security prompt * Allow answers to be changed later * Add exit message for bootstrap * Add exit message for bootstrap (1) * Add indentation to review values * Add "Below is the summary of the answers:" * Sweep pylint errors * Update unit tests * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/cli.py Co-authored-by: Chris Rehn <[email protected]> * Update unit tests * Add bold to other literals Co-authored-by: Chris Rehn <[email protected]> * Adding account condition for CFN execution role. (#3027) Co-authored-by: Tarun Mall <[email protected]> * pipeline UX revamp 20210707 (#3031) * Allow running bootstrap inside pipeline init * Select account credential source within bootstrap * Add bootstrap decorations within pipeline init * Removing ip range option from bootstrap. (#3036) * Removing ip range option from bootstrap. * Fixing unit test from UX PR. Co-authored-by: Tarun Mall <[email protected]> * Fix toml file incorrect read/write in init --bootstrap (#3037) * Temporarily removing account fix. (#3038) Co-authored-by: Tarun Mall <[email protected]> * Rename environment to stage (#3040) * Improve account source selection (#3042) * Fixing various cosmetics UX issues with pipeline workflow. (#3046) * Fixing credential to credentials * Forcing text color to yellow. * Adding new line after stage diagram. * Adding extra line after checking bootstrap message. * Renaming config -> configuration * account source -> credential source * Removing old message. * Fixing indentation in list. * Fixing bunch of indentation. * fixing f string Co-authored-by: Tarun Mall <[email protected]> * Auto skip questions if stage detected (#3045) * Autofill question if default value is presented * Allow to use index to select stage names (#3051) * Updating message when bootstrap stages are missing. (#3058) * Updating message when bootstrap stages are missing. * Fixing indendation Co-authored-by: Tarun Mall <[email protected]> * Fixing bootstrap integ tests. (#3061) * Fixing bootstrap integ tests. * Cleaning up some integ tests. * Using environment variables when running integ test on CI. * Using expression instead of full loop. * Adding instruction to use default profile on local. Co-authored-by: Tarun Mall <[email protected]> * Fix bootstrap test region (#3064) * Fix bootstrap region in integ test * Fix regions in non-interactive mode as well * Add more pipeline init integ test (#3065) * Fix existing pipeline init integ test * Add more pipeline init integ tests * Config file bug (#3066) * Validating config file after bootstrap stack creation. * Validating config file after bootstrap. Co-authored-by: Tarun Mall <[email protected]> * Fix pipeline init integ test because of pipelineconfig file exists (#3067) * Make stage name randomized to avoid race condition among multi canary runs (#3078) * Load number of stages from pipeline template (#3059) * Load number of stages from templates * Rename variable and add debug log * Add encoding to open() * Allow roles with Tag aws-sam-pipeline-codebuild-service-role to assume PipelineExecutionRole (#2950) * pipeline init UX: Ask to confirm when file exists (#3079) * Ask to confirm overriding if files already exist, or save to another directory * Add doc links (#3087) * Adding accidentally removed tests back. (#3088) Co-authored-by: Tarun Mall <[email protected]> Co-authored-by: elbayaaa <[email protected]> Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Ahmed Elbayaa <[email protected]> Co-authored-by: Tarun <[email protected]> Co-authored-by: Tarun Mall <[email protected]> * chore: bump aws-lambda-builder version to 1.5.0 (#3086) * chore: update to aws-sam-translator 1.38.0 (#3073) * Updated to context refresh only when region and profile have non None values and removed unused class variable in delete_context * Added unit test for ResourceImageDict class methods * ci: Update expected Jenkins file in pipeline integ test (#3090) * chore: Refine pipeline help text and update unit test (#3091) * Update --bucket help text * Update --stage help text * Update help text * Update help text * Update help text * Update help text * Update help text * Update jenkins generated files * Update some intro texts * Remove trialing spaces * Clearing pipeline integ test buckets with versioned objects. (#3094) * Clearing pipeline integ test buckets with versioned objects. * Fixing black formatting. Co-authored-by: Tarun Mall <[email protected]> * Fixing bug in bucket cleanup. (#3096) Co-authored-by: Tarun Mall <[email protected]> * Deleting bucket (#3097) Co-authored-by: Tarun Mall <[email protected]> * Revert "temp: disable testing against python 3.8, and enabled 3.7 (#3009)" (#3098) This reverts commit fe83218. Co-authored-by: Tarun Mall <[email protected]> * chore: bump SAM CLI version to 1.27.0 (#3101) * Add pipeline to pyinstaller (#3103) * Adding pipeline to pyinstaller. Co-authored-by: Tarun Mall <[email protected]> Co-authored-by: Wilton Wang <[email protected]> Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Mathieu Grandis <[email protected]> Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Mohamed Elasmar <[email protected]> Co-authored-by: Qingchuan Ma <[email protected]> Co-authored-by: Alexis Facques <[email protected]> Co-authored-by: Wing Fung Lau <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> Co-authored-by: _sam <[email protected]> Co-authored-by: elbayaaa <[email protected]> Co-authored-by: Ahmed Elbayaa <[email protected]> Co-authored-by: Tarun <[email protected]> Co-authored-by: Tarun Mall <[email protected]> Co-authored-by: Raymond Wang <[email protected]>
* chore: Increase awareness of same file warning during package (#2946) * chore: increase awareness of same file warning during package * fix formatting & grammar Co-authored-by: Mathieu Grandis <[email protected]> * fix: Allow the base64Encoded field in REST Api, skip validation of unknown fields and validate missing statusCode for Http Api (#2941) * fix API Gateway emulator: - skip validating the non allowed fields for Http Api Gateway, as it always skip the unknown fields - add base64Encoded as an allowed field for Rest Api gateway - base64 decoding will be always done for Http API gateway if the lambda response isBase64Encoded is true regardless the content-type - validate if statusCode is missing in case of Http API, and payload version 1.0 * - accept "true", "True", "false", "False" as valid isBase64Encoded values. - Validate on other isBase64Encoded Values - add more integration && unit test cases * fix lint && black issues * use smaller image to test Base64 response * fix: pass copy of environment variables for keeping cache valid (#2943) * fix: pass copy of environment variables for keeping cache valid * add integ tests * update docs * make black happy Co-authored-by: Qingchuan Ma <[email protected]> * fix: Skip build of Docker image if ImageUri is a valid ECR URL (#2934) (#2935) * Add condition to managed bucket policy (#2999) * Update appveyor.yml to do docker login on both dockerhub and Public ECR (#3005) (#3006) Co-authored-by: Wing Fung Lau <[email protected]> * chore: bump version to 1.25.0 (#3007) Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> * temp: reduce python testing matrix (#3008) * temp: disable testing against python 3.8, and enabled 3.7 (#3009) * temp: disable testing against python 3.8, and enabled 3.7 * temp: disable testing against python 3.8, and enabled 3.7 & 3.6 * fix: enable all runtimes in python testing matrix (#3011) * revert: enable all runtimes in python testing matrix * fix indentation for yml * chore: update to aws-sam-translator 1.37.0 (#3019) * chore: bump version to 1.26.0 (#3020) * chore: Improved --resolve-s3 option documentation and deployment without s3 error messages (#2983) * Improve documentation on --resolve-s3 option and improve s3 failure messages * Changed indentation for integration test on s3 error message * Fixed a typo in description * Improve spacing on help text for resolve-s3 option * feat: Add SAM Pipeline commands (#3085) * sam pipeline bootstrap (#2811) * two-stages-pipeline plugin * typos * add docstring * make mypy happy * removing swap file * delete the two_stages_pipeline plugin as the pipeline-bootstrap command took over its responsibility * remove 'get_template_function_runtimes' function as the decision is made to not process the SAM template during pipeline init which was the only place we use the function * sam pipeline bootstrap command * move the pipelineconfig.toml file to .aws-sam * UX - rewriting Co-authored-by: Chris Rehn <[email protected]> * UX improvements * make black happy * apply review comments * UX - rewriting Co-authored-by: Chris Rehn <[email protected]> * refactor * Apply review comments * use python way of array elements assignments * Update samcli/lib/pipeline/bootstrap/stage.py Co-authored-by: _sam <[email protected]> * apply review comments * typo * read using utf-8 * create and user a safe version of the save_config method * apply review comments * rename _get_command_name to _get_command_names * don't save generated ARNs for now, will save during init * Revert "don't save generated ARNs for now, will save during init" This reverts commit d184e16. * Notify the user to rotate periodically rotate the IAM credentials * typo * Use AES instead of KMS for S3 SSE * rename Ecr to ECR and Iam to IAM * Grant lambda service explicit permissions to thhe ECR instead of relying on giving this permissions on ad-hoc while creating the container images Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: _sam <[email protected]> * sam pipeline init command (#2831) * sam pipeline init command * apply review comments * apply review comments * display a message that we have successfully created the pipeline configuration file(s). * doc typo * Let 'sam pipeline init' prefills pipeline's infrastructure resources… (#2894) * Let 'sam pipeline init' prefills pipeline's infrastructure resources' values from 'sam pipeline bootstrap' results. * save bootstrapped sateg region * make black happy * exclude non-dict keys from samconfig.get_env_names method. * Rename the pipeline 'Stage' concept to 'Environment' (#2908) * Rename the pipeline 'Stage' concept to 'Environment' * typo * Rename --environment-name argument to --environment * Sam pipelines ux rename ecr repo to image repository (#2910) * Rename ecr-repo to image-repository * UT Fixes * typo * typo * feat: Support creating pipeline files directly into . without hooks (#2911) * feat: Support creating pipeline files directly into . without hooks * Integration test for pipeline init and pipeline bootstrap (#2841) * Expose Environment._get_stack_name for integ test to predict stack name * Add integ test for pipeline bootstrap * Add init integ test * small UX improvements: (#2914) * small UX improvements: 1. show a message when the user cancels a bootstrapping command. 2. Don't prompt for CI/CD provider or provider templates if there is only one choice. 3. Make PipelineFileAlreadyExistsError a UserError. 4. use the Colored class instead of fg='color' when prompting a colored message. 5. Fix a bug where we were not allowing empty response for not required questions. * Fix Integration Test: We now don't ask the user to select a provider's pipeline template if there is only one * Add docs for PipelineFileAlreadyExistsError * make black happy * Sam pipelines s3 security (#2975) * Deny non https requests for the artifacts S3 bucket * enable bucket serverside logging * add integration tests for artifacts bucket SSL-only requests and access logging * typo * Ensure the ArtifactsLoggingBucket denies non ssl requests (#2976) * Sam pipelines ux round 3 (#2979) * rename customer facing message 'CI/CD provider' to 'CI/CD system' * add a note about what 'Environment Name' is during the pipeline bootstrap guided context * Apply suggestions from code review typo Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Chris Rehn <[email protected]> * let pipeline IAM user assume only IAM roles tagged with Role=pipeline-execution-role (#2982) * Adding AWS_ prefix to displayed out. (#2993) Co-authored-by: Tarun Mall <[email protected]> * Add region to pipeline bootstrap interactive flow (#2997) * Ask AWS region in bootstrap interactive flow * Read default region from boto session first * Fix a unit test * Inform write to pipelineconfig.toml at the end of bootstrap (#3002) * Print info about pipelineconfig.toml after resources are bootstrapped * Update samcli/commands/pipeline/bootstrap/cli.py Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Chris Rehn <[email protected]> * List detected env names in pipeline init when prompt to input the env name (#3000) * Allow question.question can be resolved using key path * Pass the list of env names message (environment_names_message) into pipeline init interactive flow context * Update samcli/commands/pipeline/init/interactive_init_flow.py Co-authored-by: Chris Rehn <[email protected]> * Fix unit test (trigger pr builds) * Fix integ test * Fix integ test Co-authored-by: Chris Rehn <[email protected]> * Adding account id to bootstrap message. (#2998) * Adding account id to bootstrap message. * adding docstring * Addressing PR comments. * Adding unit tests. * Fixing unit tests. Co-authored-by: Tarun Mall <[email protected]> * Cfn creds fix (#3014) * Removing pipeline user creds from cfn output. This maintains same user exp. Co-authored-by: Tarun Mall <[email protected]> * Ux bootstrap revamp 20210706 (#3021) * Add intro paragraph to bootstrap * Add switch account prompt * Revamp stage definition prompt * Revamp existing resources prompt * Revamp security prompt * Allow answers to be changed later * Add exit message for bootstrap * Add exit message for bootstrap (1) * Add indentation to review values * Add "Below is the summary of the answers:" * Sweep pylint errors * Update unit tests * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/guided_context.py Co-authored-by: Chris Rehn <[email protected]> * Update samcli/commands/pipeline/bootstrap/cli.py Co-authored-by: Chris Rehn <[email protected]> * Update unit tests * Add bold to other literals Co-authored-by: Chris Rehn <[email protected]> * Adding account condition for CFN execution role. (#3027) Co-authored-by: Tarun Mall <[email protected]> * pipeline UX revamp 20210707 (#3031) * Allow running bootstrap inside pipeline init * Select account credential source within bootstrap * Add bootstrap decorations within pipeline init * Removing ip range option from bootstrap. (#3036) * Removing ip range option from bootstrap. * Fixing unit test from UX PR. Co-authored-by: Tarun Mall <[email protected]> * Fix toml file incorrect read/write in init --bootstrap (#3037) * Temporarily removing account fix. (#3038) Co-authored-by: Tarun Mall <[email protected]> * Rename environment to stage (#3040) * Improve account source selection (#3042) * Fixing various cosmetics UX issues with pipeline workflow. (#3046) * Fixing credential to credentials * Forcing text color to yellow. * Adding new line after stage diagram. * Adding extra line after checking bootstrap message. * Renaming config -> configuration * account source -> credential source * Removing old message. * Fixing indentation in list. * Fixing bunch of indentation. * fixing f string Co-authored-by: Tarun Mall <[email protected]> * Auto skip questions if stage detected (#3045) * Autofill question if default value is presented * Allow to use index to select stage names (#3051) * Updating message when bootstrap stages are missing. (#3058) * Updating message when bootstrap stages are missing. * Fixing indendation Co-authored-by: Tarun Mall <[email protected]> * Fixing bootstrap integ tests. (#3061) * Fixing bootstrap integ tests. * Cleaning up some integ tests. * Using environment variables when running integ test on CI. * Using expression instead of full loop. * Adding instruction to use default profile on local. Co-authored-by: Tarun Mall <[email protected]> * Fix bootstrap test region (#3064) * Fix bootstrap region in integ test * Fix regions in non-interactive mode as well * Add more pipeline init integ test (#3065) * Fix existing pipeline init integ test * Add more pipeline init integ tests * Config file bug (#3066) * Validating config file after bootstrap stack creation. * Validating config file after bootstrap. Co-authored-by: Tarun Mall <[email protected]> * Fix pipeline init integ test because of pipelineconfig file exists (#3067) * Make stage name randomized to avoid race condition among multi canary runs (#3078) * Load number of stages from pipeline template (#3059) * Load number of stages from templates * Rename variable and add debug log * Add encoding to open() * Allow roles with Tag aws-sam-pipeline-codebuild-service-role to assume PipelineExecutionRole (#2950) * pipeline init UX: Ask to confirm when file exists (#3079) * Ask to confirm overriding if files already exist, or save to another directory * Add doc links (#3087) * Adding accidentally removed tests back. (#3088) Co-authored-by: Tarun Mall <[email protected]> Co-authored-by: elbayaaa <[email protected]> Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Ahmed Elbayaa <[email protected]> Co-authored-by: Tarun <[email protected]> Co-authored-by: Tarun Mall <[email protected]> * chore: bump aws-lambda-builder version to 1.5.0 (#3086) * chore: update to aws-sam-translator 1.38.0 (#3073) * ci: Update expected Jenkins file in pipeline integ test (#3090) * chore: Refine pipeline help text and update unit test (#3091) * Update --bucket help text * Update --stage help text * Update help text * Update help text * Update help text * Update help text * Update help text * Update jenkins generated files * Update some intro texts * Remove trialing spaces * Clearing pipeline integ test buckets with versioned objects. (#3094) * Clearing pipeline integ test buckets with versioned objects. * Fixing black formatting. Co-authored-by: Tarun Mall <[email protected]> * Fixing bug in bucket cleanup. (#3096) Co-authored-by: Tarun Mall <[email protected]> * Deleting bucket (#3097) Co-authored-by: Tarun Mall <[email protected]> * Revert "temp: disable testing against python 3.8, and enabled 3.7 (#3009)" (#3098) This reverts commit fe83218. Co-authored-by: Tarun Mall <[email protected]> * chore: bump SAM CLI version to 1.27.0 (#3101) * Add pipeline to pyinstaller (#3103) * Adding pipeline to pyinstaller. Co-authored-by: Tarun Mall <[email protected]> Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Mathieu Grandis <[email protected]> Co-authored-by: Qingchuan Ma <[email protected]> Co-authored-by: Alexis Facques <[email protected]> Co-authored-by: Wing Fung Lau <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> Co-authored-by: _sam <[email protected]> Co-authored-by: elbayaaa <[email protected]> Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Ahmed Elbayaa <[email protected]> Co-authored-by: Tarun <[email protected]> Co-authored-by: Tarun Mall <[email protected]> Co-authored-by: Raymond Wang <[email protected]>
* Added ecr_bootstrap * Added companion_stack_manager * Added Companion Stack Manager * Added update_companion_stack * Updated companion_stack_builder File Name * Formatted with Black * Updated get_unreferenced_repos * Updated guided_context to Use Companion Stack * Added Delete Auto Create ECR Repo Prompt * Updated prompt_image_repository Flow * Added --resolve-image-repos * Addressed Some of Pylint Issues * Updated Helper Text * Updated Comments * Fixed Typing * Removed Unused Imports * Updated Unit Tests * Updated UX and Fixed Windows ANSI * Updated Unit Tests * Fixed Import Order * Added Ignore Import Check * Added Integration Tests * Updated help text. Co-authored-by: Chris Rehn <[email protected]> * Added Comments for Name Generation * Updated Image Option Validator * Updated CompanionStackBuilder to Use Dict instead of String * Fixed Argument Ordering * Added Mapping Information to Help Text * Updated delete_unreferenced_repos Doc String * Updated sync_repos Doc String * Added Justification for ECR Repo Physical ID * Refactored to be Less Coupled * Refactored for prompt_specify_repos * Fixed Unit Test * Moved WaiterConfig Out of Methods * Updated Typing * Updated Managed S3 Template to be Dict * Fixed Typo * Added Comments for _save_image_repositories * Fixed Pylint Issue * Added Missing Check for unreferenced_repo_uris * Updated Variable Name * Fixed Typo * Updated Windows Check to Use platform.system() * Updated update_companion_stack Logic * Fixed Comment Typo * Fixed Typos * Fixed Test Name * Added methods for cf and s3 files and init UI * Added unit tests for utils methods and s3_uploader * Removed s3_bucket and s3_prefix click options * chore: Increase awareness of same file warning during package (aws#2946) * chore: increase awareness of same file warning during package * fix formatting & grammar Co-authored-by: Mathieu Grandis <[email protected]> * fix: Allow the base64Encoded field in REST Api, skip validation of unknown fields and validate missing statusCode for Http Api (aws#2941) * fix API Gateway emulator: - skip validating the non allowed fields for Http Api Gateway, as it always skip the unknown fields - add base64Encoded as an allowed field for Rest Api gateway - base64 decoding will be always done for Http API gateway if the lambda response isBase64Encoded is true regardless the content-type - validate if statusCode is missing in case of Http API, and payload version 1.0 * - accept "true", "True", "false", "False" as valid isBase64Encoded values. - Validate on other isBase64Encoded Values - add more integration && unit test cases * fix lint && black issues * use smaller image to test Base64 response * Fixed lint errors and added few unit tests * Make black happy * Added methods for deleting template artifacts * Wait method added for delete cf api * fix: pass copy of environment variables for keeping cache valid (aws#2943) * fix: pass copy of environment variables for keeping cache valid * add integ tests * update docs * make black happy Co-authored-by: Qingchuan Ma <[email protected]> * Added LOG statements * Added and updated changes based on CR * Fixed the unit tests in artifact_exporter.py * Update HELP_TEXT in delete/command.py Co-authored-by: Chris Rehn <[email protected]> * fix: Skip build of Docker image if ImageUri is a valid ECR URL (aws#2934) (aws#2935) * Updated code based on Chris' comments * Added condition for resources that have deletionpolicy specified * Small changes and fixes based on the comments * Add condition to managed bucket policy (aws#2999) * Removed region prompt * Update appveyor.yml to do docker login on both dockerhub and Public ECR (aws#3005) (aws#3006) Co-authored-by: Wing Fung Lau <[email protected]> * chore: bump version to 1.25.0 (aws#3007) Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> * temp: reduce python testing matrix (aws#3008) * temp: disable testing against python 3.8, and enabled 3.7 (aws#3009) * temp: disable testing against python 3.8, and enabled 3.7 * temp: disable testing against python 3.8, and enabled 3.7 & 3.6 * fix: enable all runtimes in python testing matrix (aws#3011) * revert: enable all runtimes in python testing matrix * fix indentation for yml * Added unit tests for ecr delete method and typing for methods * Reformatted delete_context and added option to skip user prompts * Removed return type from artifact_exporter for delete method * Added unit tests for artifact_exporter and delete_context * Added more unit tests for delete_context and artifact_exporter * chore: update to aws-sam-translator 1.37.0 (aws#3019) * chore: bump version to 1.26.0 (aws#3020) * Added more unit tests for delete_context and artifact_exporter * Added docs and comments for artifact_exporter and ecr_uploader * Added log statements in delete_context and some updates in unit tests * Changed force to no-prompts and updated ecr delete method error handling * chore: Improved --resolve-s3 option documentation and deployment without s3 error messages (aws#2983) * Improve documentation on --resolve-s3 option and improve s3 failure messages * Changed indentation for integration test on s3 error message * Fixed a typo in description * Improve spacing on help text for resolve-s3 option * Created a separate function for parsing ecr url in ecr_uploader * Reformatted Template class init to pass template_str and init template_dict * Changed how s3 url is obtained for resource_zip edge-case: aws:glue:job * Fixed edge case where resource artifact points to a path style url * run Make black * Made the parse s3 url funcs protected and defined a parent method and modified delete method for ResourceImageDict * Changed parse_ecr_url function name to parse_image_url * Defined UI for auto ecr deleton and method calls from companion_stack_manager * Added code for deleting repos from companion stack * Handle json templates deployed to cf * Changed the order of companion stack and ecr repos deletion * Handle delete_failed status for ecr companion stack and changed delete_stack to include retain_resources * Reformatted auto ecr deletion to handle deleting companion stack as input stack name * Fixed and added more unit tests for delete_context * When region is not provided, prompt user to enter profile and region * Removed region prompt and reading it from current session or assign a default instead * Added ECR resource in packageable_resources and refactored ecr companion stack deletion * Added log statements and unit tests for ECRResource * Better error handling for ecr delete_artifact * Revert "Merge remote-tracking branch 'wiltons-repo/feat/auto-ecr' into auto-ecr-delete" This reverts commit 0e159c2, reversing changes made to 1675b7e. * Added unit test for delete ecr repository * Fixed small string nits and added docstring for ECRResource * Added some unit tests for s3_uploader, ecr_uploader and delete_context * Updated to context refresh only when region and profile have non None values and removed unused class variable in delete_context * Added unit test for ResourceImageDict class methods Co-authored-by: Wilton Wang <[email protected]> Co-authored-by: Chris Rehn <[email protected]> Co-authored-by: Mathieu Grandis <[email protected]> Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Mohamed Elasmar <[email protected]> Co-authored-by: Qingchuan Ma <[email protected]> Co-authored-by: Alexis Facques <[email protected]> Co-authored-by: Wing Fung Lau <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]>
I'm not convinced this issue is fully resolved. In fact, the solution implemented in #2935 has introduced a regression for us. This issue requests that the following isn't built:
However, why would this preclude SAM from being able to invoke the lambda locally if the docker image already exists in the local image cache? We are using SAM to integration test lambdas that are built from multiple projects. There is no build or deploy being performed, just a local test of the lambda functions and the step function state machine that wires it all together. But now we are getting the following error when things used to work fine: |
/+ 1 |
100x this. We have no means to test using sam, have to do it manually with docker. |
We did find a work around by "tricking" sam:
|
…s are valid ECR URL (aws#2934)
Well it's been a while. To add some clarity, the changes I proposed in #2935 were to let us skip the build of Lambda functions with valid ECR registry locations as However, there was a bit of a hiccup with One workaround is set the Fast forward 2 years, the I see no particular side effect to this change, but will happily discuss the matter further if needed. |
What about |
|
Hi @taylorsmithgg, if I've grasped your earlier messages correctly, you're utilizing the desired ECR location within your To follow up on your issue, are you aiming for SAM to manage the build and deployment of this image? Or is your intention solely to run it locally? If your expectation involves the build process, please note that the In my view, this behavior aligns with norms, similar to However, if your intention is for SAM to retrieve the image to facilitate local invocation, this introduces an entirely new feature (albeit super intriguing imo); but we should consider extending this functionality to ZIP Lambdas as well (assuming the AWS credentials provided possess adequate permissions to fetch S3 data). |
@alexisfacques We use jib to build our Java lambdas in lieu of sam for many reasons.
This is accurate and what is intended. Essentially we migrated a few projects and now have to manually run several steps to stand up a local invocation that should be easily solvable by It doesn't seem like there should be the same restrictions in place for docker builds as zips since you can arbitrarily retrieve images from any source available. (local, ecr, dockerhub, etc.) In the above comment, it seems that this was working at some point, at least in a rough format before the fix. |
Ahhh I get it now. Indeed, as long as the image is appropriately tagged within your local Docker environment, I'd personally see no reason why SAM would not be able to run it locally. FYI, this matter can be traced back to this specific line within the local invoke execution process. Ultimately, this code relies on this instruction found within the component responsible for listing (valid) Lambda functions in a template, shared between both the I would leave it to @mildaniel & @moelasmar to decide on that matter, but I believe we could easily get around that by altering how this method (called by deploy) would handle returning Lambda functions declarations: |
… are valid ECR URL (aws#2934)
… are valid ECR URL (aws#2934)
…ons are valid ECR URL (aws#2934)
…ons are valid ECR URL (aws#2934)
Describe your idea/feature/enhancement
When configuring a lambda / serverless function of which the
PackageType
isZip
, SAM preemptively checks whether the resourceCodeUri
is a S3 location or not.If so, SAM will not attempt to build said lambda, and will show a warning to the user:
I would expect SAM to do the same when attempting to build a
PackageType: Image
lambda function; checking whether or not the resource propertyImageUri
is a valid ECR URL before attempting to build said images locally, yet this feature is not supported by SAM today:Instead, attempting to do so will most likely output the following exception (as the
DockerContext
resource metadata, required for building Docker Images using SAM, will most likely be unset, error traced here):As a result, it is currently not possible to deploy Docker-packed Lambda functions, without building the underlying image using SAM, which is, in my opinion, very limiting (e.g., inability to share ECR registries & images among an Organization, inability to use Docker images that require a specific build workflow -passing secrets using buildkit, environment specific args-...)
I did find a workaround, tricking SAM into skipping the build of a
PackageType: Image
Lambda, by setting theCode.S3Bucket
property to an empty value, but I believe this to be very hack-y:Proposal
Zip
packaged lambdas, check whether or not theImageUri
property of aAWS::Serverless::Function
, orCode.ImageUri
property of aAWS::Lambda::Function
is a valid ECR URL before attempting to locally build said function. This could be done by reusing a function in thepackage.ecr_utils
module here.Things to consider:
Additional Details
A PR should follow soon with a workaround proposal.
The text was updated successfully, but these errors were encountered: