-
Notifications
You must be signed in to change notification settings - Fork 58
Control Flow
Import: (:require [lambdacd.steps.control-flow :refer :all])
All control flow steps are functions that take a set of child steps and return a build-step that executes those children in a particular manner.
Executes child-steps in parallel and waits for all of them to finish successfully. Returns success if all children return success.
(def pipeline-structure
`(;...
(in-parallel
do-something
do-something-else)))
Executes child-steps sequentially, just like they would in a normal pipeline. Can be used to group steps logically or to create sub-pipelines where normally only a single step would be expected.
(def pipeline-structure
`(;...
(in-parallel
(run do-something afterwards-do-something-else)
(run do-something2 afterwards-do-something-else2))))
Renames a step in the UI.
Example:
(def pipeline-structure
`(;...
(alias "test and build"
(run
run-tests
build-artifact))
(alias "wait for signoff"
wait-for-manual-trigger)))
Executes all child-steps in parallel and returns after one of the childs was successful Then kills all remaining children. Returns success if at least one child was successful. Often used to have multiple triggers for a pipeline.
(def pipeline-structure
`(;...
(either
wait-for-git-commit
wait-for-manual-trigger)))
Receives three children: A condition step and two steps, one of which will be executed depending on the result of condition step. Returns the success of the called branch.
(def pipeline-structure
`(;...
(junction
some-condition
step-on-success-of-condition
step-on-failure-of-condition)))
(will be available in LambdaCD 0.6.1)
Creates a temporary workspace and passes it to child steps as the :cwd
key in args
.
(defn fetch-artifact [args ctx]
(shell/bash ctx (:cwd args)
"wget http://example.com/some-hello-world-script"
"chmod +x some-hello-world-script"))
(defn run-artifact [args ctx]
(shell/bash ctx (:cwd args)
"./some-hello-world-script"))
(def pipeline-structure
`(;...
(with-workspace
fetch-artifact
run-artifact)))