Windows Subsystem for Linux (WSL) での Incredibuild の実行
WSL環境は、WindowsマシンにLinuxシェルをインストールしたものです。これらは、別のマシンを使用せずに行うLinux環境でのコードのテストに、非常に便利です。
Incredibuild Agents は WSL 環境にインストールできますが、Incredibuild Coordinators はスタンダードなLinux マシンにインストールする必要があります。WSL環境にインストールする場合、Incredibuildコンポーネント間の通信を確実にするために、いくつかの追加手順が必要です。
対応バージョン
-
WSL 2
WSLにIncredibuildをインストールする方法
-
WSL がサポートする Incredibuildによって認定されたディストリビューションを使用して、マシンに WSL をインストールします。
-
標準インストール手順 を使用して、WSL に Incredibuild Agent をインストールします。WSLではないスタンダードなLinuxマシン上の既存のIncredibuild Coordinatorに接続します。
-
インバウンドとアウトバウンドのファイアウォールルールを作成し、必要に応じてポート転送を設定します。これを管理するためのサンプルスクリプトを以下に提供しています。インストール時に、弊社のスクリプトを使用する場合は、インストールと再起動の両方のバッチファイルを実行してください。
-
ファイアウォールにアクセスし、作成したバッチファイルで指定された新しいインバウンドルール、および、アウトバウンドルールを確認します。
-
任意のビルドを実行し、ヘルパーエージェントがビルドに参加しているか確認します。バッチファイルが正しく設定されていない場合、ヘルパーエージェントはCoordinatorに表示されますが、ビルドを支援することはありません。
-
WSLインスタンスまたはホストマシンを再起動するたびに、Incredibuildサービスを再起動し、WSL内部IPを取得し、対応するポートのポート転送処理を開始する必要があります。以下の再起動用のサンプルバッチファイルを使って、この作業を行えます。
インストールバッチファイルの設定
このスクリプトは、インバウンドとアウトバウンドのファイアウォールルールを作成します。デフォルトのポートを使用しない場合は、バッチファイル内で変更してください。インストール作業中に一度だけ、このファイルを実行する必要があります。
:: 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
リブートバッチファイルの設定
このスクリプトは、IncredibuildサービスをオンにしてWSL内部IPを取得し、対応するポートのポート転送処理を開始します。インストール時に一度、そして、WSLインスタンスまたはホストマシンを再起動するたびにこの処理を実行する必要があります。
:: 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