1

I've got a set of build pipelines and I've developed a new rollback feature. Running the rollback pipeline manually invokes the rollback actions and does what I expect. I'm also trying to capture any build fails (usually manually hitting abort, or the job failing at some step) and then automatically invoke the rollback pipeline. Currently I have it in a post action:

    post {
      aborted {
        def node_props = readYAMLProperties("nodes/${env.ENV}.yaml")
        callRollback(node_props['ROLLBACK_JOB'], env.ENV)
      }
    }

The yaml item ROLLBACK_JOB contains the path to the Rollback pipeline so by invoking callRollback and passing on ROLLBACK_JOB it should kick off the Rollback pipeline with the correct environment passed to it.

This however fails with

WorkflowScript: 142: Expected a step @ line 142, column 13.
           def node_props = readYAMLProperties("nodes/${env.ENV}.yaml")
           ^

From what I can find, I assume I can't define a variable in the post action? I've been Googling all day on how to invoke my rollback pipeline from the post action with no luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.