Quantcast
Channel: VMware Communities : Blog List - All Communities
Viewing all articles
Browse latest Browse all 3135

The road to DevOps for vRO and friends: Setting up development environment

$
0
0

By design, vRealize Orchestrator (vRO) is an IT process automation tool that makes IT operations faster and less error-prone. However, to get the best out of vRO, you need to know how to overcome the most common challenges you may come across. In this blog, we will focus on how to properly set up your development environment and source code control system (SCCS) to gain full traceability of your development process and be able to resolve conflicts.

As with any type of software development, it all starts with an integrated development environment (IDE) and a SCCS. With vRO, the easiest way is not to change the vRO client with another IDE for developing workflows and actions, but just integrate a SCCS with it and define their interaction.

Depending on how much control you want to have over what you are doing, the interaction between the SCCS and vRO can be manual, semi-automated, and automated. The more manual the interaction is, the more control you will have; and you will be able to use all features of the SCCS. The more automated the interaction is, the more limited you will be on what you can do, especially if you use the fully automated one button approach.

In this post, we will focus on the manual, full-control approach, because if you are doing something serious, which as a reader of this blog I believe you do, the best is to have full control over your source code.

So, let's get started. You have to create a vRO package and put it under version control.

Initial project setup

Create an initial vRO package and store it on your file system

To create an initial vRO package, you need a vRO server and a vRO client.

  1. In the Orchestrator client, create a package and add the initial content to the package. See Create a Package in the vRO official documentation.
    Screen Shot 2017-07-31 at 13.54.01.png
  2. Right-click the package and select Expand package to folder.
  3. Choose a folder where you want to store your project files. It can be local or remote.
  4. Uncheck Export version history.

Although this feature may sounds useful, the expanded package cannot be build with the version history. So, it will just add more unnecessary files.

   5.  Click Save.

        The vRO client generates a pom.xml file.

 

Now, you have to modify the generated pom.xml file to generate your package from the initial project files.

Modify the generated pom.xml file

 

  1. Navigate to your project folder.
    The folder structure will look like this:
    Screen Shot 2017-07-31 at 14.07.27.png
  2. Open the generated pom.xml.

        The pom.xml will look like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  <modelVersion>4.0.0</modelVersion>  <!--  Maybe you'd like to change this to point to your organization's groupId-->  <groupId>workflow-designer-exported</groupId>  <artifactId>com.vmware.pscoe.demo</artifactId>  <packaging>package</packaging>  <version>1.0.0-SNAPSHOT</version>  <properties>    <keystoreLocation>--Specify me--</keystoreLocation>    <keystorePassword>--Specify me--</keystorePassword>    <vco.version>7.3.0.5481809</vco.version>    <!-- change to vf for releases: it will lock the workflows -->    <allowedMask>vef</allowedMask>  </properties>  <repositories>    <repository>      <id>added-by-archetype</id>      <name>This repo was added by the 'Expand to file system'</name>      <url>https://172.16.202.131:8281/vco-repo</url>    </repository>  </repositories>  <pluginRepositories>    <pluginRepository>      <id>added-by-archetype</id>      <name>This repo was added by the 'Expand to file system'</name>      <url>https://172.16.202.131:8281/vco-repo</url>    </pluginRepository>  </pluginRepositories>  <build>    <plugins>      <plugin>        <groupId>com.vmware.o11n.mojo.pkg</groupId>        <artifactId>maven-o11n-package-plugin</artifactId>        <version>${vco.version}</version>        <extensions>true</extensions>        <configuration>          <packageName>com.vmware.pscoe.demo</packageName>          <!-- Set the local path to the *.vmokeystore file used to sign the content -->          <keystoreLocation>${keystoreLocation}</keystoreLocation>          <keystorePassword>${keystorePassword}</keystorePassword>          <includes>            <include>**/*.element_info.xml</include>          </includes>          <packageFileName>${project.artifactId}-${project.version}</packageFileName>          <allowedMask>${allowedMask}</allowedMask>          <exportVersionHistory>false</exportVersionHistory>        </configuration>      </plugin>    </plugins>  </build></project>

 

  3.   Modify the Keystore location and password.

        The keystone contains the certificate used to sign the package when creating it. In this case, generate an example self-signed certificate in a keystone following the procedure.

    1. Generate the keystore.
      keytool -genkey -keyalg RSA -alias_DunesRSA_Alias_ -keystore example.keystore -storepass password123 -validity 3650 -keysize 2048
    2. Answer the questions.
    3. Modify the pom.xml
      <keystoreLocation>example.keystore</keystoreLocation>
      <keystorePassword>password123</keystorePassword>

For production usage, use real certificates.

 

  4.  Modify the vRO Version.

       The vRO version is used as a version of the vRO maven plug-in and it needs to correspond to the version of the artifact in the maven repository. In this case, we are using vRO as a maven repository.

    1. Replace the IP address with the hostname/IP address of your server in the URL - https://172.16.202.131:8281/vco-repo/com/vmware/o11n/mojo/pkg/maven-o11n-package-plugin/.
    2. Go to the URL and check the plug-in version. In this case, it shows 7.3.0:

Screen Shot 2017-07-31 at 14.37.43.png

          c.  Change the version in the pom.xml to 7.3.0.

<vco.version>7.3.0</vco.version>

Build the vRO package

Build the package from the project sources using mvn. Navigate to your project folder and run the command:

mvn clean install

If you use vRO as a repository, you have to change the self-signed certificates on the vRO server. Otherwise, use the -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true parameters.

mvn clean install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

Verify the build

Verify that the command has produced a package in the target folder. 

Screen Shot 2017-07-31 at 14.46.06.png

Put the vRO content under source control

In theory, you can use any kind of SCCS, but here is used Github.

Create new repository

Screen Shot 2017-07-31 at 14.50.30.png

Push the changes

Now you are ready to push changes to your Github repository. This is just an example on how to do it:

git init
git remote add origin https://github.com/mslavov/com.vmware.pscoe.demo.git
git pull origin master
git add .
git commit -m "Initial vRO package"
git push -u origin master

 

Continuous Development

Once you have set up your project and added everything under source control, follow this procedure to do incremental changes to your project:

  1. Create a branch in Git.
  2. Checkout the branch using SourceTree or Git cli, or any other Git client.
  3. Build the package and import it in vRO.
  4. Fix an issue or implement a new feature.
  5. "Expand" the package to your file system over the newly checkout branch.
  6. Commit changes to your local branch. (Might do several commits, repeat the steps 5 and 6).
  7. Push the branch to Git.
  8. Create a Pull Request:
    1. Inspect the automatically generated diff;
    2. Add reviewers.
  9. Reviewers inspect the diff and provide comments.
  10. (Optional) Adopt the reviewers suggestions by making new commits with their changes.
  11. Merge the Pull Request.

And there you have it!

Integrating your development environment and source code control system is the first step to proper software development in vRO. Adopting CI/CD will enable you to realize the full potential of agile development and delivery of use cases that fit better to the customers real needs. Following this series of blog posts will help you make it seamless and successful.

Stay tuned!


Viewing all articles
Browse latest Browse all 3135

Trending Articles