简体   繁体   中英

Calling External Command From Powershell Plugin

I have an application process that runs in IBM UrbanCode. The process uses a Powershell Script that uses the CloudFoundry CLI. Our application process runs on an agent on which the CloudFoundry CLI is installed and available on the Path. Strangely enough, the Powershell plugin doesn't know that the CloudFoundry CLI is on the path. Echoing out the path via the plugin itself confirms this.

Currently, our application process looks like:

  1. Copy CloudFoundry CLI into UCD's workspace at the start of the job.
  2. Execute various CloudFoundry commands via the following sytax: .\\cf login -u foo -p bar -o baz -s bart I want to avoid copying the client into the workspace and having to use the .\\cf sytax in order to make the scripts more portable.

How can I get the Powershell plugin to respect the Agent's path?

Sounds like the user that your powershell agent is running under does not have CloudFoundry in its path. options are 1. Ensure the PATH variable is set system wide. 2. instead of copying the CloudFoundary CLI you could manually add the path to CloudFoundry before you run the script

$env:Path += ;<PATH TO CLOUDFOUNARY>

Note: this will only persist for the current session. To test that you have CloudFoundary in the path you can use

Get-Command cf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM