Skip to content
Florian Sellmayr edited this page Aug 14, 2016 · 5 revisions

Overview

Import: (:require [lambdacd.steps.support :as support])

Contains support functionality to compose more complex build steps

Features

capture-output [ctx & body]

Macro that wraps the given body with *out* redirected to the output of the build step instead of stdout. Useful if you need your build steps to output text.

Example:

(defn some-build-step [args ctx]
  (capture-output ctx (println "Hello")
                      (println "World")
                      {:status :success}))
; Step Result: => {:out "Hello\nWorld\n" :status :success }

chain-steps [args ctx & steps]

Executes a number of build steps sequentially. Behaves as if those steps were part of a pipeline, i.e. data can be passed from one step to the other, stops after the first failure, ...

Useful if you want to combine several of your build steps into one more coarse-grained build step.

Example

(defn some-step [args ctx]
  (chain-steps args ctx some-other-step
                        some-third-step))

chaining [args ctx & forms]

Macro around chain-steps that allows defining chained steps inline.

(note bug #93 (fixed in versions >0.7.0))

Example:

(:require [lambdacd.steps.support :as support :refer [chaining injected-args injected-ctx])

(defn some-step [args ctx]
  (chaining args ctx (some-other-step injected-args injected-ctx)
                     (some-third-step injected-args injected-ctx)
                     (some-step-that-doesnt-need-parameters)
                     (some-step-with-parameters "param1" (:param2 injected-args) 42)))

; ---

(defn some-step-where-we-debug [args ctx]
  (capture-output ctx
             (chaining args ctx
                       (some-step injected-args injected-ctx)
                       (print "foo-value:" (:foo injected-args)) ; 
                       (some-other-step injected-args injected-ctx))))

always-chain-steps [args ctx & steps]

(will be available in LambdaCD 0.9.0)

Like chain-steps but does not stop execution when one step fails.

Useful if you want to combine several steps that should always have to be called, e.g. running tests and processing the test results independent of whether tests failed.

always-chaining [args ctx & forms]

(will be available in LambdaCD 0.9.0)

Like chaining but does not stop execution when one step fails (see always-chain-steps).

last-step-status-wins [step-result]

(will be available in LambdaCD 0.9.4)

Utility function to change the status of always-chaining to the status of the last step. Per default, always-chaining executes all steps but returns :failure whenever one step in the chain fails. last-step-status-wins uses the results the individual steps of the chain to determine the status of the last step and returns this one. (see #122 for details)