In this blog post we are going to look at an ABX action that allows us auto delete failed or canceled deployments in VMware Cloud Assembly.
Update Log:
Introduction
Action features:
- AutoDelete failed or canceled deployments.
- Support failure during deployment create or update .
- Ability to turn AutoDelete off per deployment/blueprint basis.
The action can be found on the following Gitlab Repo bit.ly/The-Gitlab. Action name is casAutoDeleteDeployment
Let’s dig in into the action to see what it does.
Using the ABX Inputs
Let’s examine the blueprint inputs and what they do:
- deleteDelayIn (String): Delete delay in seconds after which the deployment is deleted. Max 480 seconds (8 min)
- deploymentIdABXIn (String): Deployment ID when testing the action via the TEST button, otherwise not needed.
- actionOptionTokenProviderIn: (String): Select the token provider for the action. This is from where the tokens will be read
- context: Use User context. User must have permissions to delete the deployment. This will work from vRA 8.3 or vRA Cloud Oct/2020 release.
- awssm: Use AWS Secrets Manager
- awsSmRegionNameIn (String): AWS Secrets Manager Region Name e.g. us-west-2
- awsSmCspTokenSecretIdIn (String): AWS Secrets Manager CSP Token Secret ID
- inputs: Use action inputs for secrets
- cspRefreshTokenIn (String): CSP Token
Now let’s say I want to execute and want to provide the CSP Refresh Token via action inputs. I also want to add 2 minute delay before a deployment is deleted.
I will have to configure the action inputs as follows:
- deleteDelayIn: 120
- deploymentIdABXIn: <Optional>
- actionOptionTokenProviderIn: inputs
- cspRefreshTokenIn : <MyToken>
- awsSmRegionNameIn: <Optional>
- awsSmCspTokenSecretIdIn: <Optional>
For the Subscription we are going to use the Deployment Completed (deployment.request.post) Event Topic.
Optional we can provide Condition filter as well: event.data.requestInputs.abx_autoDeleteDeployment != "No"
Setting the filter like this will trigger the action for all deployments that do not have an input called autoDeleteDeployment with value “No”
If we want to troubleshoot a particular blueprint deployment failure we don’t have to deactivate or change our subscription.
We just need to create the below input in the BP and run another deployment.
[sourcecode language=”yaml”]
#——————————————————–#
# Spas Kaloferov #
# www.kaloferov.com #
# bit.ly/The-Twitter Social bit.ly/The-LinkedIn #
# bit.ly/The-Gitlab Git bit.ly/The-Github #
# bit.ly/The-BSD License bit.ly/The-GNU #
#——————————————————–#
info: |-
#
# VMware Cloud Assembly Blueprint Code Sample
#
#————————-INPUTS————————-#
inputs:
abx_autoDeleteDeployment:
type: string
description: Auto Delete Failed Deployment using casAutoDeleteDeployment-py ABX Action.
default: ‘No’
title: Auto Delete (ABX)
#format: hidden
enum:
– ‘Yes’
– ‘No’
…
[/sourcecode]
Final Step
If all went well, go grab a beer.
include_once TEMPLATEPATH."/../../../itBlogDisclaimer.php"; ?>