We are using vRealize Code Stream to automate some Tasks admins need to routinely do. Last week I ran into an Issue whereby we needed to trigger a pipeline on a Schedule. There are 3 options available natively to trigger pipeline executions but none of then would work for us. I initially thought of using Github Actions to trigger the pipeline thru a webhook but as we are running Code Stream on Prem this ended up and not being possible as detailed in this Blog post.
In the end there were 2 options to do this outside of CodeStream
Cronjob to trigger execution thru the API or using Orchestrator to do the same. Trying to reduce outside dependencies the below was what I ended up using.
The Bundled Action and Code is available here.
vRealize Orchestrator Schedule Action
I firstly created a new Orchestrator Action to trigger a specific pipeline UUID thru the Code Stream API. For this to work I needed to create the Action outside of Orchestrator due to the requirement to use the requests module. I then bundled the libraries needed with the code into a zip file and import it into orchestrator.
The Action require 4 Named Input variables to function.
- vRealizeApplianceURL = FQDN of vRealize Automation Appliance (https://fqdn).
- codestreamUserName = Username for vRealize Automation.
- codestreamPassword = Password for the user (SecureString).
- pipelineUUID = UUID of the pipeline to execute. Obtained from the URL in GUI.
With the action Imported we can go ahead and create a simple workflow which we will be able to schedule.
vRealize Orchestrator Schedule Workflow
For the Workflow I created a bunch of Variables needed by the Action. I created multiple values for the UUID input to allow me to trigger multiple pipelines in every scheduled run.
In the workflow Schema I added a Action element for each Pipeline I would like to trigger. In each element I supply all the details and the variable assigned with the pipeline that needs to be triggered. The only Variable that differ will be for the Pipeline UUID.
The last part is to create the Schedule.
Workaround till we get Native Support
This is not the ideal solution but should work until we get some native support for Timed Triggers in Code Stream.