Is there a way I can re-initiate failed tasks or agent phase in a TFS release?
Understand your concern. However, this is not supported at present with on-premises TFS Server 2018.
When you're doing a PROD drop and a step near the end randomly fails, then you can't just rerun from that failed step. Had to re-deploy.
To re-run failed task/step:
Actually, there is a related user voice.
Rerun failed build task/step
https://developercommunity.visualstudio.com/idea/365697/rerun-failed-build-taskstep.html
Multiple people commented and echoed. You could monitor the status of above user voice.
To re-run failed agent phase/ agent job
Also a related user voice:
Retry failed run with multi-stage pipelines
However, this is has been released with Azure DevOps Service now: https://docs.microsoft.com/en-us/azure/devops/release-notes/2019/sprint-158-update#retry-failed-stages Still not available with Azure DevOps/TFS on-premises. Generally, it won't be long until it's released with latest Azure DevOps version.
With all that said, I think you still have to re-deploy on TFS 2018 at present. Sorry for any inconvenience.
In TFS 2018 you don't have this option.
However, in Azure Pipelines you have the option to re-run failed jobs, so I guess in the next release of Azure DevOps Server (TFS) this feature will be.
Recently the retryCountOnTaskFailure
argument was introduced:
- task: <name of task> retryCountOnTaskFailure: <max number of retries> ...