Skip to content

Commit f6e600c

Browse files
authored
Provision WSL and the test containers after the build instead of alongside it (#5873)
Windows jobs have died with "The hosted runner lost communication with the server" while the build and the 8 GB WSL2 VM were competing for the runner's 16 GB. The WSL, SQL Server, PostgreSQL, RabbitMQ and IBM MQ setup steps now wait for the build like the Azure steps already did.
1 parent 5393eec commit f6e600c

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,6 @@ jobs:
9393
id: build
9494
background: true
9595
run: dotnet build tests.proj --configuration Release -graph
96-
# Provisions the WSL2 Docker host that the SQL Server, PostgreSQL, RabbitMQ and IBM MQ containers
97-
# run in on Windows. A no-op on Linux, but still run there so those actions see the same
98-
# environment variables on both runners.
99-
- name: Setup WSL
100-
if: contains(fromJSON('["RabbitMQ", "SqlServer", "PostgreSql", "IBMMQ"]'), matrix.test-category)
101-
uses: Particular/setup-wsl-action@v1.2.0
102-
with:
103-
# The action defaults to 4GB. The runner has 16GB and the build runs concurrently with the
104-
# container starting up, so give the VM real headroom.
105-
memory: 8GB
10696
# there is an issue with az cli and python 3.14, so for now we need to pin it
10797
# once the issue is resolved it should be able to be re-floated
10898
# https://github.com/Azure/azure-cli/issues/32980.
@@ -119,6 +109,30 @@ jobs:
119109
python -m pip install --upgrade pip
120110
python -m pip install --user "azure-cli==2.64.0"
121111
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
112+
- name: Setup SQS environment variables
113+
if: matrix.test-category == 'SQS'
114+
run: |
115+
echo "AWS_REGION=${{ secrets.AWS_REGION }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
116+
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
117+
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
118+
119+
# Cleanup of queues starting with `GHA-` handled by https://github.com/Particular/NServiceBus.AmazonSQS/blob/master/.github/workflows/tests-cleanup.yml
120+
$connectString = "AccessKeyId=${{ secrets.AWS_ACCESS_KEY_ID }};SecretAccessKey=${{ secrets.AWS_SECRET_ACCESS_KEY }};Region=${{ secrets.AWS_REGION }};QueueNamePrefix=GHA-${{ github.run_id }}"
121+
echo "ServiceControl_TransportTests_SQS_ConnectionString=$connectString" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
122+
# The Azure steps below create real cloud resources, so they sit behind the wait as well.
123+
- name: Wait for build
124+
wait: build
125+
# Provisions the WSL2 Docker host that the SQL Server, PostgreSQL, RabbitMQ and IBM MQ containers
126+
# run in on Windows. A no-op on Linux, but still run there so those actions see the same
127+
# environment variables on both runners. It and the container setups run after the build on
128+
# purpose: with the VM and the build competing for the runner's memory, jobs have died with "The
129+
# hosted runner lost communication with the server".
130+
- name: Setup WSL
131+
if: contains(fromJSON('["RabbitMQ", "SqlServer", "PostgreSql", "IBMMQ"]'), matrix.test-category)
132+
uses: Particular/setup-wsl-action@v1.2.0
133+
with:
134+
# The action defaults to 4GB. The runner has 16GB, so give the VM real headroom.
135+
memory: 8GB
122136
- name: Setup SQL Server
123137
uses: Particular/install-sql-server-action@v3.0.0
124138
if: matrix.test-category == 'SqlServer'
@@ -151,20 +165,6 @@ jobs:
151165
if: matrix.test-category == 'IBMMQ'
152166
with:
153167
connection-string-name: ServiceControl_TransportTests_IBMMQ_ConnectionString
154-
- name: Setup SQS environment variables
155-
if: matrix.test-category == 'SQS'
156-
run: |
157-
echo "AWS_REGION=${{ secrets.AWS_REGION }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
158-
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
159-
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
160-
161-
# Cleanup of queues starting with `GHA-` handled by https://github.com/Particular/NServiceBus.AmazonSQS/blob/master/.github/workflows/tests-cleanup.yml
162-
$connectString = "AccessKeyId=${{ secrets.AWS_ACCESS_KEY_ID }};SecretAccessKey=${{ secrets.AWS_SECRET_ACCESS_KEY }};Region=${{ secrets.AWS_REGION }};QueueNamePrefix=GHA-${{ github.run_id }}"
163-
echo "ServiceControl_TransportTests_SQS_ConnectionString=$connectString" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
164-
# Everything above provisions local containers, so it overlaps the build freely. The Azure steps
165-
# below create real cloud resources, so they sit behind the wait too.
166-
- name: Wait for build
167-
wait: build
168168
- name: Azure login
169169
uses: azure/login@v3.0.2
170170
if: matrix.test-category == 'AzureServiceBus' || matrix.test-category == 'AzureStorageQueues'

0 commit comments

Comments
 (0)