Gitlab Runner and LabVIEW-CLI

Usually I’ve been trying to run all my testing pipeline using docker images (docker image repo). Mainly because it is a very clean and nice way to run reproducible tests, as each container has a limited life cycle and gets destroyed after a job.

Last week (for some reason that I am still trying to figure out) I had issues trying to run some tests on LabVIEW Realtime/FPGA Image, yes, it works sometimes, but sometimes there are some dependencies missing that are not installed during the docker build, because there are some workarounds to make it work, and probably they are the issue here.

If you want to know what I am talking about, check out 7×7 in GLA by Christian Butcher about Docker and LabVIEW.

So, I had to spin up a Virtual Machine for doing this job while I don’t fix the problem.

Installing and Running

All good, VM with Windows 10 installed, LabVIEW 2020, Real Time Module, FPGA, VI Analyzer Toolkit, Caraya, Licensed LV. Well, ready to go.

Downloading gitlab-runner:

https://docs.gitlab.com/runner/install/windows.html

Register, install and running (as administrator):

.\gitlab-runner register
.\gitlab-runner install
.\gitlab-runner start

Yey, just use it now, right? I over simplified the “register” step, but the link above details everything.

Call LabVIEWCLI in your pipeline configuration file (gitlab-ci.yml) and then:

What? I did everything. 😦

Let’s debug and find a solution for this problem.

  1. Opened the LabVIEW prior to calling in the pipeline. Well, it works, not a problem with the runner.

The next two items I consider to be 80% of the problems with LabVIEW in automated software engineering processes.

  1. Checked the dependencies. Yep, everything installed, it runs ok when LabVIEW is opened.
  2. Licensing. I had this same problem when I was trying to solve problems with licensing and docker. But, yes, I opened the License Manager and everything was ok.

Looking for some answers around

In forums, I did find some solutions:

  • Change TCP ports (didn’t work)
  • Check Firewall (ok)
  • Use G-CLI. Great, but, I’ve already built some Operations (Caraya and Code Quality) around LabVIEW CLI, changing it, would have to rewrite some of these VI’s(btw. I wish LabVIEWCLI were as verbose as G-CLI, sometimes you have to guess errors in LVCLI).

The Solution

It turns out that, the problem was the third one, licensing.

Re-reading the documentation of the gitlab-runner it says that for default installation:

“Run service using Built-in System Account”

Hum…. System Account is not tied to any license so it must be it. Looking at Task Manager there it was the Gitlab-Runner as Service in System Account.

Right below there is a guide for running using as a specific user account.

Stop, uninstall, install, start (don’t need to mess with register step):

.\gitlab-runner stop
.\gitlab-runner uninstall
.\gitlab-runner.exe install --user ENTER-YOUR-USERNAME-WITH-LV-LICENSE --password ENTER-YOUR-PASSWORD 
.\gitlab-runner start

Easy? Not that much, after doing that, an error was printed:

The service did not start due to a logon failure

  1. Check Password – Ok
  2. Check Syntax – Ok

The end solution was in a FAQ section:

https://docs.gitlab.com/runner/faq/README.html#the-service-did-not-start-due-to-a-logon-failure-error-when-starting-service

The user is not allowed to run anything as a service, so the steps to fix are below:

This will only work in Windows that has group policy enabled (Windows 10 Pro). Windows Home does not have this feature.

After that, run again the start command again and probably you won’t have any errors:

.\gitlab-runner start

Now you may call the LabVIEWCLI again and it will work flawlessly (fingers crossed).

There is a down side, you are not able to see LabVIEW running anymore, in case you want to debug. But, there are other ways to get around it.

I hoped this will help anyone who is trying to run in your machine, or in a VM.

Until the next one…

2 thoughts on “Gitlab Runner and LabVIEW-CLI

  1. Great post again Felipe. This is also relevant to the services login settings when using Jenkins, and has the same tradeoff (no visible LabVIEW, slightly harder to debug…)
    On the other hand, I went with G-CLI, so I have a much easier time 😉

    For me, I used the Windows Services and Applications panel (under Computer Management) to set the Jenkins service login account, which was fairly straightforward. Not sure if the same would work for the gitlab-runner, so it’s good to read this article to see how to do it there.

    Like

    1. Thanks Christian.
      I never used the Jenkins, but I read it is a good alternative for a git agnostic CI.
      Good to know about the Windows Services, that there may be an alternative to what I did. I will keep that in mind, we never know what the next error/problem will be.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s