diff --git a/scripts/build_layers.sh b/scripts/build_layers.sh index 8cdfc153..1f18f665 100755 --- a/scripts/build_layers.sh +++ b/scripts/build_layers.sh @@ -126,11 +126,12 @@ function find_and_spec_wheel { # Restore pyproject.toml to a clean state for each build iteration cp pyproject.toml.bak pyproject.toml - # Replace ddtrace source if necessary + # Source checkouts still publish project metadata as "ddtrace", even when + # this function is called while probing for ddtrace_serverless wheels. if [ -n "$DD_TRACE_COMMIT" ]; then - replace_ddtrace_dep "${wheel_basename} = { git = \"https://github.com/DataDog/dd-trace-py.git\", rev = \"$DD_TRACE_COMMIT\" }" + replace_ddtrace_dep "ddtrace = { git = \"https://github.com/DataDog/dd-trace-py.git\", rev = \"$DD_TRACE_COMMIT\" }" elif [ -n "$DD_TRACE_COMMIT_BRANCH" ]; then - replace_ddtrace_dep "${wheel_basename} = { git = \"https://github.com/DataDog/dd-trace-py.git\", branch = \"$DD_TRACE_COMMIT_BRANCH\" }" + replace_ddtrace_dep "ddtrace = { git = \"https://github.com/DataDog/dd-trace-py.git\", branch = \"$DD_TRACE_COMMIT_BRANCH\" }" elif [ -n "$DD_TRACE_WHEEL" ]; then wheel_basename=$(sed 's/^.*\///' <<< ${DD_TRACE_WHEEL%%-*}) replace_ddtrace_dep "${wheel_basename} = { file = \"$DD_TRACE_WHEEL\" }" diff --git a/scripts/publish_layers.sh b/scripts/publish_layers.sh index 31a514d1..ada8e2d4 100755 --- a/scripts/publish_layers.sh +++ b/scripts/publish_layers.sh @@ -69,15 +69,6 @@ PIDS=() # Makes sure any subprocesses will be terminated with this process trap "pkill -P $$; exit 1;" INT -# Check that the layer files exist -for layer_file in "${LAYER_PATHS[@]}" -do - if [ ! -f $layer_file ]; then - echo "Could not find $layer_file." - exit 1 - fi -done - # Determine the target regions if [ -z "$REGIONS" ]; then echo "Region not specified, running for all available regions." @@ -116,6 +107,19 @@ else echo "Layer version specified: $VERSION" fi +# Check that the layer files exist for the layers we'll actually publish +for layer_name in "${LAYERS[@]}"; do + for i in "${!AVAILABLE_LAYERS[@]}"; do + if [[ "${AVAILABLE_LAYERS[$i]}" = "${layer_name}" ]]; then + layer_file="${LAYER_PATHS[$i]}" + if [ ! -f "$layer_file" ]; then + echo "Could not find $layer_file." + exit 1 + fi + fi + done +done + read -p "Ready to publish version $VERSION of layers ${LAYERS[*]} to regions ${REGIONS[*]} (y/n)?" CONT if [ "$CONT" != "y" ]; then echo "Exiting"