Skip to content

Commit

Permalink
Added support for py 3.9 and update runtime before deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
balihoo-mpatel committed Oct 19, 2022
1 parent 305e55a commit fd45093
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions blambda/blambda-env
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ elif [[ ${BLAMBDA_ENV} == 'blambda-3.7' ]]; then
PYENV_PATH = '.pyenv/versions/3.7.5/lib/python3.7/'
elif [[ ${BLAMBDA_ENV} == 'blambda-3.8' ]]; then
PYENV_PATH = '.pyenv/versions/3.8.1/lib/python3.8/'
elif [[ ${BLAMBDA_ENV} == 'blambda-3.9' ]]; then
PYENV_PATH = '.pyenv/versions/3.9.13/lib/python3.9/'
else
echo "blambda couldn't read the python environment from manifest, aborting!"
return 1
Expand Down
10 changes: 10 additions & 0 deletions blambda/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ def publish(name, role, zipfile, options, dryrun):
print("Function Package: {} bytes".format(len(file_bytes)))
if not dryrun:
try:
# TODO: Remove this once all py 3.8 lambdas are deployed on prod
# Added below code to update lambda runtime first and then deploy it
cprint("Updating lambda function configuration - todo: remove", 'yellow')
response = client.update_function_configuration(
FunctionName=name,
**options
)

time.sleep(5)

cprint("Updating lambda function code", 'yellow')
response = client.update_function_code(
FunctionName=name,
Expand Down
1 change: 1 addition & 0 deletions blambda/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'python36': LambdaRuntime('python3.6', '.py', 'python/src'),
'python37': LambdaRuntime('python3.7', '.py', 'python/src'),
'python38': LambdaRuntime('python3.8', '.py', 'python/src'),
'python39': LambdaRuntime('python3.9', '.py', 'python/src'),
'coffee': LambdaRuntime('nodejs4.3', '.coffee', 'node/src')
}

Expand Down
4 changes: 3 additions & 1 deletion blambda/utils/env_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
py36 = LambdaRuntime('python3.6', '3.6.1', 'blambda-3.6')
py37 = LambdaRuntime('python3.7', '3.7.5', 'blambda-3.7')
py38 = LambdaRuntime('python3.8', '3.8.1', 'blambda-3.8')
py39 = LambdaRuntime('python3.9', '3.9.13', 'blambda-3.9')

runtimes = {
py27.name: py27,
py36.name: py36,
py37.name: py37,
py38.name: py38
py38.name: py38,
py39.name: py39
}

DEFAULT_RUNTIME = py36
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
author='Balihoo Developers',
author_email='devall@balihoo.com',
license='MIT',
url='git@github.com:balihoo/fulfillment-lambda-functions.git',
url='git+https://github.com/balihoo/fulfillment-lambda-functions.git',
install_requires=['boto3', 'python-dateutil', 'requests', 'termcolor', 'lxml', 'beautifulsoup4'],
packages=find_packages(exclude=['tests']),
include_package_data=True,
Expand Down

0 comments on commit fd45093

Please sign in to comment.