Actions/Javascript Based Project
Overview¶
| Field | Value |
|---|---|
| Name | actions |
| Archetype Group ID | com.vmware.pscoe.o11n.archetypes |
| Archetype Artifact ID | package-actions-archetype |
| Package extension | package |
| Product compatibility | VCF Operations Orchestrator (9.x) Aria Automation Orchestrator (8.x) vRealize Orchestrator (7.x) |
Actions (Javascript) project type is one of the available Orchestrator project types in Build Tools for VMware Aria. The project type is a representation of Orchestrator Actions into JS format. The project consist of local content container and remote content descriptor on the target server. During build operation the contents of the container are packaged into Orchestrator native package (the same package that can be exported/imported from Orchestrator UI -> Assets -> Packages).
- Content Descriptor defines what Orchestrator content will be part of this project when exporting content. The Orchestrator package from UI -> Assets -> Packages plays this role and defines what content is exported. For more information refer to the pull operation section below.
- Content Container holds the actual content representation -
./srcfolder.
The actions project type also allows the user to write unit tests and has embedded code coverage.
Supported Content¶
Actions
Create New Orchestrator Project¶
Build Tools for VMware Aria provides ready to use Orchestrator project templates (maven archetypes).
To create a new Orchestrator project from archetype use the following command:
mvn archetype:generate \
-DinteractiveMode=false \
-DarchetypeGroupId=vmware.pscoe.o11n.archetypes \
-DarchetypeArtifactId=package-actions-archetype \
-DarchetypeVersion=4.24.1 \
-DgroupId=com.company.department \
-DartifactId=vro-actions
mvn archetype:generate `
-DinteractiveMode=false `
-DarchetypeGroupId=vmware.pscoe.o11n.archetypes `
-DarchetypeArtifactId=package-actions-archetype `
-DarchetypeVersion=4.24.1 `
-DgroupId=com.company.department `
-DartifactId=vro-actions
mvn archetype:generate ^
-DinteractiveMode=false ^
-DarchetypeGroupId=vmware.pscoe.o11n.archetypes ^
-DarchetypeArtifactId=package-actions-archetype ^
-DarchetypeVersion=4.24.1 ^
-DgroupId=com.company.department ^
-DartifactId=vro-actions
Expand for Description of Defined Properties for the Command
Following is a list of the properties that you define in the command for generating a project from the archetype with details about their expected and default values.
- The
interactiveModeflag specifies whether you want to run the command in interactive mode. - The
archetypeGroupIdproperty defines the group ID of the archetype (project template) that you want to use for the project. For VCF Operations Orchestrator Actions projects, make sure to set the value tovmware.pscoe.o11n.archetypes. - The
archetypeArtifactIdproperty defines the artifact ID of the archetype (project template) that you want to use for the project. For VCF Operations Orchestrator Actions projects, make sure to set the value topackage-actions-archetype. -
The
archetypeVersionproperty is optional and defines the version of the archetype (project template) that you want to use for the project. This version matches the version of Build Tools for VMware Aria.Note
Note that if you do not specify a value for the
archetypeVersionproperty, the command uses the default value of2.38.1. However, since the archetype content changes, you are advised to use an up-to-date version. -
The
groupIdproperty defines the distinct identifier of the group to which your project belongs. You should use this property to define the base name of the company or the group that creates the project. It acts as a namespace that ensures that project names don't clash with each other. It is recommended to choose agroupIdthat reflects your organization or main project. - The
artifactIdproperty defines the unique identifier for your project or module (within the company or project group). It represents the name of the artifact that is generated by the project. It is recommended to use anartifactIdvalue that reflects the specific project (and project type in multi-module projects).
Content Structure¶
The result of this command will produce the following project file structure:
group_id: com.company.bu
group_id_hint: The groupId in Maven is a distinctive identifier specifically used for a project. It acts as a namespace, ensuring that project names don't clash with each other. It is recommended to choose a groupId that reflects your organization or project.
artifact_id: project.type
service-automation
├── README.md
├── pom.xml
├── release.sh
└── src
└── main
└── resources
└── com
└── company
└── bu
└── project
└── type
└── sample.js
└── test
└── resources
└── com
└── company
└── bu
└── project
└── type
└── SampleTests.js
Environment Connection Parameters¶
The following need to be added to the profile that you intend to use:
<!-- (1)! -->
<profile>
<!-- ..... OTHER DIRECTIVES ..... -->
<vro.host>flt-auto01.corp.internal</vro.host>
<vro.auth>vra|basic</vro.auth>
<vro.authHost>flt-auto01.corp.internal</vro.authHost>
<vro.authPort>443</vro.authPort>
<vro.port>443</vro.port>
<vro.username>configurationadmin</vro.username>
<vro.password>someSecurePassword</vro.password>
</profile>
- The location of the
settings.xmlfile for MacOS is~/.m2andC:\Users\username\\.m2for Windows.
Configuration:
-
vro.username- For VCF Operations Orchestrator (9.x) you need to provide username in the following format: user@domain.- admin@System - Provider admin.
- configurationadmin@Classic - Classic organization admin.
-
vro.auth- Defines the authentication type used for REST API communication.- Supported values:
vra,basic(depending on Orchestrator version might need to be explicitly enabled in the product). - If set to
vra,vro.authHostandvro.authPortneed to be provided with the hostname and port of the target VCFA server.
- Supported values:
Use the profile by passing it with -P, e.g.:
mvn vrealize:push -Ptarget-env
Operations¶
Build the Project¶
This section describes the operation for building the project.
Overview¶
A Maven goal for compiling the code into a deployment-ready package.
Usage¶
To build the project, use the following command.
mvn clean package
The output of the command will result in com.company.department.project.type-1.0.0-SNAPSHOT.package file generated in the target folder of the project. This is an Orchestrator native package that can be imported from Orchestrator UI -> Assets -> Packages.
Bundle the Project¶
This section describes the operation for bundling the project.
Overview¶
A Maven goal for producing an installation bundle that contains the solution package, all its dependencies, and scripts for deploying them to a target environment.
Usage¶
To bundle the project, use the following command.
mvn clean package -Pbundle-with-installer
For more information about using the bundle, see the documentation of the Installer CLI tool.
Pull Content¶
Overview¶
When working on an Orchestrator XML project, you mainly make changes on a live server using the Orchestrator UI and then you can capture those changes in the maven project on your filesystem to be able to store the content, track changes, collaborate, etc.
Usage¶
To support this use case, a custom maven goal vro:pull is used. During this operation the package in Orchestrator UI -> Assets -> Packages has the role of Content Descriptor and defines what content is exported. Everything added to that package is exported during pull operation.
The following command will pull the content outlined into the Orchestrator package to the current project from a specified server and expand its content in the local filesystem overriding any local content:
mvn vro:pull -Ptarget-env
Warning
The command will fail with 404 error if the package does not exist on the target Orchestrator server.
Note
If the package does not exist in the target server it can be manually created via the UI by following the naming convention and the current values of parameters from your project's pom.xml: {groupId}.{artifactId}-{version}.package. However, before your first pull you need to have certain maven dependencies downloaded locally which happens during your first build operation.
Thus it is recommended to first push your current content (which also triggers a build operation) to the target Orchestrator server at least once before manually adding new content to the package from UI and pulling it locally.
Warning
During pull operation any content added to the Orchestrator package is exported to the local file system but only Actions is exported as Javascript files - other content types are exported as XML. Any non-Javascript content is ignored during build, bundle and push operations.
Push Content¶
This section describes the operation for pushing project content to the target environment.
Overview¶
A Maven goal for packaging and deploying all local content from ./src directory to the remote server.
Usage¶
To push the project content to the target environment (defined in the Maven build profile that you specify in the -P${PROFILE} argument), use the following command.
mvn clean package vrealize:push -Ptarget-env
Include Dependencies¶
By default, the vrealize:push goal deploys all dependencies of the current project to the target environment. You can control this behavior by adding the -DincludeDependencies flag with the value false (to overwrite the default value true).
To skip deploying the project dependencies, run the following command.
mvn package vrealize:push -Ptarget-env -DincludeDependencies=false
Note
Note that dependent packages are not deployed to the target environment if the Orchestrator server already has a newer version of the same package deployed.
For example, if your project depends on com.vmware.pscoe.example-2.4.0 but the target server already has com.vmware.pscoe.example-2.4.2 deployed on it, the package on the server will not be downgraded and the dependency package will not be deployed. You can force the deployment of the older version of the dependency package on the remote server by adding the -Dvro.importOldVersions flag.
The following command will forcefully deploy the exact versions of the dependent packages, downgrading anything it finds on the server.
mvn package vrealize:push -Ptarget-env -Dvro.importOldVersions
Ignore Certificates¶
This section describes the flags that allow you to bypass the security feature for verifying the certificate and certificate hostname of the remote server in a development/testing environment.
Warning
Do not use the flags described in this section when targeting production servers.
Instead, make sure that the certificates have the correct CN, use FQDN to access the servers, and add the certificates to the Java key store (i.e. cacerts).
You can ignore certificate errors for all operations by adding the following parameters to the target profile in your Maven settings.xml file.
- For the the certificate is not trusted error, use the
vrealize.ssl.ignore.certificateparameter. - For the the CN does not match the actual hostname error, use the
vrealize.ssl.ignore.hostnameparameter.
<!-- Parameters for ignoring certificates in settings.xml file --> <!-- # (1)! -->
...
<profiles>
...
<profile>
<id>target-env</id>
<properties>
...
<vrealize.ssl.ignore.hostname>true</vrealize.ssl.ignore.hostname>
<vrealize.ssl.ignore.certificate>true</vrealize.ssl.ignore.certificate>
</properties>
</profile>
</profiles>
- The location of the
settings.xmlfile for MacOS is~/.m2andC:\Users\username\\.m2for Windows.
You can ignore certificate errors for specific operations by adding the following flags to your command.
-
To ignore the the certificate is not trusted error, add the
-Dvrealize.ssl.ignore.certificateflag to your command.mvn package vrealize:push -Ptarget-env -Dvrealize.ssl.ignore.certificate -
To ignore the the CN does not match the actual hostname error, add the flag
-Dvrealize.ssl.ignore.certificate:mvn package vrealize:push -Ptarget-env -Dvrealize.ssl.ignore.hostname
Additional Parameters¶
Additional parameters that can be passed as flags to the maven command, e.g. mvn clean package -DskipInstallNodeDeps=true.
skipInstallNodeDeps- skip the deletion and re-installation of node-deps.
Note
If node_modules folder doesn't exist, then this flag is ineffective.
vro.forceImportLatestVersions- This strategy will force you to upload the same or newer version of a package, otherwise it will fail the build, allowing us for better CI/CD pipelines, where we can ensure that the latest versions are always used on the server. Default value isfalse.
Note
Snapshot versions are considered newer if they are the same as the version on the server.
vro.importOldVersions- This strategy will upload a version of the package even if it is older than the version on the server.
Note
Snapshot versions are considered newer if they are the same as the version on the server.
Note
If forceImportLatestVersions is set to true this configuration is ignored.
Configuring .vroIgnore File¶
Custom file can be added to the project containing glob patterns for file paths to be ignored during compilation, packaging and testing.
The vroIgnoreFile property can be added in the pom.xml file of an Orchestrator project to specify a custom Orchestrator ignore file.
- If left unspecified, the default name
.vroignorewill be used. - If the file with the given name doesn't exist, it will be generated with default content. If it exists but does not match the expected file structure, it will be modified.
Note
In Linux dot files have a special status, use a custom name in case of issues.
Example excerpt from Orchestrator project pom.xml:
<properties>
<vroIgnoreFile>customVroignoreFile</vroIgnoreFile>
<!-- other properties -->
</properties>
Default .vroignore file structure:
# General
## This file contains glob patterns for file paths to be ignored during compilation, packaging and testing.
## The file will be (re)generated when the project is rebuilt to maintain the default categories and patterns, ignoring blank lines and repeating comments.
## The default categories, defined as rows starting with a single '#', are 'General', 'Packaging', 'Compilation', 'Testing', 'TestHelpers'.
## Patterns not under one of those categories will be considered in the 'General' category and ignored during all operations.
## Patterns must be listed on separate rows (without in-line comments), can be negated with a single '!' at the start and will be trimmed before processing.
## The 'TestHelpers'category will contain these two patterns by default: '**/*_helper.js', '**/*.helper.[tj]s'
## Rows starting with '##' are considered as comments and will be ignored on processing.
# Packaging
## Files with these paths will not be included in the vro package.
## For Workflows, Configurations, Resources and Policies: it is recommended to use the 'General' category (will skip xml element generation).
## Otherwise the patterns below must be based on the _element name_.element_info.xml files in target/vro-sources/xml.
# Compilation
## Files with these paths will be compiled without TS definitions
# Testing
## Files with these paths will be excluded from test coverage
# TestHelpers
## Files with these paths will be included in the tests but will not have TS definitions and will not be included in the test coverage or the vro package
**/*_helper.js
**/*.helper.[tj]s
Clean Up Content¶
This section describes the operation for cleaning up project content from a target environment.
Note
Note that the supported functionality for the cleaning up of project content from a target environment depends on the project type. For details, see the Project Type Support for Content Clean Up.
Overview¶
A dedicated goal for cleaning up project packages from a given environment (server).
Usage¶
To clean up content from the target environment (defined in the Maven build profile that you specify in the -P${PROFILE} argument), use the following command.
mvn vrealize:clean -DincludeDependencies=true -DcleanUpOldVersions=true -DcleanUpLastVersion=false -Ddryrun=true -Ptarget-env
Following is a list of the properties that you define via the -D command line arguments in the command with short description of their values.
- The
includeDependenciesflag specifies whether the package dependencies should be deleted together with the project package. - The
cleanUpOldVersionsflag specifies whether old versions of the package should be deleted. When combined with theincludeDependenciesflag, the operation is extended to the dependencies of the project package as well. - The
cleanUpLastVersionflag specifies whether the latest version of the project package should be deleted before importing. - The
dryrunflag specifies whether the operation should be run in dry run mode.
Examples¶
Following is a list of usage examples for cleaning up content from an environment.
-
To clean up only the current project package version from the server and keep the older package versions and dependencies, use the command with the following argument values.
mvn vrealize:clean -DcleanUpLastVersion=true -DcleanUpOldVersions=false -DincludeDependencies=false -Ptarget-env -
To clean up the current project package version and its dependencies from the server but keep the older package versions, use the command with the following argument values. Note that this is a force removal operation.
mvn vrealize:clean -DcleanUpLastVersion=true -DcleanUpOldVersions=false -DincludeDependencies=true -Ptarget-env -
To clean up the old project package versions and the old versions of package dependencies but keep the current (latest) package version, use the command with the following argument values.
mvn vrealize:clean -DcleanUpLastVersion=false -DcleanUpOldVersions=true -DincludeDependencies=true -Ptarget-env
Project Type Support for Content Clean Up¶
The following table provides details about the support of the cleaning up of project content via the vrealize:clean command per project type (archetype).
| Archetype | Supported | Comment |
|---|---|---|
| vro | Yes | - |
| vcd | Partial | Does not support dry run mode. |
| abx | No | Not implemented. |
| vrops | No | Not implemented. |
| vra-ng | Partial | Does not support dry run mode. |
| vrli | No | Product does not provide native package support. |
| cs | No | Product (Code Stream Services) does not provide native package support. |
| vcfa-all-apps | Partial | Does not support dry run mode. |
Operation Troubleshooting¶
Following is a list of tips on how to resolve issues that you might face when performing any of the supported operations.
-
If a Maven error does not contain enough information, re-run the command with the
-Xdebug flag.mvn -X <rest of the command> -
Sometimes Maven might cache old artifacts. To force the fetching of new artifacts, run the command with the
-Uflag. Alternatively, remove < home >/.m2/repository directory.mvn -U <rest of the command>