x
login Signup

How can I create a step dynamicaly to run as the last step?

I have a bunch of build procedures which look something like this:

   Build
     FindResource
     CheckOut
     SetProperties
     Build
     Deploy
     PostProcess
     [CleanUp]
 

I want to add a new feature to CheckOut (which happens to be a library procedure, so all build Procedures will inherit this change at once) that requires me to add an "Always Run" step at the end of the Build Procedure (shown as "[CleanUp]" above). I don't want to manually add this to hundreds or build procedures, so I want to do it dynamically from within CheckOut. Is this possible? I can't figure out how to get "ectool createJobStep" to do what I want.

avatar image By alfred 27 asked Jan 03 at 03:04 PM
more ▼
(comments are locked)
10|750 characters needed characters left

1 answer: sort voted first

Alternatively, you could create and run a DSL script that updates all the build procedures through automation. If I understand your use case correctly, you would like to append a step to all these build procedures. The following DSL may do the trick--be careful, it's not tested and could clobber all your procedures:

 getProjects().each { proj ->
   getProcedures(projectName: proj.projectName).each { proc ->
     procedure proc.procedureName, projectName: proj.projectName, {
       if (procedureName.contains("build") ) {
           step "[CleanUP]", alwaysRun: "true", command: "echo cleaning up"
       }
     }
   }
 }

avatar image By gregm 2k answered Jan 03 at 05:59 PM
more ▼
(comments are locked)
avatar image alfred Jan 03 at 06:09 PM

I'm not familiar with DSL scripts, but I get your point. So I take it that "ectool createJobStep" cannot be coaxed to do what I want, and that there is no other Electric Flow API that can help me either?

avatar image lrochette Jan 16 at 09:26 PM

createStep is what you're looking for. Greg's example is in DSL but it's basically what it does. createJobStep is a step that created at runtime but won't exist past the current job.

10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question


Topics:

x6

asked: Jan 03 at 03:04 PM

Seen: 38 times

Last Updated: Jan 16 at 09:26 PM

Related Questions