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

fix: --s3-bucket or --image-repository requirement #2648

Merged
merged 3 commits into from
Mar 16, 2021

Conversation

sriram-mv
Copy link
Contributor

Which issue(s) does this change fix?

#2450

Why is this change necessary?

  • only make --s3-bucket or --image-repository mandatory if there are
    resources present in the template that have locations that need to be
    packaged to different AWS destinations such as S3 or ECR.

How does it address the issue?

  • look for specific packageable resource locations based on their types to determine if --s3-bucket or --image-repository is required.

What side effects does this change have?

  • for templates that have zero dependence on S3 or ECR, sam package will no longer require either --s3-bucket or --image-repository
template.yaml

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  python3.8

  Sample SAM Template for image

# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
  Function:
    Timeout: 3

Resources:
  RailsHttpApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      StageName: PROD

 ~/..../ sam package                                                                                                                                                 
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: 'python3.8

  Sample SAM Template for image

  '
Globals:
  Function:
    Timeout: 3
Resources:
  RailsHttpApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      StageName: PROD

Checklist

  • Add input/output type hints to new functions/methods
  • Write design document (Do I need to write a design document?)
  • Write unit tests
  • Write/update functional tests
  • Write/update integration tests
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

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

Copy link
Contributor

@hawflau hawflau left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@jfuss jfuss left a comment

Choose a reason for hiding this comment

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

Are there any integ tests we should add to guard against any future regressions?

@sriram-mv
Copy link
Contributor Author

@jfuss Sure, lets add one. will be out in the next commit.

@sriram-mv sriram-mv force-pushed the fix_s3_bucket_packagetype_image branch from fdd5d2a to 51224cb Compare March 10, 2021 17:59
* only make `--s3-bucket` or `--image-repository` mandatory if there are
resources present in the template that have locations that need to be
packaged to different AWS destinations such as S3 or ECR.
@sriram-mv sriram-mv force-pushed the fix_s3_bucket_packagetype_image branch from 51224cb to 4d8d976 Compare March 15, 2021 17:55
@sriram-mv sriram-mv merged commit 01207ed into aws:develop Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants