Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Halting a pipeline stage without using fail
-
Is there a way to halt a pipeline stage without using the "fail" keyword?
We have a 2 stage pipeline (Build and Deploy). During the all stages, we monitor for programming errors using Event Listeners that trigger on failed executions and send email to operations to review the error (things like variable resolution or syntax errors).
There are also several criteria we look for in the Build stage that should cause it to halt - things like missing build values, other concurrent executions, etc. If any of these criteria are met, we alert the necessary parties and use "fail" to halt the stage. However, using fail also triggers the event listener and sends an email to operations that they don't need.
The desired logic in the plan would look something like
call CheckBuildCriteria ( validBuild => $IsValidBuild ); if $IsValidBuild != true { Halt-Stage; # currently we have to use "fail" here. }
Product: BuildMaster
Version: 6.1.5
-
Hi David,
It's a bit verbose, but you should be able to get away with something like this:
##AH:UseTextMode module CheckBuildCriteria<out $validBuild> { set $validBuild = false; } call CheckBuildCriteria ( validBuild => $IsValidBuild ); try { if !$IsValidBuild { Log-Error Build criteria is invalid...; throw; } # normal plan operations go here... } catch { if !$IsValidBuild { force normal; } }
-
Hi John - thanks for the response. Unfortunately, forcing normal will allow the pipeline to advance to the Deploy stage, which defeats the validation of build criteria (I don't think I made that clear in my original post).
More clearly stated goal: halting a pipeline without using "fail"
more verbose-ly stated goal: we want to be able to differentiate between known issues that should halt a pipeline (i.e. validation of build criteria) and unknown errors that halt a pipeline (i.e. coding errors). Event listeners only know that a pipeline stage failed, not why it failed, so they catch every failure.
Maybe what we are looking for is the ability to control the advancement to the next pipeline stage?
-
If you set Warn, will it automatically advance?
One idea as well... how about also setting a build variable using
Set-ReleaseVariable
calledIsValidBuild
, and then using a Variable Value Promotion Requirement (IsValidBuild = true)?
-
Warn will still automatically advance.
I was able to utilize the Set-ReleaseVariable as you suggested. Thanks!