Liking cljdoc? Tell your friends :D

lambdacd.stepsupport.chaining

Functions that allow you to use LambdaCDs pipeline mechanisms inside a step, i.e. chain several steps together:

(defn some-step [args ctx]
  (chaining args ctx
            (shell/bash injected-ctx "/ " "echo hello ")
            (shell/bash injected-ctx "/ " "echo world ")))

(defn some-step-with-error-handling [args ctx]
  (always-chaining args ctx
                   (run-tests injected-args injected-ctx)
                   (if (= :failure (:status injected-args))
                     (publish-test-failures injected-args injected-ctx))))
Functions that allow you to use LambdaCDs pipeline mechanisms inside a step, i.e. chain several steps together:

```clojure
(defn some-step [args ctx]
  (chaining args ctx
            (shell/bash injected-ctx "/ " "echo hello ")
            (shell/bash injected-ctx "/ " "echo world ")))

(defn some-step-with-error-handling [args ctx]
  (always-chaining args ctx
                   (run-tests injected-args injected-ctx)
                   (if (= :failure (:status injected-args))
                     (publish-test-failures injected-args injected-ctx))))
```

always-chain-steps

(always-chain-steps args ctx & steps)

Like chain-steps but does not stop after failure.

Like `chain-steps` but does not stop after failure.
sourceraw docstring

always-chainingmacro

(always-chaining args ctx & forms)

Like chaining but does not stop on failures. Status of the chain will be failure if one of the steps in the chain failed. Use last-step-status-wins to make the chain succeed even though a step in the chain failed.

Like `chaining` but does not stop on failures. Status of the chain will be failure if one of the steps in the chain failed. Use `last-step-status-wins` to make the chain succeed even though a step in the chain failed.
sourceraw docstring

chain-steps

(chain-steps args ctx & steps)

Takes a number of steps executes them as if they were part of the pipeline, i.e. will execute them one after the other, stop on failures and call the next step with the the results of the previous step as args. Think of this as an opinionated take on execute-steps so for full flexibility, use execute-steps directly.

Look at the chaining-macro for a more flexible syntax.

Example:

(chain-steps (some-args) (some-ctx)
             some-step
             some-other-step)
Takes a number of steps executes them as if they were part of the pipeline, i.e. will execute them one after the other, stop on failures
and call the next step with the the results of the previous step as `args`.
Think of this as an opinionated take on `execute-steps` so for full flexibility, use `execute-steps` directly.

Look at the `chaining`-macro for a more flexible syntax.

Example:
```clojure
(chain-steps (some-args) (some-ctx)
             some-step
             some-other-step)
```
sourceraw docstring

chainingmacro

(chaining args ctx & forms)

Syntactic sugar for chain-steps. Can work with arbitrary code and can inject args and ctx.

Example:

(chaining (some-args) (some-ctx)
          (some-step injected-args injected-ctx)
          (some-other-step injected-args injected-ctx))
Syntactic sugar for `chain-steps`. Can work with arbitrary code and can inject `args` and `ctx`.

Example:
```clojure
(chaining (some-args) (some-ctx)
          (some-step injected-args injected-ctx)
          (some-other-step injected-args injected-ctx))
```
sourceraw docstring

injected-args

Placeholder for args for use in chaining and always-chaining

Placeholder for `args` for use in `chaining` and `always-chaining`
sourceraw docstring

injected-ctx

Placeholder for ctx for use in chaining and always-chaining

Placeholder for `ctx` for use in `chaining` and `always-chaining`
sourceraw docstring

last-step-status-wins

(last-step-status-wins step-result)

Takes a step result from chaining or execute-steps and replaces its status with the status of the last child. Often used together with always-chaining to be able to control the chains end-result after an element of the chain failed (see #122 for details).

Example:

(last-step-status-wins
  (always-chaining args ctx
                   (check-something injected-args injected-ctx)
                   (if (= :failure (:status injected-args))
                     (manualtrigger/wait-for-manual-trigger injected-args injected-ctx)
                     {:status :success})))
Takes a step result from chaining or execute-steps and replaces its status with the status of the last child.
Often used together with always-chaining to be able to control the chains end-result after an element of the chain failed (see [#122](https://github.com/flosell/lambdacd/issues/122) for details).

Example:
```clojure
(last-step-status-wins
  (always-chaining args ctx
                   (check-something injected-args injected-ctx)
                   (if (= :failure (:status injected-args))
                     (manualtrigger/wait-for-manual-trigger injected-args injected-ctx)
                     {:status :success})))
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close