|
| 1 | +Before you continue with this section validate that all of the [prerequisites](./Setup-Developer-Workstation.md) are met. |
| 2 | + |
| 3 | +# Use |
| 4 | + |
| 5 | +ABX Project is a development project representation of ABX package content. |
| 6 | + |
| 7 | +## Create New ABX Project |
| 8 | + |
| 9 | +**vRealize Build Tools** provides ready to use project templates (_maven archetypes_). |
| 10 | + |
| 11 | +To create a new ABX project from archetype use the following commands for the respective runtime: |
| 12 | + |
| 13 | +```Bash |
| 14 | +# NodeJS |
| 15 | +mvn archetype:generate \ |
| 16 | + -DinteractiveMode=false \ |
| 17 | + -DarchetypeGroupId=com.vmware.pscoe.polyglot.archetypes \ |
| 18 | + -DarchetypeArtifactId=package-polyglot-archetype \ |
| 19 | + -DarchetypeVersion=<iac_for_vrealize_version> \ |
| 20 | + -DgroupId=local.corp.it.cloud \ |
| 21 | + -DartifactId=abx \ |
| 22 | + -Druntime=nodejs \ |
| 23 | + -Dtype=abx |
| 24 | + |
| 25 | +# Python |
| 26 | +mvn archetype:generate \ |
| 27 | + -DinteractiveMode=false \ |
| 28 | + -DarchetypeGroupId=com.vmware.pscoe.polyglot.archetypes \ |
| 29 | + -DarchetypeArtifactId=package-polyglot-archetype \ |
| 30 | + -DarchetypeVersion=<iac_for_vrealize_version> \ |
| 31 | + -DgroupId=local.corp.it.cloud \ |
| 32 | + -DartifactId=abx \ |
| 33 | + -Druntime=python \ |
| 34 | + -Dtype=abx |
| 35 | + |
| 36 | +# PowerShell |
| 37 | +mvn archetype:generate \ |
| 38 | + -DinteractiveMode=false \ |
| 39 | + -DarchetypeGroupId=com.vmware.pscoe.polyglot.archetypes \ |
| 40 | + -DarchetypeArtifactId=package-polyglot-archetype \ |
| 41 | + -DarchetypeVersion=<iac_for_vrealize_version> \ |
| 42 | + -DgroupId=local.corp.it.cloud \ |
| 43 | + -DartifactId=abx \ |
| 44 | + -Druntime=powershell \ |
| 45 | + -Dtype=abx |
| 46 | +``` |
| 47 | + |
| 48 | +**Note**: _The specified <iac_for_vrealize_version> should be minimum 2.11.2_ |
| 49 | + |
| 50 | +The generated project from the archetype is specific to the runtime, i.e. the src directory will contain .py files |
| 51 | +for Python projects, .ts files for NodeJS projects and .ps1 files for PowerShell projects. |
| 52 | + |
| 53 | +The result of this command will produce the following project file structure (example for NodeJS): |
| 54 | + |
| 55 | +``` |
| 56 | +. |
| 57 | +├── README.md |
| 58 | +├── handler.debug.yaml |
| 59 | +├── license_data |
| 60 | +│ ├── licenses.properties |
| 61 | +│ └── tp_license |
| 62 | +│ ├── header.txt |
| 63 | +│ └── license.txt |
| 64 | +├── package.json |
| 65 | +├── pom.xml |
| 66 | +├── release.sh |
| 67 | +├── src |
| 68 | +│ └── handler.ts |
| 69 | +└── tsconfig.json |
| 70 | +``` |
| 71 | + |
| 72 | +## Building |
| 73 | + |
| 74 | +You can build any ABX project from sources using Maven: |
| 75 | + |
| 76 | +```bash |
| 77 | +mvn clean package |
| 78 | +``` |
| 79 | + |
| 80 | +This will produce an ABX package with the groupId, artifactId and version specified in the pom. For example: |
| 81 | + |
| 82 | +```xml |
| 83 | +<groupId>local.corp.it.cloud</groupId> |
| 84 | +<artifactId>abx</artifactId> |
| 85 | +<version>1.0.0-SNAPSHOT</version> |
| 86 | +<packaging>abx</packaging> |
| 87 | +``` |
| 88 | + |
| 89 | +will result in **local.corp.it.cloud.abx-1.0.0-SNAPSHOT.abx** generated in the target folder of your project. |
| 90 | + |
| 91 | +## Configuration |
| 92 | + |
| 93 | +The ABX project uses the same configuration definition and semantics as the **VRA-NG** project. Refer to the |
| 94 | +configuration definition of the **VRA-NG** project. The rationale for this is that the ABX service is embedded within |
| 95 | +the larger vRA8 ecosystem and any application interaction uses unified authentication and authorization methodology, |
| 96 | +as well as locating the target scope for content distribution, e.g. projects and organizations. |
| 97 | + |
| 98 | +## Pull |
| 99 | + |
| 100 | +ABX content pulling is not supported yet. |
| 101 | + |
| 102 | +## Push |
| 103 | + |
| 104 | +To deploy the code developed in the local project or checked out from source control to a live server, you can use |
| 105 | +the `vrealize:push` command: |
| 106 | + |
| 107 | +```bash |
| 108 | +mvn package vrealize:push -Pcorp-env |
| 109 | +``` |
| 110 | + |
| 111 | +This will build the package and deploy it to the environment described in the `corp-env` profile. |
| 112 | + |
| 113 | +## Release |
| 114 | + |
| 115 | +To release a an ABX action uploaded on a live server, you can use the `vrealize:release` command: |
| 116 | + |
| 117 | +```bash |
| 118 | +mvn vrealize:release -Pcorp-env -Dvrang.version=1 |
| 119 | +``` |
| 120 | + |
| 121 | +The parameter `vrang.version` is required. The possible values of the parameter are: |
| 122 | + |
| 123 | +- `vrang.version=auto` - use auto-versioning with next version being generated by inferring the version pattern |
| 124 | + and generating a new version following the same sequence (refer to the ABX auto-versioning section below). |
| 125 | +- `vrang.version=project` - use the version set in the project. |
| 126 | +- `vrang.version=<version>` - use an explicit version. |
| 127 | + |
| 128 | +### ABX auto-versioning |
| 129 | + |
| 130 | +When releasing an ABX action to a vRA server that contains previously released action with the same name as the one |
| 131 | +being released, a new version will be created and released. |
| 132 | + |
| 133 | +When creating a new version and the versioning strategy is set to 'auto', the new version will be auto-generated based |
| 134 | +on the latest version of the action. The following version formats are supported with their respective incrementing rules: |
| 135 | + |
| 136 | +| Latest version | New version | Incrementing rules | |
| 137 | +| -------------- | ------------------- | ---------------------------------------------------------- | |
| 138 | +| 1 | 2 | Increment major version | |
| 139 | +| 1.0 | 1.1 | Major and minor version - increment the minor | |
| 140 | +| 1.0.0 | 1.0.1 | Major, minor and patch version - incrementing the patch | |
| 141 | +| 1.0.0-alpha | 2020-05-27-10-10-43 | Arbitrary version - generate a new date-time based version | |
| 142 | + |
| 143 | +## Clean Up |
| 144 | + |
| 145 | +In order to clean up auto-generated content, you can use the following Maven goal: |
| 146 | + |
| 147 | +```bash |
| 148 | +mvn clean |
| 149 | +``` |
| 150 | + |
| 151 | +This will remove the `target`, `out` and `dist` directories of the project. |
| 152 | + |
| 153 | +## Troubleshooting |
| 154 | + |
| 155 | +- If Maven error does not contain enough information rerun it with _-e_ debug flag. This will output the stack trace |
| 156 | + at the point where the error is encountered. |
| 157 | + |
| 158 | +```bash |
| 159 | +mvn -e <rest of the command> |
| 160 | +``` |
| 161 | + |
| 162 | +- Additionally, debug information can be really helpful when troubleshooting a particular scenario. In order to |
| 163 | + increase the verbosity of the logs, you can use the _-X_ debug flag. |
| 164 | + |
| 165 | +```bash |
| 166 | +mvn -X <rest of the command> |
| 167 | +``` |
| 168 | + |
| 169 | +- Sometimes Maven might cache old artifacts. Force fetching new artifacts with _-U_. |
| 170 | + Alternatively remove _<home>/.m2/repository_ folder. |
| 171 | + |
| 172 | +```bash |
| 173 | +mvn -U <rest of the command> |
| 174 | +``` |
0 commit comments