vRO - CI/CD, Source Control and a proper SDLC

vRealize Orchestrator is an incredibly powerful tool for integrating, automating and orchestrating various aspects associated with Cloud management. In this article, I'll cover some basic concepts and information for adopting best practices when writing your vRO code and managing it like you would any other code.

vro_s.png

The Challenge

While vRO is powerful, and version 8.x is a far cry from the previous iterations, there are still limitations associated with adopting a fully fledged code management solution.

Yes, vRO 8.x comes with git repository integration, however, it’s difficult to make use of proper code branches, merging, pull requests and so forth. In addition, while your code may live in a repo like Github, what good is it if it’s all embedded in XML with a bunch of folder structures scattered all over the show?

Furthermore, how do we automate code quality checks against our repo when the XML is proprietary to vRO?

For a team with multiple developers, how do we control people overwriting our code when we’re working on the same objects? How do we manage what exactly goes from DEV -> UAT -> PROD? What about regression testing? Merging? Branching? What about unit tests? How do we generate a list of changes between one release and another?

We’re entering a new era, now, where, thanks to a special team inside VMware, we can make use of an ecosystem to drive a more qualitative, manageable development process.


High level solution

  • Write code using Visual Studio Code

    • Adopt Typescript and transpile to ES5 Javascript using tsc

    • Use .js and .ts files for your code and check these into a repo

    • Install a VSCode plugin (vRealize Build Tools) to push code to vRO (and vRA), debug on the fly, and get vRO-Specific intellisense/autocomplete PLUS references to your referenced custom libraries and objects (this is still lacking in the vRO UX)

  • Use any git repository

    • Add plugins to check your .ts / .js code to code quality (code smell)

    • Branch, merge, pull requests, approvals and code reviews

    • Run automated unit tests

    • Create / leverage code libraries to implement standards (and reusability) in your organization

  • Run Maven to detect and package your dependencies

  • Build packages as releases - you have visibility of exactly what code / changes / commits goes into each release


Typical Process Flow

  1. Create a git repo (or pull your source)

  2. Create an optional branch

  3. Set a few things and run a few commands in the vRealize Build Tool plugin

  4. Write your functions, libraries, methods, objects in Visual Studio Code (using javascript [.js files] and//or TypeScript [.ts files])

  5. Commit and push your code into your repository (git commit, git push)

  6. Optionally push your code to your development vRO Server

  7. Use pipelines and automation to implement unit tests, code smells etc

  8. Create a Merge Request, get your team to review your code

  9. Merge, use pipelines and automation to build and automate the packaging of your code

  10. Define a release, follow your deployment routine / process


Solution Details

What you need

VS Code

First off, we’re not talking about full-blown Visual Studio. Visual Studio Code (VSCode) is a lightweight version aimed at simplified code editing - not .NET code compilation. It runs on multiple operating systems and supports a rich plugin ecosystem. We have a plugin for this which we use to integrate with vRA / vRO.
https://code.visualstudio.com

The benefits of adopting TypeScript are covered all over the web. Suffice it to say that you can now implement strong typing in your code, lending your methods and objects to more stringent standards. In addition, you can take advantage of Typescript features like Async methods, Interfaces, Generics etc which can all be transpiled into ES5 Javascript - safe for vRO!

JDK 1.8

In order to run your command-line entries to automate or push your code, you’ll need the Java Development Kit 1.8.

Windows: Windows 10 i586 Java Development Kit
Mac: If you’re using a Mac like I am, the easiest way to install JDK 1.8 is by using HomeBrew.
https://brew.sh
Then, go here to see how to install OpenJDK:
https://installvirtual.com/install-openjdk-8-on-mac-using-brew-adoptopenjdk/
Linux: Doing a quick search reveals a ton of resources for JDK on Linux.

Maven

Next in the list is Apache Maven. vRO uses this internally to package / manage dependencies and so forth. We will use it while we write our code to ensure we’re complying with vRO package standards.

Tip: Make sure Maven is available in your System PATH before proceeding.
https://maven.apache.org/download.cgi

Tip 2: Edit / create your ~/.m2/settings.xml file. More information on this here (scroll down to the readme section)
https://github.com/vmware/vrealize-developer-tools

vRealize Developer Tools

The developer tools are a prerequisite for the Build Tools below - it’s a plugin for VSCode that allows us to implement a development environment specifically for vRO and vRA, including things like intellisense and pushing code to vRO / vRA.
https://github.com/vmware/vrealize-developer-tools/

vRealize Build Tools

For now, the vRealize Build Tools is still a fling but there may or may not be plans to open source it :-) The file you’ll download will contain a plugin for vRO as well as a good amount of documentation on how to use the tools.
https://flings.vmware.com/vrealize-build-tools

Documentation for using the tools can be found in the file downloaded. Start with the highlighted file above.

Documentation for using the tools can be found in the file downloaded. Start with the highlighted file above.

A git repository

There are free online offerings like Gitlab, Github and Bitbucket. Alternatively, your company may have a requirement for code to be kept internal, in which case there’s most likely going to be source control in your environment that you’ll need access to, in which to create your repository.

Pipelines, Unit Testing, Quality Checks

For implementing your CI/CD pipelines and so forth, VMware Code Stream would be my recommendation, but there are other customers out there using functionality inside their relevant repositories with plugins, or tools like Jenkins.
This tends to vary from company to company, with tools like Bamboo, Jenkins, Gitlab, Jasmine, etc.