It is a possible solution I would say. Do note that if you add this condition to tasks (and not jobs), you may end up in a position where half your tasks have been executed, and then the job stop because the ping failed and the variable was set to zero. I would probably set it at the job level so that the job either runs or not, but it's your choice. I guess there are pros and cons for each
Anyway, to set the variable: The ping task is a bit funky. It returns success if ping succeds, and throws an exception if it fails. It would have been cleaner to just return true/false instead of throwing an exception imo. To get around it I would add a ping task and uncheck this:
It now returns success even if the ping fails, however the error output is still populated:
You can then set the variable based on the error output (it is empty if success):
{LOGIC(If|String|{TASK(PrevTask|StdErr)}|==||1|0)}
Edited by user
2021-12-09T08:38:32Z
|
Reason: Not specified