【问题标题】:GitLab CI Runner Windows executes Powershell command differently to local PowershellGitLab CI Runner Windows 执行 Powershell 命令的方式与本地 Powershell 不同
【发布时间】:2022-08-06 04:49:49
【问题描述】:

我有一个 Powershell 命令,它使用一些参数启动一个程序并等待执行结束。 如果我在 Powershell 中手动执行该命令,一切都会按预期工作。 如果我通过同一台机器上的 GitLab Runner 执行相同的命令,则该过程实际上永远不会启动,C​​I 作业会立即成功。

外壳命令:

Start-Process -Passthru -FilePath \"C:\\Program Files\\CODESYS 3.5.17.30\\CODESYS\\Common\\CODESYS.exe\" -ArgumentList \"--runscript=\'codesys_automation.py\' --profile=\'CODESYS V3.5 SP17 Patch 3\' --noUI\" | Wait-Process

gitlab-ci.yml 作业(由有权访问 codesys.exe 的运行者执行):

configure-plc:
  tags:
    - codesys
  stage: configure-plc
  script:
    - Start-Process -Passthru -FilePath \"C:\\Program Files\\CODESYS 3.5.17.30\\CODESYS\\Common\\CODESYS.exe\" -ArgumentList \"--runscript=\'codesys_automation.py\' --profile=\'CODESYS V3.5 SP17 Patch 3\' --noUI\" | Wait-Process

如何让跑步者表现得像手动 Powershell 并让它打印出程序标准输出输出?

  • 我不认为 codesys 标签在这里是相关的
  • 这是必要的,因此该作业只能由运行程序在安装了 Codesys 的 Windows 机器上执行
  • Guiorgy 在 Stack Overflow 上讨论问题的标签,而不是 Gitlab CI YAML 描述中的标签。

标签: powershell gitlab-ci gitlab-ci-runner gitlab-ci.yml


【解决方案1】:

尝试这个

configure-plc:
  tags:
    - codesys
  stage: configure-plc
  script:
    - '& "C:\Program Files\CODESYS 3.5.17.30\CODESYS\Common\CODESYS.exe" --runscript=codesys_automation.py --profile=CODESYS V3.5 SP17 Patch 3 --noUI'

【讨论】:

    猜你喜欢
    • 2022-08-06
    • 2014-11-03
    • 2022-07-11
    • 2021-11-23
    • 1970-01-01
    • 1970-01-01
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多