Skip to content

Commit 7e8ee82

Browse files
shivaCode-2Shivang Sharma
andauthored
Add Examples (#30)
* Add basic Examples * fin --------- Co-authored-by: Shivang Sharma <shivang.sharma@emerson.com>
1 parent 46b72d5 commit 7e8ee82

File tree

9 files changed

+206
-115
lines changed

9 files changed

+206
-115
lines changed

docs/examples.md

Lines changed: 72 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,93 @@
11
# Example Usages of LabVIEW Container
2-
## Example Usage: LabVIEWCLI
3-
### LabVIEWCLI: Run VI Analyzer Tests on VIs
4-
Run Static code analysis on VIs using VI Analyzer Toolkit
2+
Please find the old examples for Linux Containers with LabVIEW 2025 Q3 [here](./examples2025q3.md)
53

6-
**Use Command:**
7-
```
8-
LabVIEWCLI
9-
-OperationName RunVIAnalyzer \
10-
-ConfigPath <Path to VI Analyzer config file> \
11-
-ReportPath <Location for saving the report> \
12-
-LabVIEWPath <Path to LabVIEW Executable>
13-
```
14-
![Run VI Analyzer](../examples/VIA.PNG)
15-
16-
### LabVIEWCLI: CreateComparisonReport
17-
Create a diff report between two VIs
4+
The following examples are for **LabVIEW 2026 Q1** supporting **both Linux and Windows containers** along with the introduction of **Headless Run Mode**
185

19-
**Use Command:**
6+
## General Examples
7+
### 1. Pulling the image from DockerHub
208
```bash
21-
LabVIEWCLI -OperationName CreateComparisonReport \
22-
-VI1 VINameOrPath1.vi \
23-
-VI2 VINameOrPath2.vi \
24-
-ReportType html \
25-
-ReportPath ReportPath.html
9+
docker pull nationalinstruments/labview:<version>-<os>
2610
```
27-
28-
![VIDiff](../examples/CompareReport.PNG)
29-
30-
**Generated Report:**
31-
![GeneratedReport](../examples/DiffReport.PNG)
32-
33-
### LabVIEWCLI: MassCompile VIs
34-
MassCompile a Directory
35-
36-
**Use Command:**
11+
**Example**
3712
```bash
38-
LabVIEWCLI -OperationName MassCompile -DirectoryToCompile <Directory to Compile> -LabVIEWPath <Path to LabVIEW Executable>
13+
docker pull nationalinstruments/labview:2026q1-windows
3914
```
4015

41-
![MassCompile](../examples/MassCompile.PNG)
42-
43-
### LabVIEWCLI: RunVI
44-
Run a specific VI on the system.
45-
46-
**Use Command:**
16+
### 2. Listing all available images
17+
After pulling, enter:
4718
```bash
48-
LabVIEWCLI -OperationName RunVI -VIPath <Path to VI> -LabVIEWPath <Path to LabVIEW Executable>
19+
docker images
4920
```
21+
![Docker Images](../examples/Images.png)
5022

51-
For full details on all available LabVIEWCLI Commands, please find the official NI's LabVIEWCLI Documentation [here.](https://www.ni.com/docs/en-US/bundle/labview/page/predefined-command-line-operations.html?srsltid=AfmBOorqX__K-Rfh8JZCEho3PyoM75cXxBwij71DN5g89FPu6YoTZ7VQ)
52-
53-
## Example Usage: Change entrypoint of the container
54-
By default, the LabVIEW container image does not define a default **CMD** or **ENTRYPOINT.**
55-
56-
The entrypoint of a container is the primary process that runs when the container starts — often referred to as PID 1.
57-
58-
Fortunately, Docker allows you to override the entrypoint at runtime using the `--entrypoint` flag.
59-
60-
You can launch the container with LabVIEWCLI as the main process like this:
61-
62-
```shell
63-
docker run --rm --entrypoint LabVIEWCLI labview:2025q3-linux
23+
### 3. Running a container
24+
After pulling, enter:
25+
```bash
26+
docker run -it nationalinstruments/labview:2026q1-windows
6427
```
28+
The above command will initialize a container for the LabVIEW image and drops the user into the interactive shell of container.
6529

66-
![Entrypoiny](../examples/Entrypoint.PNG)
67-
68-
This will start the container, run LabVIEWCLI, and then terminate the container once the CLI process exits.
69-
70-
### Why Use This?
71-
- Perform a single CLI-driven task (e.g., mass compile, run a VI)
72-
- Exit cleanly after completing that task
73-
- Be used in CI/CD pipelines or automation scripts
74-
75-
## Example Usage: Mount Local Volumes
76-
You can mount a local directory into the container using the `-v` (volume) flag.
77-
78-
Let's mount a local directory into the container and see the contents of a text file.
79-
80-
**Use Command:**
81-
```shell
82-
docker run -it -v C:\ni:/mounted_directory labview:2025q3-linux
30+
### 4. Accessing LabVIEWCLI General help
31+
```powershell
32+
LabVIEWCLI -Help -Headless
8333
```
34+
![LabVIEWCLI Help](../examples/LabVIEWCLI%20help.png)
8435

85-
![Mount](../examples/MountLocalDir.PNG)
86-
87-
- `-v C:\ni:/mounted_directory` tells Docker to mount your local folder into `/mounted_directory `inside the container.
88-
- The container will have read/write access to the mounted folder.
89-
90-
## Example Usage: Integration with CI/CD
91-
The combination of the above usages along with automation tools like GitHub actions, Jenkins etc can unlock the true potential of LabVIEW in CI/CD Environments.
92-
93-
Let's look at an example of integrating LabVIEW Container into a GitHub action. All the neccessary files are present at **{repo-root}/examples/integration-into-cicd**
94-
95-
### Testing Script
96-
A script designed to run LabVIEWCLI to perform `MassCompile` and `RunVIAnalyzer` operations on a set of Test-VIs.
97-
98-
The script is located here: [runlabview.sh](../examples/integration-into-cicd/runlabview.sh)
99-
100-
The job of the script is to:
101-
1. Run LabVIEWCLI MassCompile Operation
102-
2. Run LabVIEWCLI VI Analyzer Operation
103-
3. Exit with error is any of the above operation fail.
104-
105-
### GitHub Action
106-
The configuration file for example GitHub Action is located here at: [labview-container-check.yml](../.github/workflows/labview-container-check.yml)
107-
108-
The action does the following:
109-
1. Login into GitHub Container Registry
110-
2. Pull in the image `labview:2025q3-linux`
111-
3. Mount the repository into the container
112-
4. Run the script `runlabview.sh` as container's entrypoint.
113-
114-
The action is set to be triggered when any pull request is created, updated or reopened.
115-
116-
### Running the GitHub Action
117-
A testing Pull Request has been created that demonstrates the use of the script `runlabview.sh` and the GitHub Action to run LabVIEWCLI inside a container.
118-
119-
Link to the Pull Request: [Integration into CI/CD](https://github.com/ni/labview-for-containers/pull/8)
120-
121-
- When a Pull Request is opened, a status check running the GitHub Action can be seen.
122-
![CICD-PullRequest](../examples/int-cicd.PNG)
123-
124-
- If we navigate to the run logs by clicking on the Action, we can see what all jobs were executed as part of this pipeline.
125-
![Log](../examples/TopLevelLog.PNG)
36+
### 5. Accessing LabVIEWCLI's Operation specific help
37+
```powershell
38+
LabVIEWCLI -OperationName ExecuteBuildSpec -Help -Headless
39+
```
40+
![Operation Help](../examples/Ophelp.png)
12641

127-
- Expanding the job shows the full log of that particular step.
128-
![CompLog](../examples/CompleteLog.PNG)
42+
### 6. Running MassCompile operation on a Directory
43+
```powershell
44+
LabVIEWCLI -OperationName MassCompile -DirectoryToCompile "C:\Program Files\National Instruments\LabVIEW 2026\examples\Arrays" -Headless
45+
```
46+
![MassCompile](../examples/MassCompileHeadless.png)
12947

130-
The Complete run can be found [here.](https://github.com/ni/labview-for-containers/actions/runs/16333422879/job/46140796978?pr=5)
48+
For other supported operations, see example scripts here:
49+
1. [Example Script for Windows](../examples/integration-into-cicd/runlabview.ps1)
50+
2. [Example Script for Linux](../examples/integration-into-cicd/runlabview.sh)
13151

132-
___
52+
### 7. Closing LabVIEW Gracefully
53+
The recommended way to close a Headless LabVIEW instance is through LabVIEWCLI `CloseLabVIEW` operation.
54+
```powershell
55+
LabVIEWCLI -OperationName CloseLabVIEW -Headless
56+
```
57+
![CloseLabVIEW](../examples/CloseLV.png)
58+
59+
### 8. Debugging LabVIEW Issues
60+
There is no UI when LabVIEW in running in Headless mode. To debug a issue in LabVIEW, use the following techniques:
61+
1. **Inspect LabVIEWCLI Log**
62+
- Whenever a LabVIEWCLI Operation is ran, LabVIEW logs the operation output into a log file.
63+
- The path to the logfile is displayed on the STDOUT.
64+
- ![LogFile Path](../examples/CloseLV.png)
65+
- In the above example, the log file is generated at: `%temp%\lvtemporary_321777.log`
66+
- Inspect the log file to understand the issue.
67+
2. **Inspect LabVIEW's own log file**
68+
- LabVIEW logs important details in a separate log file located at: `%temp%\<AppName>_<Bitness>_<version>_<headless/interactive>_<user>_<log/cur>.txt`
69+
- Depending on the current running application, `<AppName>` could be LabVIEWCLI, LabVIEW or other LabVIEW Build Applications
70+
- Depending on the run mode of the application, the information would be logged into either a `headless` or `interactive` logfile.
71+
- The current instance always logs in a log file containing the string `cur` whereas the older logfile (if any present) is renamed from `cur` to `log`
72+
- Inspect the application specific logfile to get information on what went wrong.
73+
- ![LogFile](../examples/LV_Log.png)
74+
3. **Inspect Unwired Errors**
75+
- If your VIs contain unwired errors, they are automatically logged into a log file when running in Headless Mode.
76+
- The path to the log file generally is: `%Documents%\LabVIEW Data\UnwiredErrors\LabVIEW*.UnwiredErrors.log`
77+
4. **DWarns are automatically logged when running in Headless Mode**
78+
79+
### 9. Integration into GitHub Actions
80+
A example GitHub action is configured to run LabVIEWCLI on LabVIEW Containers.
81+
The YAML Configurations are located here: [GitHub Actions for LabVIEW Containers](https://github.com/ni/labview-for-containers/tree/main/.github/workflows)
82+
83+
To see all of this in action, do the following:
84+
1. Fork this repository: [labview-for-containers](https://github.com/ni/labview-for-containers/tree/main)
85+
2. Raise a Pull request with a small change to any of the repo files.
86+
3. See the action running on LabVIEW Containers.
87+
88+
Example runs:
89+
1. [Windows](https://github.com/ni/labview-for-containers/actions/runs/20814010697/job/59784984845)
90+
2. [Linux](https://github.com/ni/labview-for-containers/actions/runs/20429840332/job/58697931582)
13391

13492
Feel free to tailor the workflow to your needs—add or remove jobs, adjust environment variables, or modify volume mounts. You can also use the provided YAML definitions as a springboard for your own CI/CD pipelines. This example is meant as a reference implementation to help you quickly integrate LabVIEWCLI commands into your automated workflows.
13593

@@ -138,4 +96,3 @@ Feel free to tailor the workflow to your needs—add or remove jobs, adjust envi
13896

13997

14098

141-

docs/examples2025q3.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Example Usages of LabVIEW Container (2025 Q3)
2+
## Example Usage: LabVIEWCLI
3+
### LabVIEWCLI: Run VI Analyzer Tests on VIs
4+
Run Static code analysis on VIs using VI Analyzer Toolkit
5+
6+
**Use Command:**
7+
```
8+
LabVIEWCLI
9+
-OperationName RunVIAnalyzer \
10+
-ConfigPath <Path to VI Analyzer config file> \
11+
-ReportPath <Location for saving the report> \
12+
-LabVIEWPath <Path to LabVIEW Executable>
13+
```
14+
![Run VI Analyzer](../examples/VIA.PNG)
15+
16+
### LabVIEWCLI: CreateComparisonReport
17+
Create a diff report between two VIs
18+
19+
**Use Command:**
20+
```bash
21+
LabVIEWCLI -OperationName CreateComparisonReport \
22+
-VI1 VINameOrPath1.vi \
23+
-VI2 VINameOrPath2.vi \
24+
-ReportType html \
25+
-ReportPath ReportPath.html
26+
```
27+
28+
![VIDiff](../examples/CompareReport.PNG)
29+
30+
**Generated Report:**
31+
![GeneratedReport](../examples/DiffReport.PNG)
32+
33+
### LabVIEWCLI: MassCompile VIs
34+
MassCompile a Directory
35+
36+
**Use Command:**
37+
```bash
38+
LabVIEWCLI -OperationName MassCompile -DirectoryToCompile <Directory to Compile> -LabVIEWPath <Path to LabVIEW Executable>
39+
```
40+
41+
![MassCompile](../examples/MassCompile.PNG)
42+
43+
### LabVIEWCLI: RunVI
44+
Run a specific VI on the system.
45+
46+
**Use Command:**
47+
```bash
48+
LabVIEWCLI -OperationName RunVI -VIPath <Path to VI> -LabVIEWPath <Path to LabVIEW Executable>
49+
```
50+
51+
For full details on all available LabVIEWCLI Commands, please find the official NI's LabVIEWCLI Documentation [here.](https://www.ni.com/docs/en-US/bundle/labview/page/predefined-command-line-operations.html?srsltid=AfmBOorqX__K-Rfh8JZCEho3PyoM75cXxBwij71DN5g89FPu6YoTZ7VQ)
52+
53+
## Example Usage: Change entrypoint of the container
54+
By default, the LabVIEW container image does not define a default **CMD** or **ENTRYPOINT.**
55+
56+
The entrypoint of a container is the primary process that runs when the container starts — often referred to as PID 1.
57+
58+
Fortunately, Docker allows you to override the entrypoint at runtime using the `--entrypoint` flag.
59+
60+
You can launch the container with LabVIEWCLI as the main process like this:
61+
62+
```shell
63+
docker run --rm --entrypoint LabVIEWCLI labview:2025q3-linux
64+
```
65+
66+
![Entrypoiny](../examples/Entrypoint.PNG)
67+
68+
This will start the container, run LabVIEWCLI, and then terminate the container once the CLI process exits.
69+
70+
### Why Use This?
71+
- Perform a single CLI-driven task (e.g., mass compile, run a VI)
72+
- Exit cleanly after completing that task
73+
- Be used in CI/CD pipelines or automation scripts
74+
75+
## Example Usage: Mount Local Volumes
76+
You can mount a local directory into the container using the `-v` (volume) flag.
77+
78+
Let's mount a local directory into the container and see the contents of a text file.
79+
80+
**Use Command:**
81+
```shell
82+
docker run -it -v C:\ni:/mounted_directory labview:2025q3-linux
83+
```
84+
85+
![Mount](../examples/MountLocalDir.PNG)
86+
87+
- `-v C:\ni:/mounted_directory` tells Docker to mount your local folder into `/mounted_directory `inside the container.
88+
- The container will have read/write access to the mounted folder.
89+
90+
## Example Usage: Integration with CI/CD
91+
The combination of the above usages along with automation tools like GitHub actions, Jenkins etc can unlock the true potential of LabVIEW in CI/CD Environments.
92+
93+
Let's look at an example of integrating LabVIEW Container into a GitHub action. All the neccessary files are present at **{repo-root}/examples/integration-into-cicd**
94+
95+
### Testing Script
96+
A script designed to run LabVIEWCLI to perform `MassCompile` and `RunVIAnalyzer` operations on a set of Test-VIs.
97+
98+
The script is located here: [runlabview.sh](../examples/integration-into-cicd/runlabview.sh)
99+
100+
The job of the script is to:
101+
1. Run LabVIEWCLI MassCompile Operation
102+
2. Run LabVIEWCLI VI Analyzer Operation
103+
3. Exit with error is any of the above operation fail.
104+
105+
### GitHub Action
106+
The configuration file for example GitHub Action is located here at: [labview-container-check.yml](../.github/workflows/labview-container-check.yml)
107+
108+
The action does the following:
109+
1. Login into GitHub Container Registry
110+
2. Pull in the image `labview:2025q3-linux`
111+
3. Mount the repository into the container
112+
4. Run the script `runlabview.sh` as container's entrypoint.
113+
114+
The action is set to be triggered when any pull request is created, updated or reopened.
115+
116+
### Running the GitHub Action
117+
A testing Pull Request has been created that demonstrates the use of the script `runlabview.sh` and the GitHub Action to run LabVIEWCLI inside a container.
118+
119+
Link to the Pull Request: [Integration into CI/CD](https://github.com/ni/labview-for-containers/pull/8)
120+
121+
- When a Pull Request is opened, a status check running the GitHub Action can be seen.
122+
![CICD-PullRequest](../examples/int-cicd.PNG)
123+
124+
- If we navigate to the run logs by clicking on the Action, we can see what all jobs were executed as part of this pipeline.
125+
![Log](../examples/TopLevelLog.PNG)
126+
127+
- Expanding the job shows the full log of that particular step.
128+
![CompLog](../examples/CompleteLog.PNG)
129+
130+
The Complete run can be found [here.](https://github.com/ni/labview-for-containers/actions/runs/16333422879/job/46140796978?pr=5)
131+
132+
___
133+
134+
Feel free to tailor the workflow to your needs—add or remove jobs, adjust environment variables, or modify volume mounts. You can also use the provided YAML definitions as a springboard for your own CI/CD pipelines. This example is meant as a reference implementation to help you quickly integrate LabVIEWCLI commands into your automated workflows.

examples/CloseLV.png

25.8 KB
Loading

examples/Images.png

38.6 KB
Loading

examples/LV_Log.png

142 KB
Loading

examples/LabVIEWCLI help.png

70.8 KB
Loading

examples/Log.png

26.9 KB
Loading

examples/MassCompileHeadless.png

37.5 KB
Loading

examples/Ophelp.png

55 KB
Loading

0 commit comments

Comments
 (0)