azure-devops - 在 Azure DevOps Pipeline 中运行 Azure CLI 脚本,但找不到 CLI 脚本
问题描述
param (
$ProjectFilePath= $(Buildin.SourcesDirectory)\TESTREPO7\RuleConfig.json
$ExecutableFilePath= $(Buildin.SourcesDirectory)\TESTREPO7\Studio.zip\Studio\UiPath.Studio.CommandLine.exe
$OutputFilePath= $(Buildin.SourcesDirectory)\$(Get-Date -Format 'yyyy-MM-dd-HH-mm-ss')-Workflow-Analysis.json
)
Write-Output "$(Get-Date -Format 'HH:mm:ss') - STARTED - Workflow Analyzer CLI Script"
$Command = "$ExecutableFilePath analyze -p $ProjectFilePath"
Invoke-Expression $Command | Out-File -FilePath $OutputFilePath
Write-Output "$(Get-Date -Format 'HH:mm:ss') - COMPLETED - Workflow Analyzer CLI Script"
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
错误:
##[section]Starting: Azure CLI UiPathWorkFlow
==============================================================================
Task : Azure CLI
Description : Run Azure CLI commands against an Azure subscription in a Shell script when running on Linux agent or Batch script when running on Windows agent.
Version : 1.152.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
##[error]Script failed with error: Error: Unable to locate executable file: 'C:\agent1\_work\362\s\TESTREPO7\UiPathAnalyze.ps1'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
##[section]Finishing: Azure CLI UiPathWorkFlow
XXXXXXXXXXXXXXXXXXXXX
非常重要 - 在本地计算机上时,uiath.studio.commandline.exe(工作流分析器)的规则存储在用户目录中(%LocalAppData%\UiPath\Rules = C:\Users\User1\AppData\Local\UiPath\Rules) . 我如何能够在上面提供的脚本中输入这些信息?
Azure CLI 最新版本安装在 azure DevOps 代理服务器上。
尝试添加环境参数,但不确定输入什么,但无论如何都会发生此错误。添加的环境没有修复错误。
添加了以下两种环境—</p>
路径 $(Buildin.SourcesDirectory)\TESTREPO7\UipathAnalyze.ps1
Build.SourcesDirectory $(Buildin.SourcesDirectory)\TESTREPO7\UipathAnalyze.ps1
解决方案
检查此文档预定义变量,路径应$(Build.SourcesDirectory)
为$(Buildin.SourcesDirectory)
错误信息是:Unable to locate executable file: 'C:\agent1\_work\362\s\TESTREPO7\UiPathAnalyze.ps1'
UipathAnalyze.ps1 是您共享的代码,它是任务 Azure CLI 中的脚本路径,对吧?我们需要打开文件夹路径C:\agent1\_work\362\s\TESTREPO7
来检查文件是否存在。
另外,你能在本地代理机器上成功运行 .ps1 文件吗?
推荐阅读
- firemonkey - 当我尝试放置圆角时,TRectangle 上的黑色边框
- reactjs - 将formik与material-table集成的好方法是什么?
- docker - 如何使用官方 Tensorflow docker 容器在主机目录中保存和编辑 Jupyter 笔记本?
- typescript - 将 ngif 应用到挂载的组件后不渲染子组件
- c++ - 字符串初始化问题解释
- php - 在 WordPress 中使用 register_theme_directory 进行主题迭代
- swift - CollectionView 中的 CollectionView:使用 didSelectItemAt 执行Segue
- c - 为什么 C 语言 4 个字节上出现一个 char 字符
- c - 管道系统()的标准输出到其他系统的标准输入()
- python - 如何使用 python3 通过 HTTPs 从 ftp 检索文件