Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/roll
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ declare ROLL_PARAMS=()
declare ROLL_CMD_VERB=
declare ROLL_CMD_EXEC=
declare ROLL_CMD_HELP=
declare ROLL_CMD_ANYARGS=(svc env db redis sync shell debug rootnotty rootshell clinotty root node npm cli copyfromcontainer copytocontainer composer grunt magento magerun backup restore duplicate)
declare ROLL_CMD_ANYARGS=(svc env db redis sync shell debug rootnotty rootshell clinotty root node npm cli copyfromcontainer copytocontainer composer grunt magento magerun backup restore restore-full duplicate)

## parse first argument as command and determine validity
if (( "$#" )); then
Expand Down
2 changes: 0 additions & 2 deletions commands/backup.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,7 @@ function backupSourceCode() {
showProgress $step $total "Backing up source code"

local exclude_patterns=(
"--exclude=.git"
"--exclude=node_modules"
"--exclude=vendor"
"--exclude=var/cache"
"--exclude=var/log"
"--exclude=var/session"
Expand Down
17 changes: 12 additions & 5 deletions commands/duplicate.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,19 @@ function createBackup() {

logMessage INFO "Creating backup..."

# The --output-id flag outputs ONLY the backup ID (no warnings)
if backup_id=$("${ROLL_DIR}/bin/roll" backup "${backup_args[@]}" 2>&1); then
# The --output-id flag should output ONLY the backup ID
if backup_output=$("${ROLL_DIR}/bin/roll" backup "${backup_args[@]}" 2>&1); then
backup_exit_code=0
# Remove any whitespace (should just be a number)
backup_id=$(echo "$backup_id" | tr -d ' \n\r\t')
# First try to use the output directly (clean --output-id output)
backup_id=$(echo "$backup_output" | tr -d ' \n\r\t')

# If --output-id didn't work cleanly (warnings mixed in), fall back to regex
if [[ ! "$backup_id" =~ ^[0-9]+$ ]]; then
backup_id=$(echo "$backup_output" | grep -o '[0-9]\{10\}' | tail -1)
fi
else
backup_exit_code=$?
backup_output=""
backup_id=""
fi

Expand All @@ -247,7 +253,8 @@ function createBackup() {
return 0
else
logMessage ERROR "Failed to create backup or get valid backup ID"
logMessage ERROR "Backup command output: '$backup_id'"
logMessage ERROR "Backup command output: '$backup_output'"
logMessage ERROR "Extracted backup ID: '$backup_id'"
logMessage ERROR "Exit code: $backup_exit_code"
return 1
fi
Expand Down
Loading
Loading