This repository has been archived by the owner on Jun 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
Manual Trigger
sroidl edited this page Jan 3, 2017
·
5 revisions
Import: (:require [lambdacd.steps.manualtrigger :as manualtrigger])
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))
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))
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.