0

I have a Powershell command that starts a program with some arguments and waits for the execution to end. If I execute that command manually in Powershell everything works as expected. If I execute the same command through a GitLab Runner on the same machine, the process is never actually started and the CI job succeeds immediately.

The shell command:

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

The gitlab-ci.yml job (executed by a runner with access to the 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

How do I make the runner behave just like the manual Poweshell and let it print out the programms stdout output?

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
kilo322
  • 1
  • 3
  • I don't think the codesys tag is relevant here – Guiorgy Feb 22 '22 at 18:29
  • It's necessary so that this job is only executed by the runner on a Windows machine with Codesys installed – kilo322 Feb 23 '22 at 07:34
  • Guiorgy is talking about the tag for the question here on Stack Overflow and not about the tag in your Gitlab CI YAML description. – riQQ Apr 06 '22 at 09:58

1 Answers1

0

Try this

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'
Sayan Daw
  • 56
  • 3
  • can you confirm if this works? I have the same issue and this doenst work for me. - '& "C:\Keil_v5\UV4\UV4.exe" -b ePIL.uvprojx -j0 -o build'. I tried this – user3922604 Sep 20 '22 at 13:18