Skip to content
Florian Sellmayr edited this page Dec 18, 2015 · 6 revisions

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.

in-parallel

Executes child-steps in parallel and waits for all of them to finish successfully. Returns success if all children return success.

Example:

(def pipeline-structure
  `(;...
    (in-parallel
      do-something
      do-something-else)))

run

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.

Example:

(def pipeline-structure
  `(;...
    (in-parallel
      (run do-something afterwards-do-something-else)
      (run do-something2 afterwards-do-something-else2))))

alias

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)))

either

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.

Example:

(def pipeline-structure
  `(;...
    (either
      wait-for-git-commit
      wait-for-manual-trigger)))

junction

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.

Example:

(def pipeline-structure
  `(;...
    (junction
      some-condition
      step-on-success-of-condition
      step-on-failure-of-condition)))

with-workspace

(will be available in LambdaCD 0.6.1)

Creates a temporary workspace and passes it to child steps as the :cwd key in args.

Example:

(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)))