From 23ce73cb1ab0580167444b421a2db9286a4d25cf Mon Sep 17 00:00:00 2001 From: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:03:42 -0800 Subject: [PATCH 1/2] fix: remove python3.7 support --- Makefile | 1 - build-image-src/Dockerfile-python37 | 56 ---- build-image-src/build_all_images.sh | 1 - tests/apps/python3.7/sam-test-app/.gitignore | 244 ------------------ tests/apps/python3.7/sam-test-app/__init__.py | 0 .../python3.7/sam-test-app/events/event.json | 62 ----- .../sam-test-app/hello_world/__init__.py | 0 .../python3.7/sam-test-app/hello_world/app.py | 44 ---- .../sam-test-app/hello_world/requirements.txt | 1 - .../apps/python3.7/sam-test-app/template.yaml | 39 --- tests/test_build_images.py | 17 -- 11 files changed, 465 deletions(-) delete mode 100644 build-image-src/Dockerfile-python37 delete mode 100644 tests/apps/python3.7/sam-test-app/.gitignore delete mode 100644 tests/apps/python3.7/sam-test-app/__init__.py delete mode 100644 tests/apps/python3.7/sam-test-app/events/event.json delete mode 100644 tests/apps/python3.7/sam-test-app/hello_world/__init__.py delete mode 100644 tests/apps/python3.7/sam-test-app/hello_world/app.py delete mode 100644 tests/apps/python3.7/sam-test-app/hello_world/requirements.txt delete mode 100644 tests/apps/python3.7/sam-test-app/template.yaml diff --git a/Makefile b/Makefile index 649e9cc..0da331a 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,6 @@ export DOCKER_CLI_EXPERIMENTAL := enabled # image suffix lookup IS_java8 := java8 IS_provided := provided -IS_python37 := python3.7 IS_go1x := go1.x IS_dotnet6 := dotnet6 IS_dotnet7 := dotnet7 diff --git a/build-image-src/Dockerfile-python37 b/build-image-src/Dockerfile-python37 deleted file mode 100644 index 8fdbcb8..0000000 --- a/build-image-src/Dockerfile-python37 +++ /dev/null @@ -1,56 +0,0 @@ -FROM public.ecr.aws/lambda/python:3.7 - -RUN yum groupinstall -y development && \ - yum install -d1 -y \ - tar \ - gzip \ - unzip \ - jq \ - grep \ - curl \ - make \ - rsync \ - gcc-c++ \ - binutils \ - procps \ - libgmp3-dev \ - zlib1g-dev \ - liblzma-dev \ - libxslt-devel \ - libmpc-devel \ - && yum clean all - -# Include build tools for the Function Build image. -# /opt is used for Lambda Layers. To avoid any potential confusion or -# conflict in the future, the build tools are installed in /usr/local/opt - -# Install AWS CLI -RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip && rm -rf ./aws - -# Install SAM CLI via native linux installer -ARG SAM_CLI_VERSION -RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v$SAM_CLI_VERSION/aws-sam-cli-linux-x86_64.zip" -o "samcli.zip" && \ - unzip samcli.zip -d sam-installation && ./sam-installation/install && \ - rm samcli.zip && rm -rf sam-installation && sam --version - -ENV LANG=en_US.UTF-8 - -# Prepare virtualenv for lambda builders -RUN python3 -m venv --without-pip /usr/local/opt/lambda-builders -RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py -RUN /usr/local/opt/lambda-builders/bin/python3 get-pip.py -# Install lambda builders in a dedicated Python virtualenv -RUN AWS_LB_VERSION=$(curl -sSL https://raw.githubusercontent.com/aws/aws-sam-cli/v$SAM_CLI_VERSION/requirements/base.txt | grep aws_lambda_builders | cut -d= -f3) && \ - /usr/local/opt/lambda-builders/bin/pip3 --no-cache-dir install "aws-lambda-builders==$AWS_LB_VERSION" - -ENV PATH=$PATH:/usr/local/opt/lambda-builders/bin - -# Wheel is required by SAM CLI to build libraries like cryptography. It needs to be installed in the system -# Python for it to be picked up during `sam build` -RUN pip3 install wheel - -COPY ATTRIBUTION.txt / - -# Compatible with initial base image -ENTRYPOINT [] -CMD ["/bin/bash"] diff --git a/build-image-src/build_all_images.sh b/build-image-src/build_all_images.sh index e7ff21a..ce407e5 100755 --- a/build-image-src/build_all_images.sh +++ b/build-image-src/build_all_images.sh @@ -19,7 +19,6 @@ export DOCKER_CLI_EXPERIMENTAL=enabled # Single arch images docker build -f Dockerfile-java8 -t amazon/aws-sam-cli-build-image-java8:x86_64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION . & docker build -f Dockerfile-provided -t amazon/aws-sam-cli-build-image-provided:x86_64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION . & -docker build -f Dockerfile-python37 -t amazon/aws-sam-cli-build-image-python3.7:x86_64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION . & docker build -f Dockerfile-go1x -t amazon/aws-sam-cli-build-image-go1.x:x86_64 --build-arg SAM_CLI_VERSION=$SAM_CLI_VERSION . & wait diff --git a/tests/apps/python3.7/sam-test-app/.gitignore b/tests/apps/python3.7/sam-test-app/.gitignore deleted file mode 100644 index 4808264..0000000 --- a/tests/apps/python3.7/sam-test-app/.gitignore +++ /dev/null @@ -1,244 +0,0 @@ - -# Created by https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### OSX ### -*.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### PyCharm ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff: -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries - -# Sensitive or high-churn files: -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.xml -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml - -# Gradle: -.idea/**/gradle.xml -.idea/**/libraries - -# CMake -cmake-build-debug/ - -# Mongo Explorer plugin: -.idea/**/mongoSettings.xml - -## File-based project format: -*.iws - -## Plugin-specific files: - -# IntelliJ -/out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Ruby plugin and RubyMine -/.rakeTasks - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -### PyCharm Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -.idea/sonarlint - -### Python ### -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -.pytest_cache/ -nosetests.xml -coverage.xml -*.cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule.* - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -.history - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# Build folder - -*/build/* - -# End of https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode \ No newline at end of file diff --git a/tests/apps/python3.7/sam-test-app/__init__.py b/tests/apps/python3.7/sam-test-app/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/apps/python3.7/sam-test-app/events/event.json b/tests/apps/python3.7/sam-test-app/events/event.json deleted file mode 100644 index 070ad8e..0000000 --- a/tests/apps/python3.7/sam-test-app/events/event.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "body": "{\"message\": \"hello world\"}", - "resource": "/{proxy+}", - "path": "/path/to/resource", - "httpMethod": "POST", - "isBase64Encoded": false, - "queryStringParameters": { - "foo": "bar" - }, - "pathParameters": { - "proxy": "/path/to/resource" - }, - "stageVariables": { - "baz": "qux" - }, - "headers": { - "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", - "Accept-Encoding": "gzip, deflate, sdch", - "Accept-Language": "en-US,en;q=0.8", - "Cache-Control": "max-age=0", - "CloudFront-Forwarded-Proto": "https", - "CloudFront-Is-Desktop-Viewer": "true", - "CloudFront-Is-Mobile-Viewer": "false", - "CloudFront-Is-SmartTV-Viewer": "false", - "CloudFront-Is-Tablet-Viewer": "false", - "CloudFront-Viewer-Country": "US", - "Host": "1234567890.execute-api.us-east-1.amazonaws.com", - "Upgrade-Insecure-Requests": "1", - "User-Agent": "Custom User Agent String", - "Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)", - "X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==", - "X-Forwarded-For": "127.0.0.1, 127.0.0.2", - "X-Forwarded-Port": "443", - "X-Forwarded-Proto": "https" - }, - "requestContext": { - "accountId": "123456789012", - "resourceId": "123456", - "stage": "prod", - "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef", - "requestTime": "09/Apr/2015:12:34:56 +0000", - "requestTimeEpoch": 1428582896000, - "identity": { - "cognitoIdentityPoolId": null, - "accountId": null, - "cognitoIdentityId": null, - "caller": null, - "accessKey": null, - "sourceIp": "127.0.0.1", - "cognitoAuthenticationType": null, - "cognitoAuthenticationProvider": null, - "userArn": null, - "userAgent": "Custom User Agent String", - "user": null - }, - "path": "/prod/path/to/resource", - "resourcePath": "/{proxy+}", - "httpMethod": "POST", - "apiId": "1234567890", - "protocol": "HTTP/1.1" - } -} diff --git a/tests/apps/python3.7/sam-test-app/hello_world/__init__.py b/tests/apps/python3.7/sam-test-app/hello_world/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/apps/python3.7/sam-test-app/hello_world/app.py b/tests/apps/python3.7/sam-test-app/hello_world/app.py deleted file mode 100644 index 139af7d..0000000 --- a/tests/apps/python3.7/sam-test-app/hello_world/app.py +++ /dev/null @@ -1,44 +0,0 @@ -import json - -# import requests - - -def lambda_handler(event, context): - """Sample pure Lambda function - - Parameters - ---------- - event: dict, required - API Gateway Lambda Proxy Input Format - - Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format - - context: object, required - Lambda Context runtime methods and attributes - - Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html - - Returns - ------ - API Gateway Lambda Proxy Output Format: dict - - Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html - """ - - # try: - # ip = requests.get("http://checkip.amazonaws.com/") - # except requests.RequestException as e: - # # Send some context about this error to Lambda Logs - # print(e) - - # raise e - - return { - "statusCode": 200, - "body": json.dumps( - { - "message": "hello world", - # "location": ip.text.replace("\n", "") - } - ), - } diff --git a/tests/apps/python3.7/sam-test-app/hello_world/requirements.txt b/tests/apps/python3.7/sam-test-app/hello_world/requirements.txt deleted file mode 100644 index 663bd1f..0000000 --- a/tests/apps/python3.7/sam-test-app/hello_world/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -requests \ No newline at end of file diff --git a/tests/apps/python3.7/sam-test-app/template.yaml b/tests/apps/python3.7/sam-test-app/template.yaml deleted file mode 100644 index 1ed5f7a..0000000 --- a/tests/apps/python3.7/sam-test-app/template.yaml +++ /dev/null @@ -1,39 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Transform: AWS::Serverless-2016-10-31 -Description: > - sam-test-app8 - - Sample SAM Template for sam-test-app8 - -# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst -Globals: - Function: - Timeout: 3 - -Resources: - HelloWorldFunction: - Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction - Properties: - CodeUri: hello_world/ - Handler: app.lambda_handler - Runtime: python3.7 - Events: - HelloWorld: - Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api - Properties: - Path: /hello - Method: get - -Outputs: - # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function - # Find out more about other implicit resources you can reference within SAM - # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api - HelloWorldApi: - Description: "API Gateway endpoint URL for Prod stage for Hello World function" - Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/" - HelloWorldFunction: - Description: "Hello World Lambda Function ARN" - Value: !GetAtt HelloWorldFunction.Arn - HelloWorldFunctionIamRole: - Description: "Implicit IAM Role created for Hello World function" - Value: !GetAtt HelloWorldFunctionRole.Arn diff --git a/tests/test_build_images.py b/tests/test_build_images.py index a102b47..864c96b 100644 --- a/tests/test_build_images.py +++ b/tests/test_build_images.py @@ -351,23 +351,6 @@ def test_packages(self): self.assertTrue(self.is_architecture("aarch64")) -@pytest.mark.python37 -class TestBIPython37(BuildImageBase): - __test__ = True - - @classmethod - def setUpClass(cls): - super().setUpClass("python3.7", "Dockerfile-python37", "pip") - - def test_packages(self): - """ - Test packages specific to this build image - """ - self.assertTrue(self.check_package_output("python --version", "Python 3.7.")) - self.assertTrue(self.is_package_present("pip")) - self.assertTrue(self.is_architecture("x86_64")) - - @pytest.mark.python38 class TestBIPython38(BuildImageBase): __test__ = True From f0926c4a130f8fd43f91abc5bb3d6d2cb4351858 Mon Sep 17 00:00:00 2001 From: Mehmet Nuri Deveci <5735811+mndeveci@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:07:21 -0800 Subject: [PATCH 2/2] remove ci & pytest config --- .github/workflows/build.yml | 1 - pytest.ini | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92f5806..11f6a36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,6 @@ jobs: runtime: - "java8" - "provided" - - "python37" - "go1x" runs-on: ubuntu-latest needs: [get-sam-cli-version] diff --git a/pytest.ini b/pytest.ini index c84bfc2..bafbf53 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,7 +2,6 @@ markers = java8 provided - python37 go1x dotnet6 dotnet7