\UserConfirmationStep
Pauses progression of a deployment while external authorisation is requested.
This is performed via the default messaging service specified.
Configure using the below code in your deploy.yml
MessagingArguments is an arbitrary array of arguments which is understood by
the service specified as the ConfirmationMessagingService for this project.
See deploynaut/_config/messaging.yml for the default service configuration.
See deploynaut/_config/pipeline.yml for the default step configuration
<code>
Steps:
RequestConfirmationStep:
Class: UserConfirmationStep
MaxDuration: 604800 # Auto time out after a week
Recipients:
- 021971373
- mattpeel@silverstripe.com
# Time delay between each of the above recipients being sent out
RecipientsDelay: 4000
Permissions:
# Permissions required to allow deployment. Ensure that the recipients above are assigned this
- APPROVE_DEPLOYMENT
Messages:
# Messages sent to all users (including <requester>)
Reject: 'Deployment for <project>/<environment> has been rejected'
Approve: 'Deployment for <project>/<environment> has been approved'
TimeOut: 'Deployment approval for <project>/<environment> has timed out due to no response'
# Messages only sent to requester
Request-Requester: 'You requested approval for deployment of <project>/<environment>. Cancel? <abortlink>'
# Messages only sent to specified recipients
Request-Recipient: 'Deployment for <project>/<environment> requested by <requester>. Approve? <approvelink>'
Subjects:
# Subject line for all users
Reject: 'Deployment for <project>/<environment>: Rejected'
Approve: 'Deployment for <project>/<environment>: Approved'
TimeOut: 'Deployment for <project>/<environment>: Timeout'
Request: 'Deployment for <project>/<environment>: Requested'
ServiceArguments:
# Additional arguments that make sense to the ConfirmationMessagingService
from: admin@silverstripe.com
reply-to: noreply@silverstripe.com
</code>
Synopsis
- // constants
- const ALERT_APPROVE = 'Approve';
- const ALERT_TIMEOUT = 'TimeOut';
- const ALERT_REQUEST = 'Request';
- const ALERT_REJECT = 'Reject';
- const ROLE_REQUESTER = 'Requester';
- const ROLE_RECIPIENT = 'Recipient';
- // members
- private static array $db = ;
- private static array $defaults = ;
- private static array $has_one = ;
- private static array $dependencies = ;
- private ConfirmationMessagingService $messagingService = NULL;
- // Inherited members from PipelineStep
- protected $mergedConfig;
- // methods
- public void setMessagingService()
- public ConfirmationMessagingService getMessagingService()
- public boolean hasResponse()
- public void start()
- public boolean canApprove()
- public boolean approve()
- public boolean reject()
- protected boolean checkStatus()
- public void startApproval()
- protected array generateMessageTemplate()
- public array getReplacements()
- protected boolean sendMessage()
- public void getRunningDescription()
- public void allowedActions()
- // Inherited methods from LongRunningPipelineStep
- public int getMaxDuration()
- public boolean isTimedOut()
- public int getAge()
- public void start()
- // Inherited methods from PipelineStep
- public string getTitle()
- public void getTreeTitle()
- public void getNiceName()
- public array getConfigData()
- public void setConfig()
- public string getRunningDescription()
- public mixed getConfigSetting()
- public void finish()
- public void markFailed()
- public boolean isQueued()
- public boolean isRunning()
- public boolean isFinished()
- public boolean isFailed()
- public boolean isAborted()
- public void log()
- protected DNEnvironment getDependentEnvironment()
- public boolean start()
- public boolean abort()
- public array allowedActions()
- public void getDryRun()
Hierarchy
Extends
Constants
Name | Value |
---|---|
ALERT_APPROVE | 'Approve' |
ALERT_TIMEOUT | 'TimeOut' |
ALERT_REQUEST | 'Request' |
ALERT_REJECT | 'Reject' |
ROLE_REQUESTER | 'Requester' |
ROLE_RECIPIENT | 'Recipient' |
Members
private
- $db
- $defaults
- $dependencies
—
array
This step depends on a configured messaging service - $has_one
- $messagingService
—
ConfirmationMessagingService
Currently assigned messaging service
protected
- $mergedConfig
—
array
Cached of config merged with defaults
Methods
protected
- checkStatus() — Report the status of the current request queue and makes sure it hasn't overrun it's time allowed
- generateMessageTemplate() — Finds a message template for a given role and message
- sendMessage() — Sends a message to a specified recipient(s)
public
- allowedActions()
- approve() — When the recipient wishes to approve this request
- canApprove() — Can the current user approve this pipeline?
- getMessagingService() — Get the currently configured messaging service
- getReplacements() — Retrieve message replacements
- getRunningDescription()
- hasResponse() — Determine if the confirmation has been responded to (ether with acceptance, rejection, or cancelled)
- reject() — When the recipient wishes to reject this request
- setMessagingService() — Assign a messaging service for this step
- start()
- startApproval() — Initiate the approval process
Inherited from LongRunningPipelineStep
public
- getAge() — Gets the age of this job in seconds, or 0 if not started
- getMaxDuration() — Determines maximum allowed execution for deployment
- isTimedOut() — Return true if this has timed out
- start()
Inherited from PipelineStep
protected
- getDependentEnvironment() — Tries to look up the value of the 'PerformTestOn' yml key for this step, and return the {@link DNEnvironment} that the key refers to, if set.
public
- abort() — Abort the step immediately, regardless of its current state, performing any cleanup necessary.
- allowedActions() — List of allowed actions the user is all allowed to take on this step
- finish()
- getConfigData() — Unserializes a snippet of configuration that was saved at the time this step was created at {@link Pipeline::start()} so that this step can use that configuration to determine what it needs to do. e.g for SmokeTestPipelineStep this might contain a list of URLs that need to be checked and which status codes to check for.
- getConfigSetting() — Retrieve the value of a specific config setting
- getDryRun()
- getNiceName()
- getRunningDescription() — Describe what the step is currently doing.
- getTitle() — Title of this step
- getTreeTitle()
- isAborted() — Determine if the step has been aborted (Aborted state).
- isFailed() — Determine if the step has failed on its own (Failed state). No further state transitions may occur.
- isFinished() — Determine if this step is in progress (Started state).
- isQueued() — Determine if this step is in progress (Started state).
- isRunning() — Determine if this step is in progress (Started state).
- log() — Log a message to the current log
- markFailed() — Fail this pipeline step
- setConfig()
- start() — Initialise the step unless it's already running (Started state).