Deployment Manger 5.2 - Jenkins Post Build Actions script Failing

Below script is failing while running Jenkins build to send response back to Deployment Manager. Jenkins is running on Microsoft Windows

Error: jq: unknown option --insecure

@echo off for /F %%I in (‘curl -S --insecure -d “client_id=123&client_secret=123&grant_type=client_credentials” https://vaww.dev.va.com/webapp/PRRestService/oauth2/v1/token ^| jq -r .access_token’) do set token=%%~I curl -S --insecure -H “Content-Type: application/json” -H “Accept: application/json” -H “Authorization:Bearer %token%” -k -X PUT --data “{"taskStatus":"Resolved-Completed","taskInfo":{"outputParameters":[{"name": "BuildNumber","type": "Text","value": "%BUILD_NUMBER%"},{"name": "JenkinsBuildURL","type": "Text","value": "%BUILD_URL%"}]}}” %CallBackURL%

Reference: Pegasystems Documentation

Individual curl commands are working fine and we were able to send response back to PDM.

curl -S --insecure -d “client_id=123&client_secret=123&grant_type=client_credentials” https://vaww.dev.va.com/webapp/PRRestService/oauth2/v1/token

curl --insecure -H “Content-Type: application/json” -H “Accept: application/json” -H "Authorization:Bearer eyJraWQiOiI0ZWEzMGY4NjUwZjRkZGE1ODA2NmQ0NTNkYjFiZDAzYyIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJhdWQiOiJ1cm46Njg2NTYzMDMzNjAyNDMxOTE1OTgiLCJzdWIiOiJETUFnZW50VXNlciIsImFwcF9uYW1lIjoiUGVnYURlcGxveW1lbnRNYW5hZ2VyIiwibmJmIjoxNjIxMzY3MzMzLCJhcHBfdmVyc2lvbiI6IjUiLCJpc3MiOiJ1cm46dmF3dy5wZG1vcC1kZXYuZnNjLnZhLmdvdiIsImV4cCI6MTYyMTM2NzUxMywiaWF0IjoxNjIxMzY3MzMzLCJqdGkiOiIwYjFlOWNlYzYxYzdjODdlNWNhYWQyNmMyY2FlYjQzNCIsIm9wZXJhdG9yX2FjY2VzcyI6IlN1cGVyQWRtaW4ifQ.UZLjJxEQcseo1d3_z91_cXmsgvIR6ZpOl82PB72zXUYfpfAD9XGkBqcY1gIXPzPNDhKNEj_FcGJv9P_lVgKX1LdSZ2yd9HfZZsN30dvITMbaONpynUaKg5iefsiRD4XX_4YJhoDo0c8oSVaCSgxhHCHace_s6FWDzYMWiP8Mo87X7afS2-s0KSXIihhbtMZtV9GUd_bvPIgVmAJSY3kdaGbBiDxH6oGGq_nKBvzgq_yy9GfU8F4_u2_HzH5slJHEbI2stNc9iW-fvqnZM1g-JH9H5aQMduehtT0rMS3dNDUONPpOFRmAoeCHPoBOfI1TlQUwpR1eX9Q6sF7yjdLbEhGdEaTxkTOx3TxX5AZd2vQP9-1Iu2Sj_dBRh4zxIMCpyv1Kcu5KppaFTvTrtL-xiVvVVpn967QThLziqInTdb-Ru8yqZuh10-7HnBC0A7CzweopExHhq6gSt1Oek9rGH5-cG2lEMihIb1mnwppcTpLXQZGiNyjeaqy49yuxT6EtOuawCvUhJ9fgRSmZWXYByll_E2yMesjAELhpmbAHGy92D-Xe88-E3iMxa4tSf3YqlSz8KFeIjzecyPwnsYvwCPtkqOvVkJdHVgH5qt0QqFQUkHtpkRhLeGSYhkOiXrIdkzHqrPR1xWR9nVuwXG6TurSjg2QrfN1B9Rl3eDL5Hx4 " -k -X PUT --data "{​​​​​"taskStatus":"Resolved-Completed","taskInfo":{​​​​​"outputParameters":[{​​​​​"name": "BuildNumber","type": "Text","value": "16"}​​​​​,{​​​​​"name": "JenkinsBuildURL","type": "Text","value": "https://vaww.jenkins-dev.va.com/job/PDM-ReleaseNotes-OAuth2/16/\“}​​​​​]}​​​​​}​​​​​” https://vaww.dev.va.com/webapp/api/DeploymentManager/v1/tasks/Task-S74R0QGO92NOWXI

Hi @VeeraRR

Did you install jq command successfully in the jenkins server as per 5th step of Jenkins config doc : Pegasystems Documentation

@ChinmayaHegde curl -s --insecure -d “client_id=123&client_secret=123&grant_type=client_credentials” https://vaww.dev.va.com/webapp/PRRestService/oauth2/v1/token | jq .access_token

We are able to get token when we run above command. When we run the entire script nothing happens. It reprints the same command after we hit enter.

We are using windows and is there a particular jq version we need to install? We tried on jq 1.6

Hi @VeeraRR

Sorry for the delay. If you still facing the issue with Jenkins, can you raise SR to GCS, so that some one from our team will take close look.

@VeeraRR

@echo off

for /F %%I in (‘curl --insecure -d “client_id=68656303360243191598&client_secret=6935981DAE06C5B128940BE88A3E52FB&grant_type=client_credentials” https://hostname:port/prweb/PRRestService/oauth2/v1/token ^| jq -r .access_token’) do set token=%%~I

curl --insecure -H “Content-Type: application/json” -H “Accept: application/json” -H “Authorization:Bearer %token%” -k -X PUT --data “{"taskStatus":"Resolved-Completed","taskInfo":{"outputParameters":[{"name": "BuildNumber","type": "Text","value": "build122"},{"name": "JenkinsBuildURL","type": "Text","value": "testrule"}]}}” https://hostname:port/prweb/PRRestService/DeploymentManager/v1/tasks/Task-IAFSHSH

Could you use the script as above and see if it works. try to put echo, for and curl commands in different lines and run it.

@Goutham Thanks Goutham. It worked!!