diff --git a/.circleci/config.yml b/.circleci/config.yml index 5c3d48d1..87ded33e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,6 +30,19 @@ jobs: name: Publish layer command: make publish-nodejs18x-ci + publish-nodejs20x: + docker: + - image: cimg/node:20.4.0 + steps: + - checkout + - setup_remote_docker + - run: + name: Node 20 unit tests + command: cd nodejs && npm install && npm run test + - run: + name: Publish layer + command: make publish-nodejs20x-ci + publish-python37: docker: - image: cimg/python:3.7 @@ -167,6 +180,16 @@ workflows: - codecov/upload: file: ./nodejs/coverage/unit/lcov.info flags: nodejs-18-unit + - publish-nodejs20x: + filters: + branches: + ignore: /.*/ + tags: + only: /v[0-9]+(\.[0-9]+)*_nodejs/ + post-steps: + - codecov/upload: + file: ./nodejs/coverage/unit/lcov.info + flags: nodejs-20-unit - publish-python37: filters: branches: diff --git a/libBuild.sh b/libBuild.sh index d1b21ad5..758d3bbf 100644 --- a/libBuild.sh +++ b/libBuild.sh @@ -119,6 +119,9 @@ function layer_name_str() { "nodejs18.x") rt_part="NodeJS18X" ;; + "nodejs20.x") + rt_part="NodeJS20X" + ;; esac case $2 in @@ -164,6 +167,9 @@ function s3_prefix() { "nodejs18.x") name="nr-nodejs18.x" ;; + "nodejs20.x") + name="nr-nodejs20.x" + ;; esac echo $name diff --git a/nodejs/publish-layers.sh b/nodejs/publish-layers.sh index 32734a7c..419188c6 100755 --- a/nodejs/publish-layers.sh +++ b/nodejs/publish-layers.sh @@ -9,12 +9,14 @@ source ../libBuild.sh NJS16X_DIST_ARM64=$DIST_DIR/nodejs16x.arm64.zip NJS18X_DIST_ARM64=$DIST_DIR/nodejs18x.arm64.zip +NJS20X_DIST_ARM64=$DIST_DIR/nodejs20x.arm64.zip NJS16X_DIST_X86_64=$DIST_DIR/nodejs16x.x86_64.zip NJS18X_DIST_X86_64=$DIST_DIR/nodejs18x.x86_64.zip +NJS20X_DIST_X86_64=$DIST_DIR/nodejs20x.x86_64.zip function usage { - echo "./publish-layers.sh [nodejs16x|nodejs18x]" + echo "./publish-layers.sh [nodejs16x|nodejs18x|nodejs20x]" } function build-nodejs16x-arm64 { @@ -113,6 +115,54 @@ function publish-nodejs18x-x86 { done } +function build-nodejs20x-arm64 { + echo "Building new relic layer for nodejs20.x (arm64)" + rm -rf $BUILD_DIR $NJS20X_DIST_ARM64 + mkdir -p $DIST_DIR + npm install --prefix $BUILD_DIR newrelic@latest + mkdir -p $BUILD_DIR/node_modules/newrelic-lambda-wrapper + cp index.js $BUILD_DIR/node_modules/newrelic-lambda-wrapper + download_extension arm64 + zip -rq $NJS20X_DIST_ARM64 $BUILD_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE + rm -rf $BUILD_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE + echo "Build complete: ${NJS20X_DIST_ARM64}" +} + +function build-nodejs20x-x86 { + echo "Building new relic layer for nodejs20.x (x86_64)" + rm -rf $BUILD_DIR $NJS20X_DIST_X86_64 + mkdir -p $DIST_DIR + npm install --prefix $BUILD_DIR newrelic@latest + mkdir -p $BUILD_DIR/node_modules/newrelic-lambda-wrapper + cp index.js $BUILD_DIR/node_modules/newrelic-lambda-wrapper + download_extension x86_64 + zip -rq $NJS20X_DIST_X86_64 $BUILD_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE + rm -rf $BUILD_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE + echo "Build complete: ${NJS20X_DIST_X86_64}" +} + +function publish-nodejs20x-arm64 { + if [ ! -f $NJS20X_DIST_ARM64 ]; then + echo "Package not found: ${NJS20X_DIST_ARM64}" + exit 1 + fi + + for region in "${REGIONS_ARM[@]}"; do + publish_layer $NJS20X_DIST_ARM64 $region nodejs20.x arm64 + done +} + +function publish-nodejs20x-x86 { + if [ ! -f $NJS20X_DIST_X86_64 ]; then + echo "Package not found: ${NJS20X_DIST_X86_64}" + exit 1 + fi + + for region in "${REGIONS_X86[@]}"; do + publish_layer $NJS20X_DIST_X86_64 $region nodejs20.x x86_64 + done +} + case "$1" in "build-nodejs16x") build-nodejs16x-arm64 @@ -130,6 +180,14 @@ case "$1" in publish-nodejs18x-arm64 publish-nodejs18x-x86 ;; +"build-nodejs20x") + build-nodejs20x-arm64 + build-nodejs20x-x86 + ;; +"publish-nodejs20x") + publish-nodejs20x-arm64 + publish-nodejs20x-x86 + ;; "nodejs16x") $0 build-nodejs16x $0 publish-nodejs16x @@ -138,6 +196,10 @@ case "$1" in $0 build-nodejs18x $0 publish-nodejs18x ;; +"nodejs20x") + $0 build-nodejs20x + $0 publish-nodejs20x + ;; *) usage ;;