Automating the build process of your LabVIEW application on a dedicated server as part of a "continuous integration" process for your project is extremely helpful to your team for many reasons. One popular tool for LabVIEW build automation is Jenkins.
One challenge in doing so (even if you follow all the best practices for using Jenkins with LabVIEW) is that LabVIEW and other application error dialogs (and other windows waiting for user input) can pop up during the process and block the build.
When this happens, Jenkins shows a mysterious build timeout error in the build logs.
Examples of these types of dialog windows that will block a build are:
- LabVIEW Activation Dialog showing that LabVIEW activation has expired or will expire soon
- LabVIEW Automatic Recovery Error dialog stating that LabVIEW crashed the last time it was run and that there are auto-saved VIs that can be restored
- Various Other Dialogs related to build errors, required logins, and more
Unfortunately, since Jenkins is running as a Windows service, you won't see these application windows (they are running in Windows Session 0 and not the user session), and so it can be terribly difficult to figure out and resolve the root problem.
Side Note: One possibility for seeing these application windows and dialogs of services is to use Interactive Services Detection. However, this can be quite challenging to get working correctly.
However, there is hope...
Running Jenkins in the Current User Session
To work around this challenge, you can simply run Jenkins in the current user session (instead of as a Windows service).
To do this, create a batch file named
start_jenkins_in_user_session.bat with the following contents:
The, run the batch file by double-clicking it (or if you don't want to create a batch file, then you can run the commands from a cmd.exe command prompt).
These commands do the following (line-by-line):
- sets the JENKINS_HOME environment variable to the Jenkins installation directory, which can helpful for avoiding errors when Jenkins starts up.
- Sets the Jenkins installation folder as the current working directory.
- stops the Jenkins service (you can also do this from the services control panel, and you may wish to set it to start up manual startup instead of automatic startup)
- starts Jenkins in the current user session (the batch file's process), listening on port 8080 for web browser connections -- you can choose a different port number if you like
Success! Open Jenkins in your Browser
You can then open your web browser to
http://localhost:8080 to start a new build or configure Jenkins.
Now, when your build is running LabVIEW, VIPM, and other apps with user interface windows will open in your current user session and you'll be able to interact with them and see why your build might be stuck waiting on user input.
Bonus! Running Jenkins at Startup (in user session)
To make Jenkins run in a user session at startup (when the user logs in), you can create a batch file and put it in the startup folder of your user account. We've also added a bonus feature of running the batch file's console window minimized to the taskbar.
That's all! Good luck and let us know if you need help with need help with LabVIEW (or LabVIEW training), have any suggestions, or if there's anything else you'd like to share with us. Until then, wishing you Happy Automated LabVIEW Application Building from all of us at JKI!