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

Introduce AutoPublishCodeSha256 to allow overriding the publish versi… #1376

Merged
merged 1 commit into from
Jan 27, 2020

Conversation

jmnarloch
Copy link
Contributor

@jmnarloch jmnarloch commented Jan 9, 2020

Issue #, if available: #1375

Description of changes: The change introduces additional attribute to AWS::Serverless::Function that allow to override the hash computed for the created Lambda version. To allow more fine grained control this change adds a AutoPublishCodeSha256 attribute that will allow to associate it in the template.

Example:

Resources:
  MinimalFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
      CodeUri: s3://sam-demo-bucket/hello.zip
      Handler: hello.handler
      Runtime: python2.7
      AutoPublishAlias: live
      AutoPublishCodeSha256: 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b
      VersionDescription: sam-testing

Description of how you validated changes: Added unit tests to cover this feature.

Checklist:

  • Write/update tests
  • make pr passes
  • Update documentation
  • Verify transformed template deploys and application functions as expected
  • Add/update example to examples/2016-10-31

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

@jmnarloch jmnarloch force-pushed the auto-publish-code-sha256 branch 2 times, most recently from 019caa5 to 0cd9997 Compare January 14, 2020 18:46
@jmnarloch jmnarloch force-pushed the auto-publish-code-sha256 branch from 0cd9997 to eca5538 Compare January 14, 2020 18:52
@codecov-io
Copy link

codecov-io commented Jan 14, 2020

Codecov Report

Merging #1376 into develop will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1376      +/-   ##
===========================================
+ Coverage    94.46%   94.47%   +<.01%     
===========================================
  Files           78       78              
  Lines         4555     4559       +4     
  Branches       912      913       +1     
===========================================
+ Hits          4303     4307       +4     
  Misses         118      118              
  Partials       134      134
Impacted Files Coverage Δ
samtranslator/translator/logical_id_generator.py 90.9% <100%> (+0.9%) ⬆️
samtranslator/model/sam_resources.py 94% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eabe27d...eca5538. Read the comment docs.

@keetonian keetonian self-assigned this Jan 15, 2020
@keetonian keetonian assigned praneetap and unassigned keetonian Jan 22, 2020
@@ -70,6 +70,7 @@ class SamFunction(SamResourceMacro):
"EventInvokeConfig": PropertyType(False, is_type(dict)),
# Intrinsic functions in value of Alias property are not supported, yet
"AutoPublishAlias": PropertyType(False, one_of(is_str())),
"AutoPublishCodeSha256": PropertyType(False, one_of(is_str())),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Just is_str() instead of one_of(is_str())

@praneetap praneetap merged commit 4bed4ff into aws:develop Jan 27, 2020
@brightsparc
Copy link

brightsparc commented Feb 24, 2020

Thanks @praneetap this AutoPublishCodeSha256 looks really useful. I'm looking to test this out but am getting an error when calling aws cloudformation deploy

 Reason: Transform AWS::Serverless-2016-10-31 failed with: Internal transform failure.

Is this live and ready for testing yet, or is there a new transform that is required to support this?

Also does the value passed to AutoPublishCodeSha256 have to be a valid Sha256 hash or could it be a uuid or similar?

@brightsparc
Copy link

brightsparc commented Mar 3, 2020

Thanks @praneetap this AutoPublishCodeSha256 looks really useful. I'm looking to test this out but am getting an error when calling aws cloudformation deploy

This issue was related to passing in a AutoPublishCodeSha256 by Ref which is currently not supported.

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.

5 participants