Programmatically abort updates

Is it possible to have a hook in the update workflow that does some validation and aborts the update?
Eg if url_errors.log contains 5xx errors, abort (and send email alert).

Hi Mr. Cook.

You could try using workflow commands which can abort the update if the script returns a non-zero status.

For example, if you want to abort an update after the gather phase on web collection based on url_error.log, you could do the following:

  • Create groovy script which consumes url_errors.log and runs the test you need. If the tests do not pass, throw an exception which causes the script to “fail”
  • In collection.cfg, reference this script in post_gather_command e.g. post_gather_command=$GROOVY_COMMAND /path/to/script/AbortOnTooManyErrors.groovy

Note: Please pay special attention to the way you specify workflow commands so that you have an easier time during upgrades.

Hope this helps.

~Gioan

Perfect, this sounds very straightforward thanks Gioan!

Just reporting back, I’ve been able to cause the update to abort by returning an error code from a bash script in a workflow command:
post_gather_command

In the bash file:
exit 1

1 Like