psake/psake — pull request #68 by rakutensf-malex (2013-07-05 21:50:58+00:00)
Title: Modify psake to support retrying a task that failed due to an exception

When doing automated deployments transient errors can sometimes arise that cause the deployment to fail, particularly when deploying to cloud environments such as Azure.

In many cases, simply retrying the failed operation a second or two later is all that is needed for the operation to succeed so the script can move on instead of having to rerun the entire deployment from the beginning.

The following very basic features were added to psake to address these needs:

- MaxRetries: New optional parameter added to tasks to indicate the # of times a task should be retried at 1 second intervals.
- RetryTriggerErrorPattern: New optional parameter added to tasks to specify regular expressions that can be used to only retry tasks when exceptions with a matching message occurs.

Usage:

Retry 3 times on any failure

task MyTask -maxRetries 3

Retry 3 times only when a certain error occurs

task MyTask -maxRetries 3 -retryTriggerErrorPattern "Service is not currently available."