Hello Prakash, What happens if you add "echo" to the start of the command? Assuming it works as intended, the output of echo should make it clear whether or not the environment variables are expanding properly.
Another potential issue is with the way the command is constructed in the Pipeline definition. GoCD *may* be trying to execute a command called '/usr/bin/curl -L -k -v -u <username>:<password> -X GET "https://artifactory.com/service/rest/v1/search/assets/download?group=/xx-prj/master/${GO_PIPELINE_LABEL}&name=xx-prj/master/${GO_PIPELINE_LABEL}/${GO_REVISION_MYGIT}.zip" -o "${GO_REVISION_MYGIT}.zip" && unzip -o "${GO_REVISION_MYGIT}.zip" -d .', rather than running curl with the rest of the string as arguments. We've also had trouble getting quoting just right in our custom commands. Here's the XML definition of the command from my previous message: <exec command="cmd"> <arg>/c</arg> <arg>""#{msbuild}"</arg> <arg>"#{projectRootDirectory}\#{projectName}\#{projectName}.proj"</arg> <arg>/t:Release"</arg> <runif status="passed" /> </exec> Note that each space-delimited argument is in its own <arg> element, which translates to each on its own line if editing in the GUI. Note as well that each argument that could contain a space is enclosed in double quotes. Lastly, to get this to work, we had to add a double quote to the start of the second argument (first one after "/c") and to the end of the last argument so that the final argument list becomes */c ""msbuild" "path/to/project.proj" /t:Release".* Hope this helps, Jason On Monday, 10 August 2020 10:31:19 UTC-4, Prakash Tirumalareddy wrote: > > Hello Jason > Thanks for your email. > If I updated variable manually the command works in agent. > > I am getting the following error: which does not tell me that is related > with populating the variable or not.. > > *[go] Job Started: 2020-08-10 19:53:21 AEST* > > *[go] Start to prepare xx-prj/77/6-DeploySIT1/1/deploy on test.internal > [/var/lib/go-agent]* > > *[go] Cleaning working directory "/var/lib/go-agent/pipelines/ xx-prj" > since stage is configured to clean working directory* > > *[go] Skipping material update since stage is configured not to fetch > materials* > > *[go] Start to build xx-prj /77/6-DeploySIT1/1/deploy > on test.internal [/var/lib/go-agent]* > > *[go] Task: /usr/bin/curl -L -k -v -u <username>:<password> -X GET > "https://artifactory.com/service/rest/v1/search/assets/download?group=/xx-prj/master/${GO_PIPELINE_LABEL}&name=xx-prj/master/${GO_PIPELINE_LABEL}/${GO_REVISION_MYGIT}.zip > > <https://artifactory.com/service/rest/v1/search/assets/download?group=/xx-prj/master/$%7BGO_PIPELINE_LABEL%7D&name=xx-prj/master/$%7BGO_PIPELINE_LABEL%7D/$%7BGO_REVISION_MYGIT%7D.zip>" > > -o "${GO_REVISION_MYGIT}.zip" && unzip -o "${GO_REVISION_MYGIT}.zip" -d > .'took: 0.2s* > > *Error happened while attempting to : /usr/bin/curl -L -k -v -u > <username>:<password> -X GET > "https://artifactory.com/service/rest/v1/search/assets/download?group=/xx-prj/master/${GO_PIPELINE_LABEL}&name=xx-prj/master/${GO_PIPELINE_LABEL}/${GO_REVISION_MYGIT}.zip > > <https://artifactory.com/service/rest/v1/search/assets/download?group=/xx-prj/master/$%7BGO_PIPELINE_LABEL%7D&name=xx-prj/master/$%7BGO_PIPELINE_LABEL%7D/$%7BGO_REVISION_MYGIT%7D.zip>" > > -o "${GO_REVISION_MYGIT}.zip" && unzip -o "${GO_REVISION_MYGIT}.zip" -d .] > can be executed on this agent. * > > *[Debug Information] Environment variable PATH: > /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin* > > *[go] Task status: failed, took: 0.2s* > > *[go] Current job status: failed* > > *[go] Start to create properties xx-prj/77/6-DeploySIT1/1/deploy > on test.internal [/var/lib/go-agent]* > > *[go] Start to upload xx-prj/77/6-DeploySIT1/1/deploy on test.internal > [/var/lib/go-agent]* > > *[go] Job completed xx-prj/77/6-DeploySIT1/1/deploy > on test.internal [/var/lib/go-agent]* > > Regards > Prakash > > > On Tuesday, 11 August 2020 at 00:17:25 UTC+10 jsm...@scimarketview.com > wrote: > >> Hello Prakash, >> >> What do you see in the console output beyond the error message? I believe >> the raw command should get printed to console which would make >> troubleshooting easier. >> >> Here is an example from the raw output of one of our Pipelines that uses >> Custom Commands: >> >> !!|10:43:38.980 [go] Task: cmd /c >> ""C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" >> "tfs\path\to\project.proj" "/t:Release\"" >> >> >> I suspect that the issue you are having is that GoCD tries to expand the >> environment variables used in your command before they have been defined >> but, again, you should be able to see that from the console output. >> >> If the console output looks right, including all of the environment >> variables, try running it from the command line on the agent to see what >> the error message is there. >> >> Hope this helps, >> Jason >> >> >> >> On Monday, 10 August 2020 09:18:09 UTC-4, Prakash Tirumalareddy wrote: >>> >>> Hello Helge >>> >>> We tried using the curl command: >>> >>> 6-DeploySIT1: >>> fetch_materials: no >>> clean_workspace: yes >>> approval: manual >>> environment_variables: >>> app_environment: nonprod >>> verify_repo: verify-repo >>> jobs: >>> deploy: >>> tasks: >>> - exec: >>> command: /usr/bin/curl -L -k -v -u <username>:<password> -X >>> GET " >>> https://artifactory.xys.com/service/rest/v1/search/assets/download?group=/<artefact_name>/master/${GO_PIPELINE_LABEL}&name=<artefact_name>/master/${GO_PIPELINE_LABEL}/${GO_REVISION_MYGIT}.zip" >>> >>> -o "${GO_REVISION_MYGIT}.zip" && unzip -o "${GO_REVISION_MYGIT}.zip" -d .' >>> - exec: >>> arguments: >>> - deploy >>> command: make >>> >>> Error is: >>> Check your command whether it can be executed on your agent. >>> >>> Regards >>> Prakash >>> >>> On Saturday, 8 August 2020 at 00:06:00 UTC+10 bewal...@gmail.com wrote: >>> >>>> Hello Prakash, >>>> >>>> for an example see here: >>>> https://github.com/tomzo/gocd-yaml-config-plugin#example >>>> >>>> tasks: # ordered list of tasks to execute >>>> - exec: # indicates type of task >>>> command: make >>>> arguments: >>>> - "VERBOSE=true" >>>> >>>> You can specify your curl command here instead of the "make" call. The >>>> curl call is specific to your artifactory and the repository type you use >>>> -- so it's difficult for me to give you a neaningfull example. >>>> >>>> Regards, >>>> Helge >>>> >>>> -- You received this message because you are subscribed to the Google Groups "go-cd" group. To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/7acf3abe-09e7-4b6c-9ead-f2256d816630o%40googlegroups.com.