@aws/ml-container-creator 0.15.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/ml-container-creator",
3
- "version": "0.15.1",
3
+ "version": "1.0.0",
4
4
  "description": "Build and deploy custom ML containers on AWS SageMaker with minimal configuration.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -117,10 +117,12 @@ if [ "${ARG_STATUS}" = true ]; then
117
117
  tar_file=""
118
118
  tar_file=$(find "${LOCAL_RESULTS_DIR}" -name "output.tar.gz" -type f 2>/dev/null | head -1)
119
119
  if [ -n "${tar_file}" ]; then
120
- # Detect whether tar has a leading directory prefix
121
- _tar_first=""
122
- _tar_first=$(tar -tzf "${tar_file}" 2>/dev/null | head -1)
123
- if echo "${_tar_first}" | grep -qE '^[^/]+/$'; then
120
+ # Detect whether ALL entries share a common leading directory prefix
121
+ _tar_prefix_count=""
122
+ _tar_prefix_count=$(tar -tzf "${tar_file}" 2>/dev/null | sed 's|/.*||' | sort -u | wc -l | tr -d ' ')
123
+ _tar_first_dir=""
124
+ _tar_first_dir=$(tar -tzf "${tar_file}" 2>/dev/null | head -1)
125
+ if [ "${_tar_prefix_count}" = "1" ] && echo "${_tar_first_dir}" | grep -qE '^[^/]+/$'; then
124
126
  tar -xzf "${tar_file}" --strip-components=1 -C "${LOCAL_RESULTS_DIR}/output/" 2>/dev/null || true
125
127
  else
126
128
  tar -xzf "${tar_file}" -C "${LOCAL_RESULTS_DIR}/output/" 2>/dev/null || true
@@ -1097,11 +1099,14 @@ if [ "${JOB_STATUS}" = "Completed" ]; then
1097
1099
  # Extract any tar.gz archives (benchmark service packages results as output.tar.gz)
1098
1100
  for ARCHIVE in $(find "${LOCAL_RESULTS_DIR}" -name "*.tar.gz" -type f 2>/dev/null); do
1099
1101
  ARCHIVE_DIR=$(dirname "${ARCHIVE}")
1100
- # Detect whether tar has a leading directory prefix to strip.
1101
- # Some AIPerf versions wrap in output/, others are flat.
1102
- _TAR_FIRST=$(tar -tzf "${ARCHIVE}" 2>/dev/null | head -1)
1103
- if echo "${_TAR_FIRST}" | grep -qE '^[^/]+/$'; then
1104
- # Leading directory (e.g., "output/") strip it
1102
+ # Detect whether ALL entries share a common leading directory prefix.
1103
+ # Only strip if every entry starts with the same dir (e.g., "output/file1", "output/file2").
1104
+ # A flat archive with mixed top-level files/dirs (e.g., "plots/", "profile_export.jsonl")
1105
+ # must NOT be stripped.
1106
+ _TAR_PREFIX=$(tar -tzf "${ARCHIVE}" 2>/dev/null | sed 's|/.*||' | sort -u | wc -l | tr -d ' ')
1107
+ _TAR_FIRST_DIR=$(tar -tzf "${ARCHIVE}" 2>/dev/null | head -1)
1108
+ if [ "${_TAR_PREFIX}" = "1" ] && echo "${_TAR_FIRST_DIR}" | grep -qE '^[^/]+/$'; then
1109
+ # Single common leading directory (e.g., all under "output/") — strip it
1105
1110
  tar -xzf "${ARCHIVE}" --strip-components=1 -C "${ARCHIVE_DIR}" 2>/dev/null || true
1106
1111
  else
1107
1112
  # Flat archive — extract as-is