vmware / build-tools-for-vmware-aria

Build Tools for VMware Aria provides development and release management tools for implementing automation solutions based on the VMware Aria Suite and VMware Cloud Director. The solution enables Virtual Infrastructure Administrators and Automation Developers to use standard DevOps practices for managing and deploying content.
Other
48 stars 24 forks source link

Missing `exec` package results in failure to execute an action in VScode #427

Closed VenelinBakalov closed 2 months ago

VenelinBakalov commented 2 months ago

Originally posted by @unbreakabl3 . The team implemented a fix for a related issue but it turns out that this one is still valid. It is a result of an artifact that was removed in an earlier version. The fix was working on some members machines since they still had the artifact cached in their local m2 repo.

Note that this bug is originally reproduced through vRDT (the VScode plugin) but the issue is missing code from this repo, thus I am opening the issue here as well.

The related package while it was still available: https://github.com/vmware/build-tools-for-vmware-aria/tree/v2.29.2/packages/exec

Link to the original issue: https://github.com/vmware/vrealize-developer-tools/issues/122

Description

When clicked on Run vRO Action button, I got the following error:

# Running getVmWithTag.js
# An error occurred: Could not import exec package into vRO: Command 'mvn dependency:copy -Dartifact=com.vmware.pscoe.o11n:exec::package -DoutputDirectory="/Users/user/Library/Application Support/Code/User/globalStorage/vmware-pscoe.vrealize-developer-tools" -Dmdep.stripVersion=true ' exited with code 1

Steps to Reproduce

  1. Create Javascript action
  2. Select the action and click on the upper right corner the Run vRO Action button

Expected behaviour: [What you expect to happen]

Action will run

Actual behaviour: [What actually happens] Failed with:

# Running getVmWithTag.js
# An error occurred: Could not import exec package into vRO: Command 'mvn dependency:copy -Dartifact=com.vmware.pscoe.o11n:exec::package -DoutputDirectory="/Users/user/Library/Application Support/Code/User/globalStorage/vmware-pscoe.vrealize-developer-tools" -Dmdep.stripVersion=true ' exited with code 1

Reproduces how often: [What percentage of the time does it reproduce?] 100%

Environment

Mac OS 13.3

Client

Server

Failure Logs

# Running getVmWithTag.js
# An error occurred: Could not import exec package into vRO: Command 'mvn dependency:copy -Dartifact=com.vmware.pscoe.o11n:exec::package -DoutputDirectory="/Users/user/Library/Application Support/Code/User/globalStorage/vmware-pscoe.vrealize-developer-tools" -Dmdep.stripVersion=true ' exited with code 1
bcpmihail commented 2 months ago

Exec package was restored in https://github.com/vmware/build-tools-for-vmware-aria/tree/bugfix/427-missing-exec-package Building successfully after adding the 'flatten' plugin. Following the original issue thread in https://github.com/vmware/build-tools-for-vmware-aria/issues/83, tried to test with command:

mvn dependency:copy -Dartifact=com.vmware.pscoe.o11n:exec::package -DoutputDirectory="/Users/user/Library/Application Support/Code/User/globalStorage/vmware-pscoe.vrealize-developer-tools" -Dmdep.stripVersion=true

Started getting error:

# Compiling sample.ts
# An error occurred: ENOENT: no such file or directory, open 'C:\Users\mp059346\AppData\Local\Temp\o11n-ts--32484-ccT1ZUDKzN0y\actions\sample.js'
VenelinBakalov commented 2 months ago

@bcpmihail I have some progress with testing with some conditions:

  1. I had to configure Built Tools default version to be 2.43.1-SNAPSHOT from the user settings (because this is the earliest in which exec artifact will be available and by default this is set to 2.38.1) image

  2. The action is either executing or failing (depending on the code content) but I am not seeing any logs, I am not sure if this is expected. image

But I am actually seeing the workflow being successfully executed in vRO with the desired script.

VenelinBakalov commented 2 months ago

I checked the code, in theory it should be retrieving workflow logs and logging them in VS code as well as part of the execution log.

bcpmihail commented 2 months ago

When 'exec' is added as dependency to the test project, the command executes:

mvn dependency:copy -Dartifact=com.vmware.pscoe.o11n:exec::package -DoutputDirectory="/Users/user/Library/Application Support/Code/User/globalStorage/vmware-pscoe.vrealize-developer-tools" -Dmdep.stripVersion=true

Otherwise it fails as it is not in the dependency tree - neither are the repository/packages modules, of which exec is a dependency/module.

Suggesting adding exec as dependency to one of the archetypes.

VenelinBakalov commented 2 months ago

Hmm I think we shouldn't need it as a dependency. Which error does this solve - is it the An error occurred: ENOENT or something else? In theory after we add it back and release it it should be available in mvn central which is later on dynamically added to the execution: image

VenelinBakalov commented 2 months ago

Just FYI, I checked the 2.29.2 release which still had the package and we also need to add it as dependency to a few other packages: image