Skip to content
Florian Sellmayr edited this page Oct 23, 2016 · 10 revisions

LambdaCD is configurable through the config hash given to the assemble-pipeline function:

(let [config {:home-dir home-dir
              :name "some pipeline"
              :shutdown-sequence lambdacd.core/default-shutdown-sequence
              :ms-to-wait-for-shutdown (* 10 1000)
              :max-builds Integer/MAX_VALUE
              :step-updates-per-sec 10
              :ui-config {:expand-active-default true
                          :expand-failures-default true}}
      pipeline (core/assemble-pipeline pipeline-def config)]
  ; ...
)

This hash is used by a variety of components inside of LambdaCD. These options are currently available:

  • :home-dir: Configures the directory used by LambdaCD to store internal data (e.g. build history, workspaces, ...)
  • :name (optional): If set, this name is displayed in the UI
  • :shutdown-sequence (optional): A function taking one argument (ctx) that is called when shutting down LambdaCD. Defaults to default-shutdown-sequence which stops the pipeline runner, kills active pipelines and finalizes persistence (since version 0.8.0)
  • :ms-to-wait-for-shutdown (optional): Max time in milliseconds to wait for build steps to be killed before continuing shutdown (since version 0.8.0). Defaults to 10 seconds.
  • :max-builds (optional): Maximum number of builds to keep in history. Will truncate even if build is running so don't set this value too low. Defaults to Integer/MAX_VALUE (since version 0.9.5)
  • :step-updates-per-sec (optional): Build steps are throttled if they update their state more than this number of times. Throttled update-messages might be combined with subsequent ones. Set to nil to disable throttling completely. More updates per sec make the UI more responsive but also add load to the system; worst case, too many updates can lead to a deadlock. (defaults to 10, available since version 0.11.0)
  • :ui-config (optional): Configuration for the UI (since version 0.8.0)
    • :expand-active-default: Configures if active steps should be expanded by default
    • :expand-failures-default: Configures if failed steps should be expanded by default

The hash is also available to build steps through the ctx-value to add custom configuration for build steps:

(let [config {:home-dir home-dir
              :some-feature-active true}
      pipeline (core/assemble-pipeline pipeline-def config)]
  ; ...
)

; ... 

(defn some-step [args ctx]
  (if (:some-feature-active (:config ctx))
    (do-something-with-feature)
    (do-something-without-feature)))