Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing a vRO action within vscode is not working #83

Closed
unbreakabl3 opened this issue Apr 20, 2023 · 42 comments
Closed

Executing a vRO action within vscode is not working #83

unbreakabl3 opened this issue Apr 20, 2023 · 42 comments
Assignees
Labels
area/vrdt Relates to vRealize Developer Tools kind/bug Something isn't working lang/java Related to Java Code

Comments

@unbreakabl3
Copy link
Contributor

Description

When trying to run an action inside the vscode, I am getting 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. Select the action to run
  2. Click in Run Action

Expected behaviour: [What you expect to happen]

The action will run locally

Actual behaviour: [What actually happens]

The error above

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

Component/s: [What are the Build Tools for VMware Aria components affected by the issue (e.g. "common/artifact-manager", "maven/plugins/vra-ng", "typescript/vrotest", etc)]

com.vmware.pscoe.o11n:exec package

Environment

Client

  • Build Tools for VMware Aria Version: 2.31.0
  • Visual Studio Code Version: 1.77.3
  • OS Version: MacOS 13.4
  • vRealize Developer Tool: 2.4.0

Server

  • vRealize Orchestrator Version: 8.11.x
@Michaelpalacce
Copy link
Collaborator

A short update on this.

We used to have an exec module that we used to bundle and publish ( part of https://github.com/vmware/build-tools-for-vmware-aria/tree/main/packages ).

This was recently removed, we need to investigate why and return it.

FYI @n-vodenicharski

@Michaelpalacce Michaelpalacce added kind/bug Something isn't working missing-dependencies area/vrdt Relates to vRealize Developer Tools labels Apr 24, 2023
@Michaelpalacce
Copy link
Collaborator

Internal link:

https://stash.pscoe.vmware.com/projects/IFV/repos/toolchain/browse/packages/exec

This is the package we need re-added

@Michaelpalacce Michaelpalacce added the lang/java Related to Java Code label May 30, 2023
@kjiju kjiju self-assigned this Jun 13, 2023
@kjiju
Copy link
Contributor

kjiju commented Jun 26, 2023

Same bug is reported in vmware/vrealize-developer-tools#122

According to this bug, the VRealize Developer Tools should show a button called " RUN VRO Action"

@kjiju
Copy link
Contributor

kjiju commented Jun 27, 2023

I was able to run VRO actions by clicking on dropdown item with three dots in upper right corner of vscode.
This is first tested in 2.13.3 version of toolchain. The action in VRO was run successfully by initiating the call from VSCode.
Next step is to reproduce error in 2.31.0

@unbreakabl3
Copy link
Contributor Author

I was able to run VRO actions by clicking on dropdown item with three dots in upper right corner of vscode.
This is first tested in 2.13.3 version of toolchain. The action in VRO was run successfully by initiating the call from VSCode.

That’s what I have in the tree dots dropdown:

image

And that a vRO Action button:

image

This one is not working and I am getting the error I was initially posted. The build tool I am running now is 2.33.0

@kjiju
Copy link
Contributor

kjiju commented Jun 27, 2023

Yes, I am trying to reproduce error in 2.31.0 and 2.33.0
2.13.3 was used to understand the success condition. Without knowing success condition, I cannot know failure condition.

@kjiju
Copy link
Contributor

kjiju commented Jun 27, 2023

Couldn't reproduce error with 2.33.0.
This could be due to the VRO already containing the exec package : com.vmware.pscoe.o11n.exec-2.26.4.package
Exported the package, deleting the package in VRO and retrying.
com.vmware.pscoe.o11n.exec-2.26.4.zip

@unbreakabl3
Copy link
Contributor Author

I think Ivo mentioned that this package was removed for some reason in one of the earlier releases. The latest one doesn’t have it, if its install if from scratch.

@kjiju
Copy link
Contributor

kjiju commented Jun 27, 2023

Ok, with 2.33.0, and no exec package in VRO, I clicked on "run VRO action".
The exec package is automatically imported into VRO and then the action is executed.
"Could not import exec package into vRO" didn't appear.
There may be something else existing in my vsCode. Need to find it and remove it.

@unbreakabl3
Copy link
Contributor Author

Ok, with 2.33.0, and no exec package in VRO, I clicked on "run VRO action".
The exec package is automatically imported into VRO and then the action is executed.
"Could not import exec package into vRO" didn't appear.
There may be something else existing in my vsCode. Need to find it and remove it.

Thanks. Waiting for your feedback.

@kjiju
Copy link
Contributor

kjiju commented Jun 27, 2023

To ensure, nothing is stored in my VSCode or machine, I uninstalled the "vrealize developer tools" extension, removed exec package from VRO and re-executed "run Vro action", the "vrealize developer tools" downloaded exec package again and imported exec package into VRO and ran the action successfully.

Looks like nothing is cached in VScode.
Next step, Will try the mvn code
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

@kjiju
Copy link
Contributor

kjiju commented Jun 27, 2023

Error received on above mvn command
[ERROR] Error resolving version for plugin '.vmware.pscoe.o11n:exec' from the repositories [local (C:\Users\kjiju.m2\repository), central (https://artifactory.pscoe.vmware.com/artifactory/pscoe)]: Plugin not found in any plugin repository -> [Help 1]
org.apache.maven.plugin.version.PluginVersionResolutionException: Error resolving version for plugin '.vmware.pscoe.o11n:exec' from the repositories [local (C:\Users\kjiju.m2\repository), central (https://artifactory.pscoe.vmware.com/artifactory/pscoe)]: Plugin not found in any plugin repository
at org.apache.maven.plugin.version.internal.DefaultPluginVersionResolver.selectVersion (DefaultPluginVersionResolver.java:256)

@unbreakabl3
Copy link
Contributor Author

Yep. That’s what Ivo mentioned that it was removed for some reason.

@kjiju
Copy link
Contributor

kjiju commented Jun 27, 2023

Please note that it is looking for ".vmware.pscoe.o11n:exec".
not "com.vmware.pscoe.o11n:exec"

This could be a maven version issue. The maven I am using is 3.8.7
I assume the exec package may be removed from workspace after making it a maven dependency. Will confirm this

@kjiju
Copy link
Contributor

kjiju commented Jun 28, 2023

RunAction.ts of vRDT version 2.4.0 has async prepare(context: vscode.ExtensionContext) {
try {
this.logger.info(Checking if workflow with ID ${RUN_SCRIPT_WORKFLOW_ID} exists in target vRO)
await this.restClient.getWorkflow(RUN_SCRIPT_WORKFLOW_ID)
} catch (e) {
await vscode.window.withProgress(
{
location: vscode.ProgressLocation.Window
},
progress => {
return new Promise(async (resolve, reject) => {
try {
this.logger.debug(Error: ${e.message})
progress.report({ message: "Downloading exec package" })
this.logger.info("Downloading package 'com.vmware.pscoe.o11n.exec'.")
const execPackage = await this.getExecPackage(context)
progress.report({ message: "Importing exec package in vRO" })
this.logger.info("Importing package 'com.vmware.pscoe.o11n.exec'.")
await this.restClient.importPackage(execPackage)
resolve()
} catch (e) {
const errorMessage = Could not import exec package into vRO: ${e.message}
reject(errorMessage)
}
})
}
)
}
}

private async getExecPackage(context: vscode.ExtensionContext): Promise {
const storagePath = context.globalStoragePath
if (!fs.existsSync(storagePath)) {
fs.mkdirSync(storagePath)
}

    await this.mavenProxy.copyDependency(
        "com.vmware.pscoe.o11n",
        "exec",
        this.environment.buildToolsVersion,
        "package",
        storagePath
    )
    return path.join(storagePath, "exec.package")
}

@kjiju
Copy link
Contributor

kjiju commented Jun 28, 2023

Trying to figure out what does copyDependency of MavenCliProxy do
import { AutoWire, Logger, LogMessage, MavenCliProxy, PomFile, proc, sleep, VroRestClient } from "@vmware/vrdt-common"

@kjiju
Copy link
Contributor

kjiju commented Jun 28, 2023

copyDependency(
groupId: string,
artifactId: string,
version: string,
packaging: string,
destinationDir: string
): Promise<proc.CmdResult> {
const command =
mvn dependency:copy +
-Dartifact=${groupId}:${artifactId}:${version}:${packaging} +
-DoutputDirectory="${destinationDir}" +
-Dmdep.stripVersion=true

    return proc.exec(command, { cwd: destinationDir }, this.logger)
}

mvn dependency:copy -Dartifact=${groupId}:${artifactId}:${version}:${packaging} -DoutputDirectory="${destinationDir}" -Dmdep.stripVersion=true `
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

Need to figure out where the package com.vmware.pscoe.o11n:exec is copied from.

@kjiju
Copy link
Contributor

kjiju commented Jun 28, 2023

Confirming the following from Windows environment.

  1. In windows the exec package is downloaded to C:\Users<userid>.m2\repository\com\vmware\pscoe\o11n\exec
  2. With vRealize Developer tools (vRdt ) version 2.4.0 the maven local repository will contain a file named "exec-2.26.4.package" after the download.
  3. Once download is complete the exec package is imported to VRO using rest client.
  4. The exec package contains the "Run Script" workflow which is responsible for running the eval method.

This confirms that in windows environment exec package need not be included in the packages folder as seen in
https://github.com/vmware/build-tools-for-vmware-aria/tree/IAC-463-Improve-workstation-onboarding-docs/packages

Next, I will confirm the commit which made these changes.

@kjiju
Copy link
Contributor

kjiju commented Jun 28, 2023

Author Timestamp Commit #
nvodenicharski@vmware.com 2023-02-27 18:31:47 +0200 16ba7f2 all poms point to iac pom, all poms uses {revision} version
Nikolay Vodenicharski 2023-02-27 18:16:05 +0200 c287729 add threading to build.yml
<in commit # 16ba7f2 exec package is not there; in commit # c287729 exec package is present>

@kjiju
Copy link
Contributor

kjiju commented Jun 28, 2023

Please notice the exec package in remote maven repository
https://artifactory.pscoe.vmware.com/artifactory/pscoe/com/vmware/pscoe/o11n/exec/

@Michaelpalacce
Copy link
Collaborator

@kjiju https://artifactory.pscoe.vmware.com/artifactory/pscoe/com/vmware/pscoe/o11n/exec/ is not remote, it's local to us, remote is maven central

@kjiju
Copy link
Contributor

kjiju commented Jun 29, 2023

I am able to reproduce the bug by adding two items in precondition

# Running actionSample.js
# An error occurred: Could not import exec package into vRO: Command 'mvn dependency:copy -Dartifact=com.vmware.pscoe.o11n:exec:2.26.4:package -DoutputDirectory="c:\Users\kjiju\AppData\Roaming\Code\User\globalStorage\vmware-pscoe.vrealize-developer-tools" -Dmdep.stripVersion=true ' exited with code 1

Preconditions:
Remove m2/repository
Remove artifactory from settings.xml

@kjiju
Copy link
Contributor

kjiju commented Jun 30, 2023

2.29.2 is the version of vRbt having exec package.
By using this version as well as by adding exec folder to existing source code, I am getting following error

# Running getFileName.js
# An error occurred: Could not import exec package into vRO: Command 'mvn dependency:copy -Dartifact=com.vmware.pscoe.o11n:exec:2.26.4:package -DoutputDirectory="c:\Users\kjiju\AppData\Roaming\Code\User\globalStorage\vmware-pscoe.vrealize-developer-tools" -Dmdep.stripVersion=true ' exited with code 1

Apache Maven 3.8.7
Java version: 1.8.0_351
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
vRDT version: 2.4.0
Preconditions:
Remove m2/repository
Remove artifactory from settings.xml
Remove exec package from VRO

@unbreakabl3
Copy link
Contributor Author

Hey, everyone.
Is there any progress here?
There is nothing here as well: vmware/vrealize-developer-tools#122

@VenelinBakalov
Copy link
Collaborator

@Michaelpalacce @kjiju @akumanov-vmw I think this issue is fixed with the following PR:
vmware/vrealize-developer-tools#140
@akumanov-vmw could you confirm if I am right?
If that is the case, we should have the fix in the next release of vRDT

@unbreakabl3
Copy link
Contributor Author

@Michaelpalacce @kjiju @akumanov-vmw I think this issue is fixed with the following PR: vmware/vrealize-developer-tools#140 @akumanov-vmw could you confirm if I am right? If that is the case, we should have the fix in the next release of vRDT

Amazing news. Like a gift for a Christmas 🤶. Thanks a lot! Will wait for a next release to test it.

@VenelinBakalov
Copy link
Collaborator

Hi again @unbreakabl3 , I did some local tests with the latest code base. It seems to work, at least on my side. I would suggest, if you have time, to try and checkout the latest vRealize Developer Tools master, build it locally and test on your side to make sure it is functional for you as well.
I am leaving a screenshot with my test action and output:
image
image

@unbreakabl3
Copy link
Contributor Author

Hi again @unbreakabl3 , I did some local tests with the latest code base. It seems to work, at least on my side. I would suggest, if you have time, to try and checkout the latest vRealize Developer Tools master, build it locally and test on your side to make sure it is functional for you as well. I am leaving a screenshot with my test action and output: image image

Hi, @VenelinBakalov. Working for me.
Thank you very much.

@VenelinBakalov
Copy link
Collaborator

That's great to hear! Let me try to organise a release and once it is done, I will write back here and close the related issues.

@VenelinBakalov
Copy link
Collaborator

Hi again, @unbreakabl3 , thanks for the feedback and the patience!
Release 2.5.1 is available on the marketplace now: https://marketplace.visualstudio.com/manage/publishers/vmware-pscoe (and on github https://github.com/vmware/vrealize-developer-tools/releases/tag/v2.5.1)
I updated my local extension in VScode and it seems to be executing the action successfully. It would be great if you can also validate on your side with the latest release.

@VenelinBakalov
Copy link
Collaborator

We did another internal validation round, everything should be ok, if you manage to find an issue feel free to reopen this thread.
Happy holidays and have a nice time off! :)

@VenelinBakalov
Copy link
Collaborator

Issue closed in vRDT repository with PR: vmware/vrealize-developer-tools#140
vRDT release v2.5.1 is addressing it

@simplygeekuk
Copy link

@VenelinBakalov I just tried this and getting the same issue that 'com.vmware.pscoe.o11n:exec:2.36.0:package' cannot be found. I have a completely new install, using Build Tools v2.36.0 and vRDT 2.5.1. I have tried removing the extension and re-installing but keep getting the same problem.

@VenelinBakalov
Copy link
Collaborator

Hi @simplygeekuk , this seems like a different error, could you add the full error log here and any configuration that you might see usefull?
It sounds a bit like mvn not being able to access Maven central to download the artifact but you mentioned you reinstalled the plugin from which I assume you have internet connectivity during the execution?

@unbreakabl3
Copy link
Contributor Author

Actually, I have the same problem now. Latest vscode, Build Tools v2.37.0 and vRDT 2.5.1:

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

@simplygeekuk
Copy link

@VenelinBakalov Looking at the conversation thread here, it's identified as the exec package being the problem (not able to download it). This package does not exist in the public Maven central repos, this is the problem.

@Michaelpalacce
Copy link
Collaborator

I think we need to re-open this. We need to publish the exec plugin

@VenelinBakalov
Copy link
Collaborator

VenelinBakalov commented Jan 28, 2024

@Michaelpalacce it seems the exec package was removed between 2.92.2 and 2.30.0 releases. probably this appeared as an issue now since we have created a new vRDT release
https://github.com/vmware/build-tools-for-vmware-aria/tree/v2.29.2/packages

@unbreakabl3 @simplygeekuk in the mean time while we figure this out, if you find this feature critical or useful as a workaround you can use a version prior to the current release that has the old dependency. You can:

@vsuddya
Copy link
Contributor

vsuddya commented Feb 2, 2024

run action
For me it's working well.
Build Tools v2.36.0
vRDT 2.5.1
Visual Studio Code Version: 1.86.0
Apache Maven 3.9.6
java 17.0.9

Looks like there is a version compatibility issue

@Michaelpalacce
Copy link
Collaborator

Closing as per @vsuddya's investigations

@VenelinBakalov
Copy link
Collaborator

@Michaelpalacce I think we might still need to add back the exec package to Build Tools repo

@unbreakabl3
Copy link
Contributor Author

@Michaelpalacce I think we might still need to add back the exec package to Build Tools repo

I don't know the original reason for removing it, but if possible, it would be very useful to return it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vrdt Relates to vRealize Developer Tools kind/bug Something isn't working lang/java Related to Java Code
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

6 participants