Skip to content

Commit

Permalink
NATIVE-QUARKUS-AMAZON-LAMBDA-ARCH: NATIVE-QUARKUS-AMAZON-LAMBDA-ARCH:…
Browse files Browse the repository at this point in the history
… Added following to manage.sh:

- Extract the major version number for the build, appending to the Java runtime variable
- Set the native runtime to a variable for easier identification, with comment indicating where to find the current options
- Added detection and setting of architecture based on machine being used to build the lambda
  • Loading branch information
arthurb-dvla authored and Art051 committed May 27, 2024
1 parent c2025ff commit ef42748
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

ARCHITECTURE=$(arch)
JAVA_MAJOR_VERSION_NUM=$(echo 'var rt_version = Runtime.class.getMethod("version"); var version = rt_version.invoke(null); System.out.println(rt_version.getReturnType().getMethod("major").invoke(version))' | jshell -)
LAMBDA_NATIVE_RUNTIME="provided.al2023" # The current runtimes available are available within AWS lambda documentation

function cmd_create() {
echo Creating function
set -x
Expand All @@ -11,6 +15,7 @@ function cmd_create() {
--role ${LAMBDA_ROLE_ARN} \
--timeout 15 \
--memory-size 256 \
--architectures "${ARCHITECTURE}" \
${LAMBDA_META}
# Enable and move this param above ${LAMBDA_META}, if using AWS X-Ray
# --tracing-config Mode=Active \
Expand Down Expand Up @@ -51,7 +56,7 @@ function cmd_update() {

FUNCTION_NAME=${lambdaName}
HANDLER=${handler}
RUNTIME=java17
RUNTIME=java${JAVA_MAJOR_VERSION_NUM}
ZIP_FILE=${targetUri}

function usage() {
Expand All @@ -70,7 +75,7 @@ fi

if [ "$1" == "native" ]
then
RUNTIME=provided
RUNTIME=${LAMBDA_NATIVE_RUNTIME}
ZIP_FILE=${targetUri}
FUNCTION_NAME=${lambdaName}Native
LAMBDA_META="--environment Variables={DISABLE_SIGNAL_HANDLERS=true}"
Expand Down

0 comments on commit ef42748

Please sign in to comment.