Visitar URL original
Support for version in Amazon API and filenames · Issue #68 · nficano/python-lambda · GitHub
The Wayback Machine - https://web.archive.org/web/20201220133839/https://github.com/nficano/python-lambda/issues/68
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

Support for version in Amazon API and filenames #68

Open
kilna-magento opened this issue Sep 6, 2017 · 4 comments
Open

Support for version in Amazon API and filenames #68

kilna-magento opened this issue Sep 6, 2017 · 4 comments

Comments

@kilna-magento
Copy link

@kilna-magento kilna-magento commented Sep 6, 2017

Currently filenames are coded only with a timestamp... ideally there would be provisions for creating the filename based on a version string. The same input could then in turn be used to set the version as per the AWS Lambda API:

https://docs.aws.amazon.com/lambda/latest/dg/versioning-intro.html

This could be implemented by adding a "version: x.x.x" line to the config.yaml file, if present then the version provided will be used, otherwise the code will exhibit the current behavior for backward compatibility. Another option would be to add a '--version=x.x.x' command line parameter to 'lambda build' and the pending S3 change 'lambda upload'.

It would break 100% compatibility with current outputs, but it would also likely be more intuitive to have the filenames generated be in the format -<version|timestamp>.zip rather than the current -.zip.

@kilna-magento
Copy link
Author

@kilna-magento kilna-magento commented Sep 6, 2017

Tagging my other non-work account @kilna

@kilna
Copy link

@kilna kilna commented Sep 6, 2017

Also, bears mentioning... looking at the codebase, I can do this. Just curious if others have the same need.

@alvsanand
Copy link

@alvsanand alvsanand commented Dec 14, 2018

Me too

@mikeycoxon
Copy link

@mikeycoxon mikeycoxon commented Mar 9, 2019 •

Yes, I think this would be a very useful feature. I was thinking about submitting a patch for this along the same lines, so if you're doing it, I'll definitely support and use it.
I realised (later) that this issue was submitted a while ago. I since tried to write a patch, but got into trouble running: python setup.py sdist bdist_wheel upload

First Issue is that README.rst has been renamed to README.md (No such file or directory: 'README.rst'). I renamed it
Second Issue: the command line upload doesn't seem to work without specifying a .pypirc file
Third Issue: my user cannot upload patches to this project, and I can't see any way of getting those permissions.

So an additional issue is that it seems to be very hard to contribute to this project.

Anyway, it would be a very simple change in aws_lambda.py:

instead of:

    # Combine the name of the Lambda function with the current timestamp to use
    # for the output filename.
    function_name = cfg.get('function_name')
    output_filename = '{0}-{1}.zip'.format(timestamp(), function_name)

Have:

    function_name = cfg.get('function_name')
    function_version = cfg.get('version')

    # If no version is set in config.yaml
    # Combine the name of the Lambda function with the current timestamp
    # otherwise combine the name of the Lambda function with the version
    # for the output filename.
    output_filename = (
        '{0}-{1}.zip'.format(timestamp(), function_name)
        if not function_version
        else '{0}-{1}.zip'.format(function_name, function_version)
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.