@@ -8,6 +8,10 @@ PY36_DIST=$DIST_DIR/python36.zip
88PY37_DIST=dist/python37.zip
99PY38_DIST=dist/python38.zip
1010
11+ EXTENSION_DIST_DIR=extensions
12+ EXTENSION_DIST_URL=https://github.com/newrelic/newrelic-lambda-extension/archive/v1.0.0.zip
13+ EXTENSION_DIST_ZIP=extension.zip
14+
1115REGIONS=(
1216 ap-northeast-1
1317 ap-northeast-2
@@ -30,15 +34,23 @@ function usage {
3034 echo " ./publish-layers.sh [python2.7|python3.6|python3.7|python3.8]"
3135}
3236
37+ function download-extension {
38+ rm -rf $EXTENSION_DIST_DIR $EXTENSION_DIST_ZIP
39+ curl $EXTENSION_DIST_URL -o $EXTENSION_DIST_ZIP
40+ unzip $EXTENSION_DIST_ZIP -d .
41+ rm -f $EXTENSION_DIST_ZIP
42+ }
43+
3344function build-python27 {
3445 echo " Building New Relic layer for python2.7"
35- rm -rf $BUILD_DIR $PY27_DIST
46+ rm -rf $BUILD_DIR $EXTENSION_DIST_DIR $ PY27_DIST
3647 mkdir -p $DIST_DIR
3748 pip install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR /lib/python2.7/site-packages
3849 cp newrelic_lambda_wrapper.py $BUILD_DIR /lib/python2.7/site-packages/newrelic_lambda_wrapper.py
3950 find $BUILD_DIR -name ' *.pyc' -exec rm -f {} +
40- zip -rq $PY27_DIST $BUILD_DIR
41- rm -rf $BUILD_DIR
51+ download-extension
52+ zip -rq $PY27_DIST $BUILD_DIR $EXTENSION_DIST_DIR
53+ rm -rf $BUILD_DIR $EXTENSION_DIST_DIR
4254 echo " Build complete: ${PY27_DIST} "
4355}
4456
@@ -62,6 +74,7 @@ function publish-python27 {
6274 --layer-name NewRelicPython27 \
6375 --content " S3Bucket=${bucket_name} ,S3Key=${py27_s3key} " \
6476 --description " New Relic Layer for Python 2.7" \
77+ --license-info " Apache-2.0" \
6578 --compatible-runtimes python2.7 \
6679 --region $region \
6780 --output text \
@@ -87,8 +100,9 @@ function build-python36 {
87100 pip install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR /lib/python3.6/site-packages
88101 cp newrelic_lambda_wrapper.py $BUILD_DIR /lib/python3.6/site-packages/newrelic_lambda_wrapper.py
89102 find $BUILD_DIR -name ' __pycache__' -exec rm -rf {} +
90- zip -rq $PY36_DIST $BUILD_DIR
91- rm -rf $BUILD_DIR
103+ download-extension
104+ zip -rq $PY36_DIST $BUILD_DIR $EXTENSION_DIST_DIR
105+ rm -rf $BUILD_DIR $EXTENSION_DIST_DIR
92106 echo " Build complete: ${PY36_DIST} "
93107}
94108
@@ -112,6 +126,7 @@ function publish-python36 {
112126 --layer-name NewRelicPython36 \
113127 --content " S3Bucket=${bucket_name} ,S3Key=${py36_s3key} " \
114128 --description " New Relic Layer for Python 3.6" \
129+ --license-info " Apache-2.0" \
115130 --compatible-runtimes python3.6 \
116131 --region $region \
117132 --output text \
@@ -137,8 +152,9 @@ function build-python37 {
137152 pip install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR /lib/python3.7/site-packages
138153 cp newrelic_lambda_wrapper.py $BUILD_DIR /lib/python3.7/site-packages/newrelic_lambda_wrapper.py
139154 find $BUILD_DIR -name ' __pycache__' -exec rm -rf {} +
140- zip -rq $PY37_DIST $BUILD_DIR
141- rm -rf $BUILD_DIR
155+ download-extension
156+ zip -rq $PY37_DIST $BUILD_DIR $EXTENSION_DIST_DIR
157+ rm -rf $BUILD_DIR $EXTENSION_DIST_DIR
142158 echo " Build complete: ${PY37_DIST} "
143159}
144160
@@ -162,6 +178,7 @@ function publish-python37 {
162178 --layer-name NewRelicPython37 \
163179 --content " S3Bucket=${bucket_name} ,S3Key=${py37_s3key} " \
164180 --description " New Relic Layer for Python 3.7" \
181+ --license-info " Apache-2.0" \
165182 --compatible-runtimes python3.7 \
166183 --region $region \
167184 --output text \
@@ -187,8 +204,9 @@ function build-python38 {
187204 pip install --no-cache-dir -qU newrelic newrelic-lambda -t $BUILD_DIR /lib/python3.8/site-packages
188205 cp newrelic_lambda_wrapper.py $BUILD_DIR /lib/python3.8/site-packages/newrelic_lambda_wrapper.py
189206 find $BUILD_DIR -name ' __pycache__' -exec rm -rf {} +
190- zip -rq $PY38_DIST $BUILD_DIR
191- rm -rf $BUILD_DIR
207+ download-extension
208+ zip -rq $PY38_DIST $BUILD_DIR $EXTENSION_DIST_DIR
209+ rm -rf $BUILD_DIR $EXTENSION_DIST_DIR
192210 echo " Build complete: ${PY38_DIST} "
193211}
194212
@@ -212,6 +230,7 @@ function publish-python38 {
212230 --layer-name NewRelicPython38 \
213231 --content " S3Bucket=${bucket_name} ,S3Key=${py38_s3key} " \
214232 --description " New Relic Layer for Python 3.8" \
233+ --license-info " Apache-2.0" \
215234 --compatible-runtimes python3.8 \
216235 --region $region \
217236 --output text \
0 commit comments