|
9 | 9 | set -euo pipefail |
10 | 10 |
|
11 | 11 | # Creating Lambda layer |
12 | | -echo "Creating Lambda layer in ./dist-serverless ..." |
| 12 | +echo "Creating Lambda layer in ./dist ..." |
13 | 13 | make aws-lambda-layer |
14 | | -echo "Done creating Lambda layer in ./dist-serverless." |
15 | | - |
16 | | -# IMPORTANT: |
17 | | -# Please make sure that this part does the same as the GitHub action that |
18 | | -# is building the Lambda layer in production! |
19 | | -# see: https://github.com/getsentry/action-build-aws-lambda-extension/blob/main/action.yml#L23-L40 |
20 | | - |
21 | | -echo "Downloading relay..." |
22 | | -mkdir -p dist-serverless/relay |
23 | | -curl -0 --silent \ |
24 | | - --output dist-serverless/relay/relay \ |
25 | | - "$(curl -s https://release-registry.services.sentry.io/apps/relay/latest | jq -r .files.\"relay-Linux-x86_64\".url)" |
26 | | -chmod +x dist-serverless/relay/relay |
27 | | -echo "Done downloading relay." |
28 | | - |
29 | | -echo "Creating start script..." |
30 | | -mkdir -p dist-serverless/extensions |
31 | | -cat > dist-serverless/extensions/sentry-lambda-extension << EOT |
32 | | -#!/bin/bash |
33 | | -set -euo pipefail |
34 | | -exec /opt/relay/relay run \ |
35 | | - --mode=proxy \ |
36 | | - --shutdown-timeout=2 \ |
37 | | - --upstream-dsn="\$SENTRY_DSN" \ |
38 | | - --aws-runtime-api="\$AWS_LAMBDA_RUNTIME_API" |
39 | | -EOT |
40 | | -chmod +x dist-serverless/extensions/sentry-lambda-extension |
41 | | -echo "Done creating start script." |
42 | | - |
43 | | -# Zip Lambda layer and included Lambda extension |
44 | | -echo "Zipping Lambda layer and included Lambda extension..." |
45 | | -cd dist-serverless/ |
46 | | -zip -r ../sentry-python-serverless-x.x.x-dev.zip \ |
47 | | - . \ |
48 | | - --exclude \*__pycache__\* --exclude \*.yml |
49 | | -cd .. |
50 | | -echo "Done Zipping Lambda layer and included Lambda extension to ./sentry-python-serverless-x.x.x-dev.zip." |
51 | | - |
| 14 | +echo "Done creating Lambda layer in ./dist" |
52 | 15 |
|
53 | 16 | # Deploying zipped Lambda layer to AWS |
54 | | -echo "Deploying zipped Lambda layer to AWS..." |
| 17 | +ZIP=$(ls dist | grep serverless | head -n 1) |
| 18 | +echo "Deploying zipped Lambda layer $ZIP to AWS..." |
55 | 19 |
|
56 | 20 | aws lambda publish-layer-version \ |
57 | 21 | --layer-name "SentryPythonServerlessSDK-local-dev" \ |
58 | 22 | --region "eu-central-1" \ |
59 | | - --zip-file "fileb://sentry-python-serverless-x.x.x-dev.zip" \ |
| 23 | + --zip-file "fileb://dist/$ZIP" \ |
60 | 24 | --description "Local test build of SentryPythonServerlessSDK (can be deleted)" \ |
| 25 | + --compatible-runtimes python3.6 python3.7 python3.8 python3.9 |
61 | 26 | --no-cli-pager |
62 | 27 |
|
63 | 28 | echo "Done deploying zipped Lambda layer to AWS as 'SentryPythonServerlessSDK-local-dev'." |
|
0 commit comments