Best Practices on How to Use LabVIEW with Jenkins Continuous Integration

Updated Sep 10, 2019

Reported In

Software

  • LabVIEW

Issue Details


What are some tips and best practices for using LabVIEW with Jenkins Continuous Integration?

Solution

There is great value in using Continuous Integration with LabVIEW software development because of how difficult it is to merge/integrate large LabVIEW projects and how long it takes to compile things in LabVIEW's Application Builder and LabVIEW FPGA.

Fundamentally, Jenkins can call anything, but the following tips can help when calling LabVIEW:
  • LabVIEW should be packaged somehow so that it can quickly be re-deployed. For instance, you could use exports of LabVIEW and if something goes wrong, you could simply resync the export and try again.
  • Use the following INI tokens (LabVIEW.ini) to suppress popups and auto-reporting errors:
    NIERShowFatalDialog = 0 
    NIERFatalAutoSend = true 
    NIERNonFatalAutoSend = true 
    NIERShowNonFatalDialogOnExit = false 
    NIERSendDialogClose = true autoerr = 3 
    DWarnDialog = false 
    AutoSaveEnabled = false 
    AllowMultipleInstances = true 
    promoteDWarnInternals = false 
    ShowAIVIsInErrorWindow = true 
 
  • It is helpful to have a very robust system setup. One way to do this is to have scripts that deploy a routinely maintained image of Windows, install all NI and third-party software, and reconnect to a Jenkins master without any user input. The alternative of installing software stacks takes hours manually per PC.
  • Remember that any internal build tool that deals with LabVIEW, whether or not invoked by Jenkins, has been engineered to use LabVIEW as an automated compiler.  
  • Jenkins by default runs in a SYSTEM user account, so you'll want to use PsExec to explicitly run LabVIEW in the desired user account with the following batch file.

    - - - -- -- exec.bat- - - - - -- - - - -
    @ECHO OFF
    rem ...\exec.bat [username] [password] App AppArguments
    set LOCAL_DIR=%~dp0 

    set username=%1 
    set password=%2 
    for /f "tokens=3" %%I in ('%LOCAL_DIR%qwinsta.exe ^| find /i " %1 "') do (set _ID=%%I)

    rem Group all remaining arguments after username and password 
    shift 
    shift 
    set appParameters=%1 
    :loop 
    shift 
    if [%1]==[] goto afterloop 
    set appParameters=%appParameters% %1 
    goto loop 
    :afterloop 

    %LOCAL_DIR%PsExec.exe -i %_ID% -u %username% -p %password% %appParameters% 
    - - - - - -- -- - - - -- - --
  • There is an internal property node for LabVIEW called Unattended Mode. It can only be copied and not selected. This is critical for LabVIEW automation because it tells LabVIEW not to block the close of LabVIEW with prompts to save VIs. Snippet is below:
  • Keep the build fast. Get the latest Intel core at the highest clock frequency with fast SSDs.
Note: To add this snippet to your block diagram first save the image to your computer and then drag the downloaded image to the block diagram.