diff --git a/.autover/changes/bootstrap-ambiguous-metadata.json b/.autover/changes/bootstrap-ambiguous-metadata.json new file mode 100644 index 000000000..25f658361 --- /dev/null +++ b/.autover/changes/bootstrap-ambiguous-metadata.json @@ -0,0 +1,11 @@ +{ + "Projects": [ + { + "Name": "Amazon.Lambda.RuntimeSupport", + "Type": "Patch", + "ChangelogMessages": [ + "Distinguish multiple dependency or runtime configuration files from missing files in bootstrap diagnostics." + ] + } + ] +} diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/bootstrap.net8.sh b/Libraries/src/Amazon.Lambda.RuntimeSupport/bootstrap.net8.sh index 9dc77ab3a..a1f1d0906 100644 --- a/Libraries/src/Amazon.Lambda.RuntimeSupport/bootstrap.net8.sh +++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/bootstrap.net8.sh @@ -79,6 +79,11 @@ else if ! [ -f "${DEPS_FILE}" ]; then DEPS_FILES=( "${LAMBDA_TASK_ROOT}"/*.deps.json ) + if [ "${#DEPS_FILES[@]}" -gt 1 ]; then + echo "Error: Found multiple .deps.json files in ${LAMBDA_TASK_ROOT}. Expected ${ASSEMBLY_NAME}.deps.json." 1>&2 + exit 105 + fi + # Check if there were any matches to the *.deps.json glob, and that the glob was resolved # This makes the matching independent from the global `nullopt` shopt's value (https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) if [ "${#DEPS_FILES[@]}" -ne 1 ] || echo "${DEPS_FILES[0]}" | grep -q -F '*'; then @@ -92,6 +97,11 @@ else if ! [ -f "${RUNTIMECONFIG_FILE}" ]; then RUNTIMECONFIG_FILES=( "${LAMBDA_TASK_ROOT}"/*.runtimeconfig.json ) + if [ "${#RUNTIMECONFIG_FILES[@]}" -gt 1 ]; then + echo "Error: Found multiple .runtimeconfig.json files in ${LAMBDA_TASK_ROOT}. Expected ${ASSEMBLY_NAME}.runtimeconfig.json." 1>&2 + exit 106 + fi + # Check if there were any matches to the *.runtimeconfig.json glob, and that the glob was resolved # This makes the matching independent from the global `nullopt` shopt's value (https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) if [ "${#RUNTIMECONFIG_FILES[@]}" -ne 1 ] || echo "${RUNTIMECONFIG_FILES[0]}" | grep -q -F '*'; then diff --git a/Libraries/src/Amazon.Lambda.RuntimeSupport/bootstrap.sh b/Libraries/src/Amazon.Lambda.RuntimeSupport/bootstrap.sh index 2c4a517f9..558843d63 100644 --- a/Libraries/src/Amazon.Lambda.RuntimeSupport/bootstrap.sh +++ b/Libraries/src/Amazon.Lambda.RuntimeSupport/bootstrap.sh @@ -68,6 +68,11 @@ else if ! [ -f "${DEPS_FILE}" ]; then DEPS_FILES=( "${LAMBDA_TASK_ROOT}"/*.deps.json ) + if [ "${#DEPS_FILES[@]}" -gt 1 ]; then + echo "Error: Found multiple .deps.json files in ${LAMBDA_TASK_ROOT}. Expected ${ASSEMBLY_NAME}.deps.json." 1>&2 + exit 105 + fi + # Check if there were any matches to the *.deps.json glob, and that the glob was resolved # This makes the matching independent from the global `nullopt` shopt's value (https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) if [ "${#DEPS_FILES[@]}" -ne 1 ] || echo "${DEPS_FILES[0]}" | grep -q -F '*'; then @@ -81,6 +86,11 @@ else if ! [ -f "${RUNTIMECONFIG_FILE}" ]; then RUNTIMECONFIG_FILES=( "${LAMBDA_TASK_ROOT}"/*.runtimeconfig.json ) + if [ "${#RUNTIMECONFIG_FILES[@]}" -gt 1 ]; then + echo "Error: Found multiple .runtimeconfig.json files in ${LAMBDA_TASK_ROOT}. Expected ${ASSEMBLY_NAME}.runtimeconfig.json." 1>&2 + exit 106 + fi + # Check if there were any matches to the *.runtimeconfig.json glob, and that the glob was resolved # This makes the matching independent from the global `nullopt` shopt's value (https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html) if [ "${#RUNTIMECONFIG_FILES[@]}" -ne 1 ] || echo "${RUNTIMECONFIG_FILES[0]}" | grep -q -F '*'; then @@ -118,4 +128,4 @@ else else exec -- "${AWS_LAMBDA_EXEC_WRAPPER}" "${DOTNET_BIN}" "${DOTNET_EXEC}" "${DOTNET_ARGS[@]}" fi -fi \ No newline at end of file +fi