UiPath Documentation
cicd-integrations
2025.10
true
CI/CD 集成用户指南
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

部署和激活解决方案

将解决方案包部署到目标文件夹并在 Orchestrator 中将其激活。

将解决方案包上传到 “解决方案”后,可以将其部署到目标文件夹并激活,使其可操作。

提示:

对于由私有证书颁发机构签名的 Orchestrator 实例(例如 UiPath Automation Suite), deploy和deploy-activate也接受--ca-cert和--pinnedpubkey参数。有关场景和示例,请参阅信任自定义证书。

部署工作流​

部署解决方案分为两步:

  1. 部署:创建部署配置,并将包与目标文件夹相关联。
  2. 激活: 使部署生效并可操作。

这种分离使您可以提前准备部署,并在维护窗口期间或手动批准后激活它们。

部署解决方案​

deploy命令会在特定环境中创建解决方案包的部署。

命令语法​

uipcli solution deploy <package-name> [options]
uipcli solution deploy <package-name> [options]
参数​
参数描述必填
<package-name>已上传包的名称是
-v 或者 --version要部署的包版本是
-d 或者 --deploymentName此部署的名称是
-f 或者 --deploymentFolderNameOrchestrator 中的目标文件夹名称是
-UOrchestrator URL是
-T租户名称是
-A组织名称是
-I外部应用程序 ID是
-S外部应用程序密码是
--applicationScope可选作用域(应用默认值)否
--deploymentParentFolder将在其中创建部署文件夹的 Orchestrator 文件夹。如果未指定,则将在租户文件夹中创建部署文件夹。指定后,部署将位于相应的文件夹下。当设置为“ exampleuser@org.com的Workspace”,部署将在指定用户的个人工作区下进行。否
--configPath解决方案配置文件的本地路径;用于具有覆盖绑定的场景。有关获取配置文件的详细信息,请参阅下载解决方案包和配置。否
--traceLevel日志记录级别否
--ca-certOrchestrator/身份 TLS 证书的受信任根 CA 文件(PEM、DER 或 PKCS#7)。重复或用逗号分隔。请参阅信任自定义证书。否
--pinnedpubkey固定叶公钥 ( sha256//<base64> )。请参阅信任自定义证书。否
备注:

解决方案的默认应用程序作用域

在不指定--applicationScope参数的情况下使用外部应用程序身份验证 时,CLI 会自动应用以下默认的解决方案作用域:

Solutions.Packages Solutions.Deployments OR.Execution

重要提示:所有与解决方案相关的 CLI 命令的三个作用域都是必需的。这些作用域被分组在一起,以全面覆盖所有可用的解决方案命令,并且必须集中配置,而不是每个命令单独配置。

重要提示:

如果 Orchestrator 租户的任何级别中都已存在同名部署,则此操作将升级现有部署,而不是创建新部署。如果现有部署处于“失败”状态,则升级不会继续进行;请先解决或卸载失败的部署,然后重试。

重要提示:

在租户级别部署的解决方案不会自动将用户分配给生成的文件夹。要分配帐户,请确保在 Orchestrator(“租户” >“文件夹”)中设置适当的配置。

身份验证​

有关所需作用域和外部应用程序设置,请参阅身份验证和作用域。

示例​

uipcli solution deploy MySolution \
  -v 1.2.3 \
  -d MySolution-Prod-v1.2.3 \
  -f Production \
  -U https://cloud.uipath.com/ \
  -T DefaultTenant \
  -A myorg \
  -I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
  -S **** \
  --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Deployments.Read Solutions.Deployments.Write Solutions.Packages Solutions.Packages.Read Solutions.Packages.Write" \
  --traceLevel Information
uipcli solution deploy MySolution \
  -v 1.2.3 \
  -d MySolution-Prod-v1.2.3 \
  -f Production \
  -U https://cloud.uipath.com/ \
  -T DefaultTenant \
  -A myorg \
  -I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
  -S **** \
  --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Deployments.Read Solutions.Deployments.Write Solutions.Packages Solutions.Packages.Read Solutions.Packages.Write" \
  --traceLevel Information

部署命名约定​

选择有意义的部署名称,其中包括:

  • 解决方案名称
  • 环境标识符
  • 版本或日期
示例​
MySolution-Dev-v1.2.3
MySolution-Test-2025-01-15
MySolution-Prod-Release-1.2.3
InvoiceProcessing-Production-v2.0.0
MySolution-Dev-v1.2.3
MySolution-Test-2025-01-15
MySolution-Prod-Release-1.2.3
InvoiceProcessing-Production-v2.0.0

这可以更轻松地跟踪和管理跨环境的部署。

部署期间会发生的情况​

运行部署命令时:

  1. 该包在解决方案中得到验证。
  2. 已创建部署配置。
  3. 部署已与目标文件夹相关联。
  4. 已初始化特定于环境的绑定。
  5. 部署已准备,但尚未激活。

在您激活解决方案后,该解决方案才会开始执行流程。

重用现有资源​

默认情况下,部署解决方案会配置目标文件夹中的所有资源。当目标环境已包含您要重用的资源时,例如与外部系统的共享连接,请通过部署配置文件将解决方案的资源链接到现有资源,然后使用 --configPath 进行部署。

这相当于在 Orchestrator 中手动部署解决方案时手动选择“自定义”并链接资源。

备注:

链接位于 Orchestrator 文件夹中的资源需要 OR.Folders 和 RCS.FolderAuthorization 作用域,并且必须将外部应用程序分配到保存现有资源的文件夹。

步骤​

  1. 下载包的部署配置。请参阅下载解决方案包和配置。

    uipcli solution download-config MySolution \
      -d C:\Configs \
      -v 1.0.0 \
      --format json \
      -U https://cloud.uipath.com/ \
      -T DefaultTenant \
      -A myorg \
      -I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
      -S **** \
      --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Packages OR.Folders RCS.FolderAuthorization"
    uipcli solution download-config MySolution \
      -d C:\Configs \
      -v 1.0.0 \
      --format json \
      -U https://cloud.uipath.com/ \
      -T DefaultTenant \
      -A myorg \
      -I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
      -S **** \
      --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Packages OR.Folders RCS.FolderAuthorization"
    
  2. 打开下载的配置文件。

  3. 找到要重用的资源条目。

  4. 添加一个 linkToResource 块,该块按名称和文件夹将条目指向现有 Orchestrator 资源。对于连接资源,条目如下所示:

    {
      "kind": "connection",
      "name": "Slack connection",
      "resourceKey": "b060048b-4be3-425e-9822-9139605ba2a7",
      "folderPaths": [
        "solution_folder"
      ],
      "configuration": {
        "description": null,
        "authenticationType": "AuthenticateAfterDeployment",
        "connectorVersion": "2.14.7",
        "connectorKey": "uipath-salesforce-slack",
        "pollingInterval": 5
      },
      "linkToResource": {
        "name": "Existing Slack connection",
        "folderPath": "Shared"
      }
    }
    {
      "kind": "connection",
      "name": "Slack connection",
      "resourceKey": "b060048b-4be3-425e-9822-9139605ba2a7",
      "folderPaths": [
        "solution_folder"
      ],
      "configuration": {
        "description": null,
        "authenticationType": "AuthenticateAfterDeployment",
        "connectorVersion": "2.14.7",
        "connectorKey": "uipath-salesforce-slack",
        "pollingInterval": 5
      },
      "linkToResource": {
        "name": "Existing Slack connection",
        "folderPath": "Shared"
      }
    }
    

    linkToResource 对象将解决方案的资源指向现有资源; configuration 下的字段因资源类型而异。

  5. 部署解决方案,使用 --configPath 传递编辑后的配置。

    uipcli solution deploy MySolution \
      -v 1.0.0 \
      -d MySolution-Prod-v1.0.0 \
      -f Production \
      --deploymentParentFolder "Shared" \
      --configPath C:\Configs\MySolution.1.0.0.json \
      -U https://cloud.uipath.com/ \
      -T DefaultTenant \
      -A myorg \
      -I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
      -S **** \
      --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Packages OR.Folders RCS.FolderAuthorization"
    uipcli solution deploy MySolution \
      -v 1.0.0 \
      -d MySolution-Prod-v1.0.0 \
      -f Production \
      --deploymentParentFolder "Shared" \
      --configPath C:\Configs\MySolution.1.0.0.json \
      -U https://cloud.uipath.com/ \
      -T DefaultTenant \
      -A myorg \
      -I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
      -S **** \
      --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Packages OR.Folders RCS.FolderAuthorization"
    

部署会重用链接的资源,而不是在目标文件夹中创建新资源。

连接身份验证​

对于连接资源,链接现有连接只是多个选项中的一个。配置文件中的 authenticationType 字段接受两个值:ConfigurableByUsers 和 AuthenticateAfterDeployment。

将 authenticationType 设置为 ConfigurableByUsers 以保留连接,并将其选择推迟到执行时间。用户在自动化运行时选择连接并进行身份验证,这也是有效的激活配置。

使用 AuthenticateAfterDeployment,必须在部署完成后对连接进行身份验证。如果在运行激活时未通过身份验证,则会将激活报告为失败。

激活部署​

deploy-activate命令使部署生效并可操作。

命令语法​

uipcli solution deploy-activate <deployment-name> [options]
uipcli solution deploy-activate <deployment-name> [options]
参数​
参数描述必填
<deployment-name>要激活的部署的名称是
-UOrchestrator URL是
-T租户名称是
-A组织名称是
-I外部应用程序 ID是
-S外部应用程序密码是
--applicationScope所需作用域是
--traceLevel日志记录级别否
--ca-certOrchestrator/身份 TLS 证书的受信任根 CA 文件(PEM、DER 或 PKCS#7)。重复或用逗号分隔。请参阅信任自定义证书。否
--pinnedpubkey固定叶公钥 ( sha256//<base64> )。请参阅信任自定义证书。否

身份验证​

有关所需作用域和外部应用程序设置,请参阅身份验证和作用域。

示例​

uipcli solution deploy-activate MySolution-Prod-v1.2.3 \
  -U https://cloud.uipath.com/ \
  -T DefaultTenant \
  -A myorg \
  -I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
  -S **** \
  --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Deployments.Read Solutions.Deployments.Write Solutions.Packages Solutions.Packages.Read Solutions.Packages.Write" \
  --traceLevel Information
uipcli solution deploy-activate MySolution-Prod-v1.2.3 \
  -U https://cloud.uipath.com/ \
  -T DefaultTenant \
  -A myorg \
  -I 12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
  -S **** \
  --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Deployments.Read Solutions.Deployments.Write Solutions.Packages Solutions.Packages.Read Solutions.Packages.Write" \
  --traceLevel Information

激活期间会发生的情况​

激活部署时:

  1. 该部署将成为目标文件夹中的活动版本。
  2. 触发器已激活。
  3. 同一文件夹中的任何先前处于活动状态的部署都将被停用。

CI/CD 管道集成​

完成部署工作流​

steps:
  # 1. Pack the Solution
  - name: Pack Solution
    run: |
      uipcli solution pack ./MySolution \
        --output ./packages \
        --version "1.0.${{ github.run_number }}"

  # 2. Upload to Solutions Management
  - name: Upload Package
    run: |
      uipcli solution upload-package ./packages/MySolution.1.0.${{ github.run_number }}.zip \
        -U ${{ secrets.ORCHESTRATOR_URL }} \
        -T ${{ secrets.ORCHESTRATOR_TENANT }} \
        -A ${{ secrets.ORG_NAME }} \
        -I ${{ secrets.EXTERNAL_APP_ID }} \
        -S ${{ secrets.EXTERNAL_APP_SECRET }} \
        --applicationScope "AutomationSolutions Solutions.Packages Solutions.Packages.Write"

  # 3. Deploy to target environment
  - name: Deploy Solution
    run: |
      uipcli solution deploy MySolution \
        -v "1.0.${{ github.run_number }}" \
        -d "MySolution-Prod-v1.0.${{ github.run_number }}" \
        -f Production \
        -U ${{ secrets.ORCHESTRATOR_URL }} \
        -T ${{ secrets.ORCHESTRATOR_TENANT }} \
        -A ${{ secrets.ORG_NAME }} \
        -I ${{ secrets.EXTERNAL_APP_ID }} \
        -S ${{ secrets.EXTERNAL_APP_SECRET }} \
        --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Deployments.Read Solutions.Deployments.Write Solutions.Packages Solutions.Packages.Read Solutions.Packages.Write"

  # 4. Activate the deployment
  - name: Activate Deployment
    run: |
      uipcli solution deploy-activate "MySolution-Prod-v1.0.${{ github.run_number }}" \
        -U ${{ secrets.ORCHESTRATOR_URL }} \
        -T ${{ secrets.ORCHESTRATOR_TENANT }} \
        -A ${{ secrets.ORG_NAME }} \
        -I ${{ secrets.EXTERNAL_APP_ID }} \
        -S ${{ secrets.EXTERNAL_APP_SECRET }} \
        --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Deployments.Read Solutions.Deployments.Write Solutions.Packages Solutions.Packages.Read Solutions.Packages.Write"
steps:
  # 1. Pack the Solution
  - name: Pack Solution
    run: |
      uipcli solution pack ./MySolution \
        --output ./packages \
        --version "1.0.${{ github.run_number }}"

  # 2. Upload to Solutions Management
  - name: Upload Package
    run: |
      uipcli solution upload-package ./packages/MySolution.1.0.${{ github.run_number }}.zip \
        -U ${{ secrets.ORCHESTRATOR_URL }} \
        -T ${{ secrets.ORCHESTRATOR_TENANT }} \
        -A ${{ secrets.ORG_NAME }} \
        -I ${{ secrets.EXTERNAL_APP_ID }} \
        -S ${{ secrets.EXTERNAL_APP_SECRET }} \
        --applicationScope "AutomationSolutions Solutions.Packages Solutions.Packages.Write"

  # 3. Deploy to target environment
  - name: Deploy Solution
    run: |
      uipcli solution deploy MySolution \
        -v "1.0.${{ github.run_number }}" \
        -d "MySolution-Prod-v1.0.${{ github.run_number }}" \
        -f Production \
        -U ${{ secrets.ORCHESTRATOR_URL }} \
        -T ${{ secrets.ORCHESTRATOR_TENANT }} \
        -A ${{ secrets.ORG_NAME }} \
        -I ${{ secrets.EXTERNAL_APP_ID }} \
        -S ${{ secrets.EXTERNAL_APP_SECRET }} \
        --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Deployments.Read Solutions.Deployments.Write Solutions.Packages Solutions.Packages.Read Solutions.Packages.Write"

  # 4. Activate the deployment
  - name: Activate Deployment
    run: |
      uipcli solution deploy-activate "MySolution-Prod-v1.0.${{ github.run_number }}" \
        -U ${{ secrets.ORCHESTRATOR_URL }} \
        -T ${{ secrets.ORCHESTRATOR_TENANT }} \
        -A ${{ secrets.ORG_NAME }} \
        -I ${{ secrets.EXTERNAL_APP_ID }} \
        -S ${{ secrets.EXTERNAL_APP_SECRET }} \
        --applicationScope "AutomationSolutions Solutions.Deployments Solutions.Deployments.Read Solutions.Deployments.Write Solutions.Packages Solutions.Packages.Read Solutions.Packages.Write"

具有手动批准功能的门控部署​

您可以单独执行部署和激活步骤来实施批准工作流:

# Stage 1: Deploy (automated)
- stage: DeployToProduction
  jobs:
  - job: Deploy
    steps:
    - script: |
        uipcli solution deploy MySolution -v $(version) -d MySolution-Prod-$(version) -f Production ...
      displayName: 'Prepare Production Deployment'

# Stage 2: Activate (requires approval)
- stage: ActivateProduction
  dependsOn: DeployToProduction
  # Manual approval gate configured in Azure DevOps
  jobs:
  - deployment: Activate
    environment: 'Production'
    steps:
    - script: |
        uipcli solution deploy-activate MySolution-Prod-$(version) ...
      displayName: 'Activate Production Deployment'
# Stage 1: Deploy (automated)
- stage: DeployToProduction
  jobs:
  - job: Deploy
    steps:
    - script: |
        uipcli solution deploy MySolution -v $(version) -d MySolution-Prod-$(version) -f Production ...
      displayName: 'Prepare Production Deployment'

# Stage 2: Activate (requires approval)
- stage: ActivateProduction
  dependsOn: DeployToProduction
  # Manual approval gate configured in Azure DevOps
  jobs:
  - deployment: Activate
    environment: 'Production'
    steps:
    - script: |
        uipcli solution deploy-activate MySolution-Prod-$(version) ...
      displayName: 'Activate Production Deployment'

多环境提升​

按顺序将相同版本部署到多个环境:

# Deploy to Dev
uipcli solution deploy MySolution -v 1.2.3 -d MySolution-Dev-1.2.3 -f Dev ...
uipcli solution deploy-activate MySolution-Dev-1.2.3 ...

# Deploy to Test
uipcli solution deploy MySolution -v 1.2.3 -d MySolution-Test-1.2.3 -f Test ...
uipcli solution deploy-activate MySolution-Test-1.2.3 ...

# Deploy to Production (after approval)
uipcli solution deploy MySolution -v 1.2.3 -d MySolution-Prod-1.2.3 -f Production ...
uipcli solution deploy-activate MySolution-Prod-1.2.3 ...
# Deploy to Dev
uipcli solution deploy MySolution -v 1.2.3 -d MySolution-Dev-1.2.3 -f Dev ...
uipcli solution deploy-activate MySolution-Dev-1.2.3 ...

# Deploy to Test
uipcli solution deploy MySolution -v 1.2.3 -d MySolution-Test-1.2.3 -f Test ...
uipcli solution deploy-activate MySolution-Test-1.2.3 ...

# Deploy to Production (after approval)
uipcli solution deploy MySolution -v 1.2.3 -d MySolution-Prod-1.2.3 -f Production ...
uipcli solution deploy-activate MySolution-Prod-1.2.3 ...

回滚策略​

要回滚到以前的版本:

  1. 使用新的部署名称部署先前版本。
  2. 激活以前版本的部署。
  3. (可选)卸载较新的部署。
# Roll back to v1.2.2
uipcli solution deploy MySolution -v 1.2.2 -d MySolution-Prod-Rollback-1.2.2 -f Production ...
uipcli solution deploy-activate MySolution-Prod-Rollback-1.2.2 ...
# Roll back to v1.2.2
uipcli solution deploy MySolution -v 1.2.2 -d MySolution-Prod-Rollback-1.2.2 -f Production ...
uipcli solution deploy-activate MySolution-Prod-Rollback-1.2.2 ...

后续步骤​

部署并激活解决方案后,您可以:

  1. 监控 Orchestrator 中的执行情况。
  2. 在不再需要时卸载部署。
  3. 按照相同的工作流部署新版本。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新