Closed DevOpsDCC closed 3 years ago
I'll have a look!
The timeout parameter is not supported for this step since it's supposed to return immediately.
As for finding the deployment, his works fine for me. Are you ABSOLUTELY sure you spelled the name correctly?
node {
dep = vraGetDeployment(
deploymentName: 'Is this accessible from Jenkins?',
vraURL: 'https://api.mgmt.cloud.vmware.com')
print dep
}
I have set the URL and token in the global params The steps I am running are:
As an FYI – I am running an on-premise version of vRA not cloud. The version is 8.2 Could there be a difference in URL between cloud and on prem for the API to get deployments ?
This is my exact code for the step
stage("Test Website") {
steps {
script {
echo "Get deployment information"
deploymentDetails = vraGetDeployment(
deploymentName: 'TITO'
)
echo "${deploymentDetails}"
}
}
Error WARNING: Unknown parameter(s) found for class type 'com.vmware.vra.jenkinsplugin.pipeline.GetDeploymentStep': timeout com.vmware.vra.jenkinsplugin.vra.VRAException: Expected 1 item, got 0 at com.vmware.vra.jenkinsplugin.vra.VraApi.checkResponseSingleton(VraApi.java:98) at com.vmware.vra.jenkinsplugin.vra.VraApi.getCatalogDeploymentByName(VraApi.java:214) at com.vmware.vra.jenkinsplugin.pipeline.DeploymentAwareStep.resolveDeploymentId(DeploymentAwareStep.java:64) at com.vmware.vra.jenkinsplugin.pipeline.GetDeploymentExecution.run(GetDeploymentExecution.java:46) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
Daniel Clydesdale-Cotter
From: Pontus Rydinmailto:notifications@github.com Sent: Wednesday, November 4, 2020 2:12 PM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com; Authormailto:author@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
The timeout parameter is not supported for this step since it's supposed to return immediately.
As for finding the deployment, his works fine for me. Are you ABSOLUTELY sure you spelled the name correctly?
node {
dep = vraGetDeployment(
deploymentName: 'Is this accessible from Jenkins?',
vraURL: 'https://api.mgmt.cloud.vmware.com')
print dep
}
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-721920935&data=04%7C01%7C%7C4e4c7c6fa0cc4306c59f08d880f5913f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637401139469116462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=u1O2K48sExCkVX%2BYPbkihZ%2Fep36mvEkmOP0YH7xX140%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG7NDKIY3IFKQXKDKI3SOGRRTANCNFSM4TKGRJNA&data=04%7C01%7C%7C4e4c7c6fa0cc4306c59f08d880f5913f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637401139469126455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ru7mGK%2Fe3ZQ44t73XAH%2Fcg%2B1k%2BRDqzHgaCDtsEaUXHM%3D&reserved=0.
I can access deployments via the rest API of vRA through this URL
https://my-server/deployment/api/deployments
This lists all deployments but can be targeted based on ID.
Daniel Clydesdale-Cotter
From: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com Sent: Wednesday, November 4, 2020 2:25 PM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:reply@reply.github.com Subject: RE: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
I have set the URL and token in the global params The steps I am running are:
As an FYI – I am running an on-premise version of vRA not cloud. The version is 8.2 Could there be a difference in URL between cloud and on prem for the API to get deployments ?
This is my exact code for the step
stage("Test Website") {
steps {
script {
echo "Get deployment information"
deploymentDetails = vraGetDeployment(
deploymentName: 'TITO'
)
echo "${deploymentDetails}"
}
}
Error WARNING: Unknown parameter(s) found for class type 'com.vmware.vra.jenkinsplugin.pipeline.GetDeploymentStep': timeout com.vmware.vra.jenkinsplugin.vra.VRAException: Expected 1 item, got 0 at com.vmware.vra.jenkinsplugin.vra.VraApi.checkResponseSingleton(VraApi.java:98) at com.vmware.vra.jenkinsplugin.vra.VraApi.getCatalogDeploymentByName(VraApi.java:214) at com.vmware.vra.jenkinsplugin.pipeline.DeploymentAwareStep.resolveDeploymentId(DeploymentAwareStep.java:64) at com.vmware.vra.jenkinsplugin.pipeline.GetDeploymentExecution.run(GetDeploymentExecution.java:46) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
Daniel Clydesdale-Cotter
From: Pontus Rydinmailto:notifications@github.com Sent: Wednesday, November 4, 2020 2:12 PM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com; Authormailto:author@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
The timeout parameter is not supported for this step since it's supposed to return immediately.
As for finding the deployment, his works fine for me. Are you ABSOLUTELY sure you spelled the name correctly?
node {
dep = vraGetDeployment(
deploymentName: 'Is this accessible from Jenkins?',
vraURL: 'https://api.mgmt.cloud.vmware.com')
print dep
}
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-721920935&data=04%7C01%7C%7C4e4c7c6fa0cc4306c59f08d880f5913f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637401139469116462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=u1O2K48sExCkVX%2BYPbkihZ%2Fep36mvEkmOP0YH7xX140%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG7NDKIY3IFKQXKDKI3SOGRRTANCNFSM4TKGRJNA&data=04%7C01%7C%7C4e4c7c6fa0cc4306c59f08d880f5913f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637401139469126455%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Ru7mGK%2Fe3ZQ44t73XAH%2Fcg%2B1k%2BRDqzHgaCDtsEaUXHM%3D&reserved=0.
Should I create a direct API call to get this data? I can get there from POSTMAN, is there API access in your plugin that would allow me to use the authentication but create my own GET/POST calls?
@DevOpsDCC The only thing I can think of is that the deployment isn't visible to your Jenkins pipeline due to user restrictions. Are you authenticating as the same user for Jenkins as you are when you're looking at it in the UI?
I will triple check - the api access is coming from the configadmin local administrator who would normally have access to everything.
I will let you know once I have tested.
Daniel Clydesdale-Cotter
From: Pontus Rydin notifications@github.com Sent: Tuesday, November 10, 2020 7:01:54 AM To: prydin/vrealize-automation-plugin-for-jenkins vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cotter danielccotter@hotmail.com; Mention mention@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
@DevOpsDCChttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDevOpsDCC&data=04%7C01%7C%7C88ed18d93422464a169d08d885706a87%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406065146634532%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=jilGfMTLg%2Fx7MI3pjnrrLNKYJ0wiNh50ubdnwIuPFKI%3D&reserved=0 The only thing I can think of is that the deployment isn't visible to your Jenkins pipeline due to user restrictions. Are you authenticating as the same user for Jenkins as you are when you're looking at it in the UI?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-724657984&data=04%7C01%7C%7C88ed18d93422464a169d08d885706a87%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406065146634532%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=WrzgxkfGYcxZa5U669xbRdgn%2Fh%2FhbRllpE2EIZFyL7I%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG77P3EJPZWPSJVSVM3SPETTFANCNFSM4TKGRJNA&data=04%7C01%7C%7C88ed18d93422464a169d08d885706a87%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406065146634532%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=z7h3xr9qycefaAlS3SFXVyuGWiWVAZYoAPcdhrrM2Bk%3D&reserved=0.
Do you know how to list all deployments using Postman? I would try that with the configadmin user and see if the deployment is there.
The deployment is there when using postman, I am going to try another couple of tests to see if I can see why nothing is coming back
Daniel Clydesdale-Cotter
From: Pontus Rydinmailto:notifications@github.com Sent: Tuesday, November 10, 2020 8:49 AM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
Do you know how to list all deployments using Postman? I would try that with the configadmin user and see if the deployment is there.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-724713280&data=04%7C01%7C%7C057f4115f0074a8cfe4708d8857f788a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406129807665474%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mMJx%2BHOIpqDXe0ZIp7Pd8r8IXGKFTptSeCu1Gqs2ZdA%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG5OTSRAWUQTDTL4MDDSPFAHBANCNFSM4TKGRJNA&data=04%7C01%7C%7C057f4115f0074a8cfe4708d8857f788a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406129807675472%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TOntoX%2FzhHE9FT%2FhPMt2HjEQ%2Fr9YNUWaTZBnf4tGuWc%3D&reserved=0.
You may also want to check if you can look it up using the ID in a Jenkins pipeline. (You can obtain the ID from the Postman output)
Unfortunately this doesn’t work either
echo "Get deployment information"
deploymentDetails = vraGetDeployment(
deploymentId: '7e79f6c8-38ae-4f2a-9bff-adedac2a5fda'
)
echo "${deploymentDetails}"
Daniel Clydesdale-Cotter
From: Pontus Rydinmailto:notifications@github.com Sent: Tuesday, November 10, 2020 9:56 AM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
You may also want to check if you can look it up using the ID in a Jenkins pipeline. (You can obtain the ID from the Postman output)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-724754380&data=04%7C01%7C%7C413d7872d0d3463e556708d88588d03c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406169933095569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0gSZRp7ni67gEBapU1vxtoT4cgEDtMAwxq4M7kjn%2FoQ%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG2TR4IUJ4BGVVOBSS3SPFIBXANCNFSM4TKGRJNA&data=04%7C01%7C%7C413d7872d0d3463e556708d88588d03c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406169933105570%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=aPv9CwkCZfgbRU02hvVLBLjM%2F0gCybQyyeqwNKpeXvs%3D&reserved=0.
A curl command from the command line on the Jenkins server also pulls back the info that postman does. I am at a loss at this point!
curl --insecure --location --request GET 'https://prod-vra.ad.echostor.com/deployment/api/deployments/' --header 'Content-Type: application/json' --header 'Authorization: Bearer SecretToken'
Daniel Clydesdale-Cotter
From: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com Sent: Tuesday, November 10, 2020 10:06 AM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:reply@reply.github.com; prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Mentionmailto:mention@noreply.github.com Subject: RE: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
Unfortunately this doesn’t work either
echo "Get deployment information"
deploymentDetails = vraGetDeployment(
deploymentId: '7e79f6c8-38ae-4f2a-9bff-adedac2a5fda'
)
echo "${deploymentDetails}"
Daniel Clydesdale-Cotter
From: Pontus Rydinmailto:notifications@github.com Sent: Tuesday, November 10, 2020 9:56 AM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
You may also want to check if you can look it up using the ID in a Jenkins pipeline. (You can obtain the ID from the Postman output)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-724754380&data=04%7C01%7C%7C413d7872d0d3463e556708d88588d03c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406169933095569%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0gSZRp7ni67gEBapU1vxtoT4cgEDtMAwxq4M7kjn%2FoQ%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG2TR4IUJ4BGVVOBSS3SPFIBXANCNFSM4TKGRJNA&data=04%7C01%7C%7C413d7872d0d3463e556708d88588d03c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406169933105570%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=aPv9CwkCZfgbRU02hvVLBLjM%2F0gCybQyyeqwNKpeXvs%3D&reserved=0.
Do you have multiple organizations?
Single org I believe
Daniel Clydesdale-Cotter
From: Pontus Rydinmailto:notifications@github.com Sent: Tuesday, November 10, 2020 11:03 AM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
Do you have multiple organizations?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-724798169&data=04%7C01%7C%7C0a8603cb084f4b26e80f08d885922a6d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406210103016566%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=RuW3KCRKYdA4aiwY%2FCu8zRUOOdLC3xORV7DDhzu18Bg%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG5GFKHR37QLA5KHOQ3SPFP47ANCNFSM4TKGRJNA&data=04%7C01%7C%7C0a8603cb084f4b26e80f08d885922a6d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406210103026561%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2V7x49V6M6F%2FVTk9mfKtxY4W9OjCnieAClP76f4duH0%3D&reserved=0.
There's clearly some contextual/environmental mismatch somewhere. The code for looking up a deployment by ID is trivial and should not fail that way.
Could you try to deploy something in a pipeline and then try to look it up right after? I tried the pipeline below. You'll obviously need to change the project name and catalog item name.
node {
def dep = vraDeployFromCatalog(
catalogItemName: 'jenkins-test',
count: 1,
deploymentName: 'MyDeployment',
projectName: 'JenkinsTest',
reason: 'Test',
timeout: 300,
version: '2')
def dep2 = vraGetDeployment(
deploymentName: "MyDeployment")
print dep2
}
That does work! So I guess having the deployment and the get deployment details in different stages doesn’t work.
I will do more testing as I feel like it shouldn’t matter where the vraGetDeployment is executed form a stage perspective.
Here is my code that just worked as an FYI
Thank you for helping me out!
// Define Variables to use across stages deployment = '' deploymentName = '' deploymentId = '' deploymentDetails = ''
pipeline { agent any stages { stage("Build Infrastructure") { steps { script { echo "Building Infrastructure and deploying code" deployment = vraDeployFromCatalog( catalogItemName: 'Monolith Tito', count: 1, deploymentName: 'Jenkins-Test', projectName: 'TITO', reason: 'Build Infra for testing', timeout: 1200, version: '1.24', inputs: '' ) assert deployment != null deploymentDetails = vraGetDeployment( deploymentName: "Jenkins-Test" ) print deploymentDetails } } } stage(". ") } }
Daniel Clydesdale-Cotter
From: Pontus Rydinmailto:notifications@github.com Sent: Tuesday, November 10, 2020 11:19 AM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
There's clearly some contextual/environmental mismatch somewhere. The code for looking up a deployment by ID is trivial and should not fail that way.
Could you try to deploy something in a pipeline and then try to look it up right after? I tried the pipeline below. You'll obviously need to change the project name and catalog item name.
node {
def dep = vraDeployFromCatalog(
catalogItemName: 'jenkins-test',
count: 1,
deploymentName: 'MyDeployment',
projectName: 'JenkinsTest',
reason: 'Test',
timeout: 300,
version: '2')
def dep2 = vraGetDeployment(
deploymentName: "MyDeployment")
print dep2
}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-724808541&data=04%7C01%7C%7Cc66e44a49bb54512851208d885946d75%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406219849461342%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YWG6xA0v%2FReu9ZbJ6lWMvPVpyNXRGK3Ozx%2Fm9psMcSM%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG6OZCBBIJCCTDACDFLSPFRZXANCNFSM4TKGRJNA&data=04%7C01%7C%7Cc66e44a49bb54512851208d885946d75%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406219849461342%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5HKloeCZq8yFu9WA8%2FYdTV2cHOw3ykSb0jUvUThJZiM%3D&reserved=0.
I think I found the issue. When you start the build from a specific stage in the pipeline it doesn’t seem to connect and I get the error.
However if the build is run from scratch in a new build the vragetDeployment works fine in any stage of the pipeline.
Working code
// Define Variables to use across stages deployment = '' deploymentName = '' deploymentId = '' deploymentDetails = ''
pipeline { agent any stages { stage("Build Infrastructure") { steps { script { deploymentDetails = vraGetDeployment( deploymentName: "TITO" ) print deploymentDetails } } } stage("Test Website") { steps { script { deploymentDetails = vraGetDeployment( deploymentName: "TITO" ) print deploymentDetails } } } } }
Daniel Clydesdale-Cotter
From: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com Sent: Tuesday, November 10, 2020 11:50 AM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:reply@reply.github.com; prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Mentionmailto:mention@noreply.github.com Subject: RE: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
That does work! So I guess having the deployment and the get deployment details in different stages doesn’t work.
I will do more testing as I feel like it shouldn’t matter where the vraGetDeployment is executed form a stage perspective.
Here is my code that just worked as an FYI
Thank you for helping me out!
// Define Variables to use across stages deployment = '' deploymentName = '' deploymentId = '' deploymentDetails = ''
pipeline { agent any stages { stage("Build Infrastructure") { steps { script { echo "Building Infrastructure and deploying code" deployment = vraDeployFromCatalog( catalogItemName: 'Monolith Tito', count: 1, deploymentName: 'Jenkins-Test', projectName: 'TITO', reason: 'Build Infra for testing', timeout: 1200, version: '1.24', inputs: '' ) assert deployment != null deploymentDetails = vraGetDeployment( deploymentName: "Jenkins-Test" ) print deploymentDetails } } } stage(". ") } }
Daniel Clydesdale-Cotter
From: Pontus Rydinmailto:notifications@github.com Sent: Tuesday, November 10, 2020 11:19 AM To: prydin/vrealize-automation-plugin-for-jenkinsmailto:vrealize-automation-plugin-for-jenkins@noreply.github.com Cc: Daniel Clydesdale-Cottermailto:danielccotter@hotmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [prydin/vrealize-automation-plugin-for-jenkins] Running vraGetDeployment fails (#7)
There's clearly some contextual/environmental mismatch somewhere. The code for looking up a deployment by ID is trivial and should not fail that way.
Could you try to deploy something in a pipeline and then try to look it up right after? I tried the pipeline below. You'll obviously need to change the project name and catalog item name.
node {
def dep = vraDeployFromCatalog(
catalogItemName: 'jenkins-test',
count: 1,
deploymentName: 'MyDeployment',
projectName: 'JenkinsTest',
reason: 'Test',
timeout: 300,
version: '2')
def dep2 = vraGetDeployment(
deploymentName: "MyDeployment")
print dep2
}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fprydin%2Fvrealize-automation-plugin-for-jenkins%2Fissues%2F7%23issuecomment-724808541&data=04%7C01%7C%7Cc66e44a49bb54512851208d885946d75%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406219849461342%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YWG6xA0v%2FReu9ZbJ6lWMvPVpyNXRGK3Ozx%2Fm9psMcSM%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALIAWG6OZCBBIJCCTDACDFLSPFRZXANCNFSM4TKGRJNA&data=04%7C01%7C%7Cc66e44a49bb54512851208d885946d75%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637406219849461342%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5HKloeCZq8yFu9WA8%2FYdTV2cHOw3ykSb0jUvUThJZiM%3D&reserved=0.
I have tried multiple combinations for deploymentName and deploymentId Neither seems to work. When using the timeout parameter I get a warning.
With timeout flag
deploymentDetails = vraGetDeployment( deploymentName: 'Jenkins-Tito-51fe30d4-8b84-45f4-884e-ffc46c208574', timeout: 300 )
WARNING: Unknown parameter(s) found for class type 'com.vmware.vra.jenkinsplugin.pipeline.GetDeploymentStep': timeout com.vmware.vra.jenkinsplugin.vra.VRAException: Expected 1 item, got 0 at com.vmware.vra.jenkinsplugin.vra.VraApi.checkResponseSingleton(VraApi.java:98) at com.vmware.vra.jenkinsplugin.vra.VraApi.getCatalogDeploymentByName(VraApi.java:214) at com.vmware.vra.jenkinsplugin.pipeline.DeploymentAwareStep.resolveDeploymentId(DeploymentAwareStep.java:64) at com.vmware.vra.jenkinsplugin.pipeline.GetDeploymentExecution.run(GetDeploymentExecution.java:46) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
Without Timeout flag deploymentDetails = vraGetDeployment( deploymentName: 'Jenkins-Tito-51fe30d4-8b84-45f4-884e-ffc46c208574', //timeout: 300 )
com.vmware.vra.jenkinsplugin.vra.VRAException: Expected 1 item, got 0 at com.vmware.vra.jenkinsplugin.vra.VraApi.checkResponseSingleton(VraApi.java:98) at com.vmware.vra.jenkinsplugin.vra.VraApi.getCatalogDeploymentByName(VraApi.java:214) at com.vmware.vra.jenkinsplugin.pipeline.DeploymentAwareStep.resolveDeploymentId(DeploymentAwareStep.java:64) at com.vmware.vra.jenkinsplugin.pipeline.GetDeploymentExecution.run(GetDeploymentExecution.java:46) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE