Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extension/publish-layer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function publish-layer-x86 {
fi

for region in "${REGIONS_X86[@]}"; do
publish_layer $EXTENSION_DIST_ZIP_X86_64 $region provided x86_64
publish_layer $EXTENSION_DIST_ZIP_X86_64 $region provided x86_64 provided
done
}

Expand All @@ -43,7 +43,7 @@ function publish-layer-arm64 {
fi

for region in "${REGIONS_ARM[@]}"; do
publish_layer $EXTENSION_DIST_ZIP_ARM64 $region provided arm64
publish_layer $EXTENSION_DIST_ZIP_ARM64 $region provided arm64 provided
done
}

Expand Down
50 changes: 48 additions & 2 deletions libBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,34 @@ function s3_prefix() {
echo $name
}

function agent_name_str() {
local runtime=$1
local agent_name

case $runtime in
"provided")
agent_name="provided"
;;
"nodejs18.x"|"nodejs20.x"|"nodejs22.x")
agent_name="Node"
;;
"ruby3.2"|"ruby3.3")
agent_name="Ruby"
;;
"java8.al2"|"java11"|"java17"|"java21")
agent_name="Java"
;;
"python3.8"|"python3.9"|"python3.10"|"python3.11"|"python3.12"|"python3.13")
agent_name="Python"
;;
*)
agent_name="none"
;;
esac

echo $agent_name
}

function hash_file() {
if command -v md5sum &> /dev/null ; then
md5sum $1 | awk '{ print $1 }'
Expand All @@ -218,7 +246,8 @@ function publish_layer {
region=$2
runtime_name=$3
arch=$4

newrelic_agent_version=${5:-"none"}
agent_name=$( agent_name_str $runtime_name )
layer_name=$( layer_name_str $runtime_name $arch )

hash=$( hash_file $layer_archive | awk '{ print $1 }' )
Expand All @@ -243,11 +272,28 @@ function publish_layer {
else arch_flag=""
fi

base_description="New Relic Layer for ${runtime_name} (${arch})"

if [[ $newrelic_agent_version != "none" ]]; then
extension_info=" with New Relic Extension v${EXTENSION_VERSION}"

if [[ $agent_name != "provided" ]]; then
agent_info=" and ${agent_name} agent v${newrelic_agent_version}"
else
base_description="New Relic Layer for OS only runtime (${arch})"
agent_info=""
fi

description="${base_description}${extension_info}${agent_info}"
else
description="${base_description}."
fi

echo "Publishing ${runtime_name} layer to ${region}"
layer_version=$(aws lambda publish-layer-version \
--layer-name ${layer_name} \
--content "S3Bucket=${bucket_name},S3Key=${s3_key}" \
--description "New Relic Layer for ${runtime_name} (${arch})" \
--description "${description}"\
--license-info "Apache-2.0" $arch_flag \
--compatible-runtimes ${compat_list[*]} \
--region "$region" \
Expand Down
6 changes: 5 additions & 1 deletion nodejs/publish-layers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function build_wrapper {
rm -rf $BUILD_DIR $ZIP
mkdir -p $DIST_DIR
npm install --prefix $BUILD_DIR newrelic@latest
NEWRELIC_AGENT_VERSION=$(npm list newrelic --prefix $BUILD_DIR | grep newrelic@ | awk -F '@' '{print $2}')
touch $DIST_DIR/nr-env
echo "NEWRELIC_AGENT_VERSION=$NEWRELIC_AGENT_VERSION" > $DIST_DIR/nr-env
mkdir -p $BUILD_DIR/node_modules/newrelic-lambda-wrapper
cp index.js $BUILD_DIR/node_modules/newrelic-lambda-wrapper
mkdir -p $BUILD_DIR/node_modules/newrelic-esm-lambda-wrapper
Expand All @@ -44,13 +47,14 @@ function publish_wrapper {
node_version=$1
arch=$2
ZIP=$DIST_DIR/nodejs${node_version}x.${arch}.zip
source $DIST_DIR/nr-env
if [ ! -f $ZIP ]; then
echo "Package not found: ${ZIP}"
exit 1
fi

for region in "${REGIONS_ARM[@]}"; do
publish_layer $ZIP $region nodejs${node_version}.x ${arch}
publish_layer $ZIP $region nodejs${node_version}.x ${arch} $NEWRELIC_AGENT_VERSION
done
}

Expand Down
Loading