cicd-integrations
2025.10
true
CI/CD 集成用户指南
- 概述
- UiPath CLI
- Azure DevOps 扩展程序
- Jenkins 插件
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。
新发布内容的本地化可能需要 1-2 周的时间才能完成。
恢复和分析解决方案
使用 CLI 还原解决方案依赖项,并根据监管规则验证解决方案。
在打包解决方案之前,您通常会还原其依赖项并根据监管规则进行验证。这些操作在本地运行,不需要 Orchestrator 身份验证。
提示:
当restore或analyze命令需要到达 Orchestrator 时(例如,私有订阅源上托管的库),它们也接受--ca-cert和--pinnedpubkey参数,以连接到由私有证书颁发机构签名的实例。有关场景和示例,请参阅信任自定义证书。
恢复依赖项
restore命令会将所有必需的活动包和项目依赖项下载到本地文件夹。
命令语法
uipcli solution restore <solution-path> [options]
uipcli solution restore <solution-path> [options]
参数
示例
uipcli solution restore C:\Solutions\MySolution \
--restoreFolder C:\Work\Output \
--traceLevel Verbose
uipcli solution restore C:\Solutions\MySolution \
--restoreFolder C:\Work\Output \
--traceLevel Verbose
使用自定义 NuGet 订阅源
如果您的解决方案依赖于自定义订阅源(包括 Orchestrator 订阅源)中的活动,您可以在解决方案目录中提供nuget.config文件,或使用库 Orchestrator 参数指定订阅源:
uipcli solution restore C:\Solutions\MySolution \
-A myorg \
-I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
-S **** \
--libraryOrchestratorApplicationScope "OR.Folders OR.Settings.Read" \
--libraryOrchestratorTenant DefaultTenant \
--libraryOrchestratorUrl https://cloud.uipath.com/ \
--libraryOrchestratorFolder MyFolder \
--traceLevel Verbose
uipcli solution restore C:\Solutions\MySolution \
-A myorg \
-I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
-S **** \
--libraryOrchestratorApplicationScope "OR.Folders OR.Settings.Read" \
--libraryOrchestratorTenant DefaultTenant \
--libraryOrchestratorUrl https://cloud.uipath.com/ \
--libraryOrchestratorFolder MyFolder \
--traceLevel Verbose
有关配置活动来源的更多详细信息,请参阅管理 NuGet 订阅源。
性能注意事项
NuGet 还原通常是解决方案打包过程中最慢的步骤。每个还原操作都必须同时解决直接依赖项和传递依赖项。
要提高还原性能,请执行以下操作:
- 在管道运行之间缓存 NuGet 全局包文件夹:
- Windows:
%UserProfile%\.nuget\packages - Linux/macOS:
~/.nuget/packages
- Windows:
- 使用修剪后的
nuget.config,仅可访问订阅源:- 从配置中删除速度慢或无法访问的订阅源。
- 按可靠性和速度对订阅源进行排序。
- 如果需要持久性缓存,请使用自托管代理。
有关 Azure DevOps 和其他 CI/CD 平台中的缓存示例,请参阅《管理 NuGet 订阅源》文档。
分析解决方案
analyze命令根据工作流分析器规则和监管策略验证解决方案。
命令语法
uipcli solution analyze <solution-path> [options]
uipcli solution analyze <solution-path> [options]
参数
| 参数 | 描述 | 必填 |
|---|---|---|
<solution-path> | 解决方案文件夹或.uipx文件的路径 | 是 |
--governanceFilePath | 监管策略 JSON 文件的路径 | 否 |
--resultPath | 分析结果 JSON 的保存路径 | 否 |
--analyzerTraceLevel | 分析器日志记录级别: Warning 、 Information 、 Verbose | 否 |
--traceLevel | CLI 日志记录级别 | 否 |
--ca-cert | 库 Orchestrator/Identity TLS 证书的受信任根 CA 文件(PEM、DER 或 PKCS#7)。重复或用逗号分隔。请参阅信任自定义证书。 | 否 |
--pinnedpubkey | 固定叶公钥 ( sha256//<base64> )。请参阅信任自定义证书。 | 否 |
示例
uipcli solution analyze C:\Solutions\MySolution \
--governanceFilePath C:\Policies\uipath.policy.Production.json \
--resultPath C:\Output\analyze.json \
--analyzerTraceLevel Warning \
--traceLevel Information
uipcli solution analyze C:\Solutions\MySolution \
--governanceFilePath C:\Policies\uipath.policy.Production.json \
--resultPath C:\Output\analyze.json \
--analyzerTraceLevel Warning \
--traceLevel Information
监管策略
监管策略定义了在打包和部署解决方案之前必须满足的规则。这些措施通常包括:
- 代码质量标准
- 命名约定
- 安全检查
- 性能阈值
策略文件是配置工作流分析器规则的 JSON 文档。您可以:
- 在 Studio 中创建策略
- 从 Orchestrator 中导出
- 将其与解决方案代码一起进行版本控制
在 CI/CD 中使用分析结果
管道可以解析分析结果 JSON,以便:
- 如果发现严重违规行为,则构建失败
- 生成合规性报告
- 将部署管理到生产环境
典型工作流
一种常见的 CI/CD 模式在打包前结合使用了还原和分析:
# 1. Restore dependencies
uipcli solution restore C:\Solutions\MySolution \
--restoreFolder C:\Output\Dependencies \
--traceLevel Information
# 2. Analyze against governance rules
uipcli solution analyze C:\Solutions\MySolution \
--governanceFilePath C:\Policies\production.json \
--resultPath C:\Output\analysis.json \
--analyzerTraceLevel Warning
# 3. Check analysis results
# 4. Continue to packaging...
# 1. Restore dependencies
uipcli solution restore C:\Solutions\MySolution \
--restoreFolder C:\Output\Dependencies \
--traceLevel Information
# 2. Analyze against governance rules
uipcli solution analyze C:\Solutions\MySolution \
--governanceFilePath C:\Policies\production.json \
--resultPath C:\Output\analysis.json \
--analyzerTraceLevel Warning
# 3. Check analysis results
# 4. Continue to packaging...
这可确保只有经过验证的合规解决方案才能继续打包和部署。