How can I run TestStand when calling a powershell script from Gitlab? The powershell script works when running in Win10 as a standalone script but fails when running the same script from GitLab.
Here TestStand never terminates and it is running as background process in Win10.
Any ideas why??
Well, I have a little bit more experience. I am googling my way around all of this since a week now.
TestStand has been a pain... But, in general prompts are the cause.
To speed up the process try this:
In your gitlab runner installation folder (e.g. C:\GitLab-Runner), run powershell as admin:
gitlab-runner.exe --debug run
The last line lets you see what's happening in real time on your screen (the runner screen). So retry the pipeline and see what's happening.
When you are done:
thanks for your reply... it's good to know there is a real time mode which gives more information about gitlab-runner. Now, when running it in the debug mode I see that TestStand opens in foreground and the sequence runs as expected and TestStand application terminates. Also I get an exitcode in GitLab....
So far so good.
Do you know what is the difference now between "normal" and "debugging" mode in terms of TestStand? Or how do I need to configure the gitlab-runner that the behavior is the same when not running in "deubg" mode?
Of course, I could leave it this way but I think it should run this way, correct?
Well, without more information about what you are trying to do, it's going to be difficult to help.
Can you share what you are trying to run? Your command line instructions, a sample of the sequence file you are trying to run.
Also, have you had a look at:
so my call from a batch file is:
"C:\Program Files\National Instruments\TestStand 2020\UserInterfaces\Full-Featured\CVI\TestStand 2020 (64-bit) CVI UI - Operator.lnk" -operatorInterface -runEntryPoint "Single Pass" "C:\temp\test.seq" -outputToStdIO -quit
The sequence only shows a message to the user, that's all. If I run this batch file everything works as expected. But (!) when calling the SAME file with gitlab it does not. Now, TestStand runs as a background process and never terminates. When manually terminating the process than gitlab also terminates.
It also works when starting gitlab-runner in the live-mode. Here I can see that TestStand runs in foreground and therefore it works.
Sorry I don't have much experience with CVI. But a couple of questions:
- How do you handle the TestStand Login when the execution starts?
- In the links I sent previously there are a couple of settings you want to set if you are going to use TestStand headless ( https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x3IuCAI&l=en-ZA )
- What happens if you use the executable instead of the shortcut? ("C:\Program Files\National Instruments\TestStand 2020\UserInterfaces\Full-Featured\CVI\Source Code\x64\TestExec.exe" instead of "C:\Program Files\National Instruments\TestStand 2020\UserInterfaces\Full-Featured\CVI\TestStand 2020 (64-bit) CVI UI - Operator.lnk")
- When you run gitlab (with "gitlab-runner.exe run") does everything work as expected (without requiring any inputs/actions from you)?
- What does "When manually terminating the process than gitlab also terminates." mean? How do you manually terminate? Is that using the GitLAB web console?
it looks like I found the solution of the problem. The TestStand call looks like this:
& "C:\Program Files\National Instruments\TestStand 2020\UserInterfaces\Full-Featured\CVI\Source Code\x64\TestExec.exe" -operatorInterface -runEntryPoint "Single Pass" "C:\temp\test.seq" -outputToStdIO -quit
So don't use in the powershell script: "Start-Process" only "&" to call TestStand.
For a batch file don't use "Start "" /wait" only "&" to call TestStand
This will run TestStand and terminates it as expected after finishing the sequences. The output errorlevel is "passed" or "failed" in gitlab.
It does not matter if you use .exe or the shortcut