SDK Reference
policy
The policy
module provides return values for the policy function, allowing you to control deployment behavior based on conditions.
Allowed in
- policy
Usage
Load the module:
Example
API Reference
ready(inputs=, valid=None)
Returns a value indicating that the current build is ready to be deployed in the current environment.
Arguments
inputs
: Dictionary mapping string names to input values fromstatic()
ordependency()
valid
: Time at which this deployment will be considered valid (future deployments will be paused until this time)
Returns
- Policy result indicating deployment readiness
later(msg="")
Returns a value indicating that the deployment cannot proceed now but will be able to proceed when certain conditions are met.
Arguments
msg
: Message explaining what is blocking the deployment
Returns
- Policy result indicating deployment should be retried later
skip()
Returns a value indicating this package should not be deployed in the current environment. If a build of this package is already deployed, it will be destroyed.
Returns
- Policy result indicating deployment should be skipped
static(value)
Specifies a static input value to be passed into the ready function.
Arguments
value
: The static value to pass into the ready function
Returns
- Input specification for use in
ready()
dependency(package, output=None, repo_id=None, environment=None, secret_name=None)
Specifies a dependency input value to be passed into the ready function.
Arguments
package
: Package name of the dependency (cannot be current package)repo_id
: Optional repository ID containing the dependency (defaults to current repository)environment
: Optional environment where dependency was builtsecret_name
: Name of secret to use as input value (mutually exclusive withoutput
)output
: Name of deployment output to use as input value (mutually exclusive withsecret_name
)
Returns
- Input specification for use in
ready()