Skip to content

Add support for S3 hosted package artifacts - #6196

Merged
pmuens merged 1 commit into
masterfrom
s3-package-artifacts
Jun 5, 2019
Merged

pmuens merged 1 commit into
masterfrom
s3-package-artifacts

Conversation

@pmuens

@pmuens pmuens commented May 30, 2019 •

Copy link
Copy Markdown
Contributor

What did you implement:

Adds support for package artifacts hosted on S3.

Closes #5315

One can now point to package artifacts hosted on S3.

How did you implement it:

The first implementation replaced the Code property of the Lambda function to point to the S3 artifact. However since the artifactFilePath traces through the whole codebase it's pretty much guaranteed that we break something if we try to mitigate checks related to the presence of the artifact in the given artifactFilePath.

The second iteration (the one implemented here) downloads the .zip file from S3 and sets the artifactFilePath on the function-level. This way we touch minimal code and Serverless does it's thing as if you're using the regular package configuration.

How can we verify it:

Create a S3 bucket, upload a deployment artifact (e.g. previously created via serverless package), the following serverless.yml below where you replace the Object URL and run serverless deploy.

1st service with a package-wide artifact

service: test

provider:
  name: aws
  runtime: nodejs10.x
  versionFunctions: false

functions:
  test:
    handler: handler.hello
    events
      - http: GET hello

package:
  artifact: <s3-object-url>

2nd service with a function-wide artifact

service: test

provider:
  name: aws
  runtime: nodejs10.x
  versionFunctions: false

functions:
  test:
    handler: handler.hello
    package:
      artifact: <s3-object-url>
    events:
      - http: GET hello

package:
  individually: true

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@pmuens pmuens added this to the 1.45.0 milestone May 30, 2019
@pmuens pmuens self-assigned this May 30, 2019
@pmuens
pmuens force-pushed the s3-package-artifacts branch 6 times, most recently from 191dc33 to 53bce23 Compare June 3, 2019 12:11
@pmuens
pmuens marked this pull request as ready for review June 3, 2019 12:27
@pmuens
pmuens force-pushed the s3-package-artifacts branch from 53bce23 to e21f555 Compare June 3, 2019 12:28
@pmuens
pmuens requested a review from medikoo June 3, 2019 12:30
@pmuens
pmuens force-pushed the s3-package-artifacts branch from e21f555 to a3afa64 Compare June 4, 2019 11:31
@pmuens
pmuens requested a review from medikoo June 4, 2019 11:45
Comment thread tests/utils/fs/index.js Resolved
Comment thread tests/utils/fs/index.js Resolved
@pmuens
pmuens force-pushed the s3-package-artifacts branch from a3afa64 to a02b31e Compare June 5, 2019 11:34
@pmuens
pmuens requested a review from medikoo June 5, 2019 11:34

@medikoo medikoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Still, maybe it'll be good to configure an integration test, that covers S3 artifact download?

@pmuens

pmuens commented Jun 5, 2019

Copy link
Copy Markdown
Contributor Author

Thanks @medikoo 👍

Still, maybe it'll be good to configure an integration test, that covers S3 artifact download?

Yes, that sounds like a good idea. Let's add that integration test to the list and work on it in a separate PR.

@pmuens
pmuens merged commit 99e4e1a into master Jun 5, 2019
@pmuens
pmuens deleted the s3-package-artifacts branch June 5, 2019 11:48
@pfeilbr

pfeilbr commented Jun 19, 2019 •

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add to AWS Lambda function the option to set a S3 zip file as package artifact

3 participants