if [[ ! -z $SSH_KNOWN_HOSTS_FILE ]]; then
SSH_OPTS="$SSH_OPTS -o UserKnownHostsFile=$SSH_KNOWN_HOSTS_FILE"
fi
- timeout ${SSH_TIMEOUT:-"30s"} scp -i ${SSH_KEY:-"$HOME/.ssh/id_rsa"} $SSH_OPTS -r $LOCAL_FILE ${SSH_USER}@${SSH_ADDRESS}:${REMOTE_FILE}
+ timeout ${SSH_TIMEOUT:-"10m"} scp -i ${SSH_KEY:-"$HOME/.ssh/id_rsa"} $SSH_OPTS -r $LOCAL_FILE ${SSH_USER}@${SSH_ADDRESS}:${REMOTE_FILE} || {
+ EXIT_CODE=$?
+ # By default, the "timeout" CLI tool always exits with 124 when the
+ # timeout is exceeded. Unless "--preserve-status" argument is used, the
+ # exit code is never set to the exit code of the command that timed out.
+ if [[ $EXIT_CODE -eq 124 ]]; then
+ echo "ERROR: scp upload timed out"
+ fi
+ return $EXIT_CODE
+ }
}
function scp_download() {
if [[ ! -z $SSH_KNOWN_HOSTS_FILE ]]; then
SSH_OPTS="$SSH_OPTS -o UserKnownHostsFile=$SSH_KNOWN_HOSTS_FILE"
fi
- timeout ${SSH_TIMEOUT:-"30s"} scp -i ${SSH_KEY:-"$HOME/.ssh/id_rsa"} $SSH_OPTS -r ${SSH_USER}@${SSH_ADDRESS}:${REMOTE_FILE} $LOCAL_FILE
+ timeout ${SSH_TIMEOUT:-"10m"} scp -i ${SSH_KEY:-"$HOME/.ssh/id_rsa"} $SSH_OPTS -r ${SSH_USER}@${SSH_ADDRESS}:${REMOTE_FILE} $LOCAL_FILE || {
+ EXIT_CODE=$?
+ # By default, the "timeout" CLI tool always exits with 124 when the
+ # timeout is exceeded. Unless "--preserve-status" argument is used, the
+ # exit code is never set to the exit code of the command that timed out.
+ if [[ $EXIT_CODE -eq 124 ]]; then
+ echo "ERROR: scp download timed out"
+ fi
+ return $EXIT_CODE
+ }
}
function retrycmd_if_failure() {
#
# Setup the Ceph Windows build in the Windows VM
#
-SSH_TIMEOUT=5m scp_upload $WORKSPACE/ceph.zip /ceph.zip
+scp_upload $WORKSPACE/ceph.zip /ceph.zip
SSH_TIMEOUT=10m ssh_exec powershell.exe "\$ProgressPreference='SilentlyContinue'; Expand-Archive -Path /ceph.zip -DestinationPath / -Force"
ssh_exec powershell.exe "Add-MpPreference -ExclusionPath 'C:\ceph'"
ssh_exec powershell.exe "New-Service -Name ceph-rbd -BinaryPathName 'c:\ceph\rbd-wnbd.exe service'"
ssh_exec curl.exe --retry-max-time 30 --retry 10 -L -o /workspace/collect-event-logs.ps1 $COLLECT_EVENT_LOGS_SCRIPT_URL
SSH_TIMEOUT=30m ssh_exec powershell.exe /workspace/collect-event-logs.ps1 -LogDirectory /workspace/eventlogs
scp_download /workspace/eventlogs $WORKSPACE/artifacts/client/eventlogs
+ echo "Successfully retrieved artifacts."
}
trap collect_artifacts EXIT