我正在尝试从Jenkins管道脚本中为我的CI-CD应用程序之一运行anypoint-cli, 我将执行项目根目录中的maven软件包,并使用anypoint-cli将mule项目部署到任何点cloudhub,所有这些将在ubuntu机器中完成,所以我的命令将是这样
"anypoint-cli --username=******* --password=****** --organization=**** runtime-mgr cloudhub-application modify --runtime 3.9.1 --workers 1 --workerSize 0.1 --region us-east-1 --property api.name=api.name=groupId:*****:assetId:*** --property api.version=api.version=2.0:***( --property env=DEV anypointproject3 /var/lib/jenkins/workspace/DeployMuleApplication/49/target/banking-account-summary-mdm-api-v1.0.zip"
在终端中,当我执行此部署时发生
root@:~# anypoint-cli --username=*******--password=***** --organization=*****
runtime-mgr cloudhub-application modify --runtime 3.9.1 --workers 1 --workerSize 0.1 --region us-east-1 --property api.name=api.name=groupId:340065b3-09a3-4a45-9c36-ebcdfae43659:assetId:TransactionAPI --property api.version=api.version=2.0:16225146 --property env=DEV anypointproject3 /var/lib/jenkins/workspace/DeployMuleApplication/49/target/banking-account-summary-mdm-api-v1.0.zip
Updating anypointproject3 ...
Domain anypointproject3.us-e1.cloudhub.io
Status UNDEPLOYED
Updated a few seconds ago
Runtime 3.9.1
Previous runtime 3.9.2
File name banking-account-summary-mdm-api-v1.0.zip
Region us-east-1
Persistent queues false
Persistent queues encrypted false
Static IPs enabled false
Monitoring Enabled. Will auto restart when not responding
Workers 0.1 vCores * 1
Properties api."name =
当我尝试像这样的詹金斯脚本时,同样的事情
stage ('DeployeZipFileInCloudHub'){
steps{
script{
def details=props;
def buildNumber=env.BUILD_NUMBER;
def files = findFiles(glob: "**/${buildNumber}/**/*.zip")
def zipfilePath=env.WORKSPACE+"/"+files[0].path;
sh("""anypoint-cli --username=${details.username} --password=${details.password} --organization=${details.organizationName} runtime-mgr cloudhub-application modify --runtime 3.9.1 --workers 1 --workerSize 0.1 --region us-east-1 --property api.name\\=${APIName} --property api.version\\=${APIVersion} --property env\\=DEV ${details.runtimeapplicationName} ${zipfilePath}""")
}
}
它无法识别任何点cli并返回此:::
/var/lib/jenkins/workspace/DeployMuleApplication@tmp/durable-98966186/script.sh: 1: /var/lib/jenkins/workspace/DeployMuleApplication@tmp/durable-98966186/script.sh: anypoint-cli: not found
shell脚本可以与所有其他命令配合使用... 我所有的路径变量看起来都不错,无法识别为什么不将anypoint-cli识别为命令,我是否需要在shell脚本中进行任何配置或更改?...。在此先感谢...
答案 0 :(得分:0)
似乎在用于执行Jenkins的用户路径中未安装anypoint-cli。安装到该用户帐户中,或者如果安装在全局目录中,则使用完整路径。