Skip to content

Commit d715421

Browse files
authored
Merge pull request #589 from TypedDevs/fix/flaky-strict-mode-test-job
fix(release): handle pipefail in sandbox creation for strict mode
2 parents d6f8c59 + eeed55c commit d715421

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

release.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -376,23 +376,24 @@ function release::sandbox::create() {
376376

377377
# Copy repo content excluding .git, .release-state, node_modules
378378
# Try tar pipe first (faster), fallback to cp + rm for portability
379-
# Disable errexit temporarily to allow tar fallback in strict mode
379+
# Use subshell + || to avoid interfering with caller's shell options
380+
# (set +e alone doesn't disable pipefail, which causes failures in strict mode)
380381
local tar_status=0
381-
set +e
382-
tar --exclude='.git' \
383-
--exclude='.release-state' \
384-
--exclude='node_modules' \
385-
--exclude='.tasks' \
386-
--exclude='tmp' \
387-
-cf - . 2>/dev/null | tar -xf - -C "$SANDBOX_DIR" 2>/dev/null
388-
tar_status=$?
389-
set -e
382+
(
383+
tar --exclude='.git' \
384+
--exclude='.release-state' \
385+
--exclude='node_modules' \
386+
--exclude='.tasks' \
387+
--exclude='tmp' \
388+
-cf - . 2>/dev/null | tar -xf - -C "$SANDBOX_DIR" 2>/dev/null
389+
) || tar_status=$?
390390

391391
if [ "$tar_status" -eq 0 ]; then
392392
release::log_verbose "Copied project files to sandbox (tar)"
393393
else
394394
# Fallback: traditional cp + rm for maximum portability
395-
cp -r . "$SANDBOX_DIR/"
395+
# Use || true since cp may fail on transient files during parallel execution
396+
cp -r . "$SANDBOX_DIR/" 2>/dev/null || true
396397
rm -rf "$SANDBOX_DIR/.git" "$SANDBOX_DIR/.release-state" \
397398
"$SANDBOX_DIR/node_modules" "$SANDBOX_DIR/.tasks" "$SANDBOX_DIR/tmp"
398399
release::log_verbose "Copied project files to sandbox (cp)"

0 commit comments

Comments
 (0)