- 概述
- UiPath CLI
- Azure DevOps 扩展程序
- Jenkins 插件

CI/CD 集成用户指南
UiPath 运行作业
“UiPath 运行作业”构建后步骤将启动已在 Orchestrator 实例上部署的流程。在 Orchestrator 2020.10 版本中,您可以在“流程”选项卡中找到此任务运行的流程。在 Orchestrator 2021.10 及更高版本中,您可以在“流程”下的“自动化”中找到此任务运行的流程。

配置
| 作业参数 | 描述 |
|---|---|
| 流程(必填) | 流程名称。 您可以从 Orchestrator 用户界面获取流程名称。 NAME: ProcessA ENVIRONMENT: Production ProcessName: ProcessA_Production )。 |
| 参数 | JSON 输入文件的完整路径。 当流程需要输入时使用。 JSON 文件格式示例: |
| 优先级 | 运行作业优先级。 |
| 策略 | 指定作业运行策略、已动态分配的作业,或者机器人指定的作业。选择以下选项之一:
|
| Job Type (available for Modern folders only) | 选择要用于执行作业的运行时的许可模式。 |
| Orchestrator 地址 | 您将在其中运行流程的 Orchestrator 实例的地址。 |
| Orchestrator 租户 | 指定 Orchestrator 租户。 |
| Orchestrator 文件夹 | 指定部署指定流程的文件夹。要输入子文件夹,请确保同时输入父文件夹的名称和子文件夹的名称。例如,使用AccountingTeam\TeamJohn 。 |
| 身份验证 | 要对 Orchestrator 进行身份验证,您需要预先在 Jenkins 中创建凭据。 有四个用于身份验证的选项: (1) 使用用户名和密码对本地部署 Orchestrator 进行身份验证。 ( 2 ) 使用刷新令牌(API 密钥)对 Cloud Orchestrator 进行身份验证。 ( 3 ) 使用外部应用身份验证对 Cloud Orchestrator 进行身份验证。 ( 4 ) 使用 对本地部署 Orchestrator 进行身份验证。 |
| 作业结果输出路径 | 指定作业结果的输出路径(例如testResults.json )。结果以 JSON 格式呈现。若未获指定,结果将以UiPathResults.json形式输出到工件阶段目录中。输出结果为 JSON 格式。 |
| 超时 | 指定作业运行的超时时间 (以秒为单位)。 |
| 作业失败即失败 | 至少有一个作业失败时,任务失败。默认值为 True。 |
| 等待作业完成 | 等待作业运行完成。默认值为 True。 |
| 追踪日志记录级别 | 用于启用跟踪日志记录的设置为以下级别之一:
|
| 作业数 | 作业运行数。默认值为 1。 |
| User (available for Modern folders only) | 用户名。此用户不可为计算机用户或 Orchestrator 用户。 对于本地用户,用户名格式应为“计算机名称\用户名” 。 |
| Machine (available for Modern folders only) | 计算机名称。 |
| 机器人名称 | 指定机器人名称的逗号分隔列表。 |
管道示例
pipeline { agent any environment { MAJOR = '1' MINOR = '0' } stages { stage ('Build') { UiPathRunJob( credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'), failWhenJobFails: true, folderName: 'A_Classic', orchestratorAddress: 'https://testorchestrator.some-domain.com', orchestratorTenant: 'Default', parametersFilePath: '', priority: 'Low', processName: 'ProcessA_EnvB', resultFilePath: 'output.json', strategy: Dynamically(jobsCount: 1, machine: 'TestMachine', user: 'TestUser'), timeout: 3600, waitForJobCompletion: true, traceLoggingLevel: 'None' ) UiPathRunJob( credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'), failWhenJobFails: true, folderName: 'A_Classic', orchestratorAddress: 'https://testorchestrator.some-domain.com', orchestratorTenant: 'Default', parametersFilePath: '', priority: 'Low', processName: 'ProcessA_EnvB', resultFilePath: 'output.json', strategy: Robot('robot1,robot2'), timeout: 1800, waitForJobCompletion: false, traceLoggingLevel: 'None' ) } }}pipeline { agent any environment { MAJOR = '1' MINOR = '0' } stages { stage ('Build') { UiPathRunJob( credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'), failWhenJobFails: true, folderName: 'A_Classic', orchestratorAddress: 'https://testorchestrator.some-domain.com', orchestratorTenant: 'Default', parametersFilePath: '', priority: 'Low', processName: 'ProcessA_EnvB', resultFilePath: 'output.json', strategy: Dynamically(jobsCount: 1, machine: 'TestMachine', user: 'TestUser'), timeout: 3600, waitForJobCompletion: true, traceLoggingLevel: 'None' ) UiPathRunJob( credentials: UserPass('825c83c9-9a14-44eb-883a-af54f8078af0'), failWhenJobFails: true, folderName: 'A_Classic', orchestratorAddress: 'https://testorchestrator.some-domain.com', orchestratorTenant: 'Default', parametersFilePath: '', priority: 'Low', processName: 'ProcessA_EnvB', resultFilePath: 'output.json', strategy: Robot('robot1,robot2'), timeout: 1800, waitForJobCompletion: false, traceLoggingLevel: 'None' ) } }}JSON 输入文件
要配置“运行作业”任务,请输入一个 JSON 文件,其中包含在 Orchestrator 中运行流程所需的参数。Orchestrator 仅验证原始值。下面概述了可以传递给 Orchestrator 的输入参数的必需格式:
| 参数 | 所需格式 | 示例 |
|---|---|---|
| 字符串 | 用引号将值括起来。 | 'string value' |
| Int32 | 像提供任何整数一样提供值。 | 11 |
| 布尔值 | 提供 true 或 false形式的值。 | true |
| Double | 提供浮点值。 | 3.5 |
| Datetime | 提供有效的 JSON 表示。 | "2012-04-23T18:25:43.511Z" |
| 数组 | 以有效 JSON 的形式提供值。 | [1,1,2,3,5,8] 或者 ["firstString", "secondString"] |
JSON架构示例
以下是 JSON 架构示例,显示了如何在 JSON 文件中输入所需参数。 确保用于将流程发布到 Orchestrator 的 Studio 项目中存在 JSON 文件中传递的参数。
{ 'in_JenkinsBaseUrl': 'http://localhost:8080/jenkins/', 'in_JenkinsBuildName': '02_UiPathApplicationDemo'}{ 'in_JenkinsBaseUrl': 'http://localhost:8080/jenkins/', 'in_JenkinsBuildName': '02_UiPathApplicationDemo'}