ABX Action to Auto Delete Failed or Canceled Deployments (SKKB1057)

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.

  1. #--------------------------------------------------------#
  2. #                     Spas Kaloferov                     #
  3. #                   www.kaloferov.com                    #
  4. # bit.ly/The-Twitter      Social     bit.ly/The-LinkedIn #
  5. # bit.ly/The-Gitlab        Git         bit.ly/The-Github #
  6. # bit.ly/The-BSD         License          bit.ly/The-GNU #
  7. #--------------------------------------------------------#
  8. info: |-
  9.   #
  10.   #     VMware Cloud Assembly Blueprint Code Sample    
  11.   #
  12. #-------------------------INPUTS-------------------------#
  13. inputs:
  14.   abx_autoDeleteDeployment:
  15.     type: string
  16.     description: Auto Delete Failed Deployment using casAutoDeleteDeployment-py ABX Action.
  17.     default: 'No'
  18.     title: Auto Delete (ABX)
  19.     #format: hidden
  20.     enum:
  21.      - 'Yes'
  22.       - 'No'

 

 

Final Step

If all went well, go grab a beer.

DISCLAIMER; This is a personal blog. Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated. Any views or opinions are not intended to malign any religion, ethnic group, club, organization, company, or individual.
All content provided on this blog is for informational purposes only. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.
Photos
Unless stated, all photos are the work of the blog owner and are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. If used with watermark, no need to credit to the blog owner. For any edit to photos, including cropping, please contact me first.
Recipes
Unless stated, all recipes are the work of the blog owner and are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. Please credit all recipes to the blog owner and link back to the original blog post.
Downloadable Files
Any downloadable file, including but not limited to pdfs, docs, jpegs, pngs, is provided at the user’s own risk. The owner will not be liable for any losses, injuries, or damages resulting from a corrupted or damaged file.
Comments
Comments are welcome. However, the blog owner reserves the right to edit or delete any comments submitted to this blog without notice due to
– Comments deemed to be spam or questionable spam
– Comments including profanity
– Comments containing language or concepts that could be deemed offensive
– Comments containing hate speech, credible threats, or direct attacks on an individual or group
The blog owner is not responsible for the content in comments.
This policy is subject to change at anytime.

Leave a Reply

Your email address will not be published. Required fields are marked *