Running Incredibuild in Windows Subsystem for Linux (WSL)
WSL environments are Linux shells installed on Windows machines. These can be very useful for testing your code on Linux environments, without having to use a separate machine.
You can install Incredibuild Agents on WSL environments, however, Incredibuild Coordinators must be install on standard Linux machines. When installing in a WSL environment, some extra steps are required to ensure that communication between Incredibuild components is possible.
Supported Versions
-
WSL 2
How to Install Incredibuild on WSL
-
Install WSL on your machine using a distribution certified by Incredibuild that is also supported by WSL.
-
Install your Incredibuild Agent on the WSL using the standard installation procedure. Connect to an existing Incredibuild Coordinator on an standard Linux machine (not WSL).
-
Create inbound and outbound firewall rules, and configure port forwarding as required. We have provided sample scripts to manage this below. When installing, if you are using our scripts run both the installation and the reboot batch files.
-
Go to your firewall and verify that the new inbound and outbound rules specified in the batch file have been created.
-
Run any build and verify that your helper agents are participating in the build. If the batch file was not configured correctly, the helper agents will be visible in your Coordinator, but they will not assist in builds.
-
Whenever you reboot your WSL instance or host machine, you will need to restart the Incredibuild service, fetch the WSL internal IP, and initiate the port forwarding process for the corresponding ports. You can use our sample reboot batch file below to do this.
Configuring the Installation Batch File
This script will creates the inbound and outbound firewall rules. If you are not using the default ports, modify them in your batch file. You will only need to run this file once, during the installation process.
:: ADD INBOUND RULES FOR THE CORRESPONDING PORTS
netsh advfirewall firewall add rule name="8080" dir=in action=allow protocol=TCP localport=8080
netsh advfirewall firewall add rule name="IB 2088" dir=in action=allow protocol=TCP localport=2088
netsh advfirewall firewall add rule name="IB 2089" dir=in action=allow protocol=TCP localport=2089
netsh advfirewall firewall add rule name="IB 9952" dir=in action=allow protocol=TCP localport=9952
netsh advfirewall firewall add rule name="IB 9953" dir=in action=allow protocol=TCP localport=9953
:: ADD OUTBOUND RULES FOR THE CORRESPONDING PORTS
netsh advfirewall firewall add rule name="8080" dir=in action=allow protocol=TCP localport=8080
netsh advfirewall firewall add rule name="IB 2088" dir=out action=allow protocol=TCP localport=2088
netsh advfirewall firewall add rule name="IB 2089" dir=out action=allow protocol=TCP localport=2089
netsh advfirewall firewall add rule name="IB 9952" dir=out action=allow protocol=TCP localport=9952
netsh advfirewall firewall add rule name="IB 9953" dir=out action=allow protocol=TCP localport=9953
Configuring the Reboot Batch File
This script turns on the Incredibuild service, fetches the WSL internal IP, and initiates the port forwarding process for the corresponding ports. It should be run once during installation, and every time you reboot your WSL instance or the host machine.
:: The following script turns on the Incredibuild service, fetches the WSL internal IP, and initiates the port forwarding process for the corresponding ports.
:: It should be run once during installation, and every time you reboot your WSL instance or the host machine.
:: Turn on IncrediBuild service
wsl sudo /opt/incredibuild/etc/init.d/incredibuild start
:: Fetch internal IP address for WSL2
@echo off
wsl ip addr | wsl grep eth0 | wsl grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | wsl sed "s/ /\n/g" | wsl grep / | wsl sed "s/\//\n/g" | wsl grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" > tmp1.txt
set /p "ipaddr="<tmp1.txt
del tmp1.txt
echo IPADDR: %ipaddr%
@echo on
:: Port forwarding for the corresponding ports
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=8080 connectaddress=%ipaddr%
netsh interface portproxy add v4tov4 listenport=2088 listenaddress=0.0.0.0 connectport=2088 connectaddress=%ipaddr%
netsh interface portproxy add v4tov4 listenport=2089 listenaddress=0.0.0.0 connectport=2089 connectaddress=%ipaddr%
netsh interface portproxy add v4tov4 listenport=9952 listenaddress=0.0.0.0 connectport=9952 connectaddress=%ipaddr%
netsh interface portproxy add v4tov4 listenport=9953 listenaddress=0.0.0.0 connectport=9953 connectaddress=%ipaddr%
pause