Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    buildsbuildmaster
    5 Posts 3 Posters 43 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      dwynn_6489
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • jraschJ Offline
        jrasch inedo-engineer
        last edited by

        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;
            }
        }
        
        1 Reply Last reply Reply Quote 0
        • D Offline
          dwynn_6489
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • apxltdA Offline
            apxltd inedo-engineer
            last edited by apxltd

            If you set Warn, will it automatically advance?

            One idea as well... how about also setting a build variable using Set-ReleaseVariable called IsValidBuild, and then using a Variable Value Promotion Requirement (IsValidBuild = true)?

            Founder and CEO, Inedo

            1 Reply Last reply Reply Quote 0
            • D Offline
              dwynn_6489
              last edited by

              Warn will still automatically advance.

              I was able to utilize the Set-ReleaseVariable as you suggested. Thanks!

              1 Reply Last reply Reply Quote 1

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post
              Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation