Skip to content
sroidl edited this page Jan 3, 2017 · 5 revisions

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

wait-for-manual-trigger [args ctx]

Step that can be integrated into the pipeline to wait until a user manually triggers it. Usually used as a first pipeline step to start the pipeline or to wait for user interaction before critical steps like deploying to a production system.

(def pipeline
 `(manualtrigger/wait-for-manual-trigger
   do-something
   do-something-else
   manualtrigger/wait-for-manual-trigger
   do-something-critical-after-the-user-has-approved))

parameterized-trigger [parameter-config ctx]

Returns a manual-trigger that prompts the user for input in the UI. Often used to parameterize a pipeline run, e.g. to specify a version to be deployed.

(defn wait-for-version [args ctx] ;args not needed
  (manualtrigger/parameterized-trigger {:version { :desc "version to deploy"}} ctx))

(def deploy-version [{version :version} ctx]
  (do-something-to-deploy version))

(def pipeline
 `(wait-for-version
   deploy-version))

Implementation Details

The manual triggering mechanism consists of three parts:

  • The wait-for-manual-trigger step: Immediately sends a random :trigger-id through the step-result-channel and then waits for this id to be sent on the :manual-trigger-received channel of the Event Bus
  • The ui-server: Exposes an endpoint that receives POST requests with trigger-ids and puts them on the Event Bus
  • The UI: Detects steps with a trigger-id and renders a control that, when clicked, sends a post request to the server.