Skip to content

Commit f5d2a17

Browse files
Increase VMSS scaling and parallelism in CI workflows
Updated autoscaler and CI workflows to scale Azure VMSS to 6 instances for improved parallel job execution. Added explicit scale-up and scale-down jobs in ci.yml to manage runner capacity before and after tests, and increased max-parallel jobs from 3 to 6.
1 parent 15a1fc4 commit f5d2a17

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

.github/workflows/autoscaler.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ jobs:
4040
run: |
4141
QUEUED=${{ steps.queue.outputs.queued_jobs }}
4242
43-
# Each workflow has 10 jobs, max 3 concurrent per workflow
44-
# If 1 workflow: need 3 runners
45-
# If 2+ workflows: still max 3 runners (they'll share)
43+
# Each workflow has 10 jobs, scale to 6 runners for parallel execution
44+
# If 1+ workflows: scale to 6 runners
45+
# If 0 workflows: scale to 0
4646
4747
if [ $QUEUED -eq 0 ]; then
4848
TARGET=0
4949
echo "No active workflows - scaling to 0"
5050
elif [ $QUEUED -ge 1 ]; then
51-
TARGET=3
52-
echo "Active workflows detected - scaling to 3"
51+
TARGET=6
52+
echo "Active workflows detected - scaling to 6"
5353
fi
5454
5555
echo "target_capacity=$TARGET" >> $GITHUB_OUTPUT

.github/workflows/ci.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,31 @@ concurrency:
3535
cancel-in-progress: true
3636

3737
jobs:
38+
scale-up:
39+
name: Scale VMSS to 6 instances
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Azure Login
43+
uses: azure/login@v1
44+
with:
45+
creds: ${{ secrets.AZURE_CREDENTIALS }}
46+
47+
- name: Scale VMSS to 6 instances
48+
run: |
49+
echo "Scaling VMSS to 6 instances..."
50+
az vmss scale \
51+
--name dbatools-runner-vmss \
52+
--resource-group dbatools-ci-runners \
53+
--new-capacity 6
54+
55+
- name: Wait for instances to provision
56+
run: |
57+
echo "Waiting for instances to provision and runners to register..."
58+
sleep 120
59+
3860
test:
3961
name: Test ${{ matrix.scenario }} (${{ matrix.part }})
62+
needs: scale-up
4063
runs-on: [self-hosted, azure-vmss, windows, sqlserver]
4164
timeout-minutes: 60
4265

@@ -47,7 +70,7 @@ jobs:
4770
4871
strategy:
4972
fail-fast: false
50-
max-parallel: 3 # Maximum 3 concurrent runners
73+
max-parallel: 6 # Maximum 6 concurrent runners
5174

5275
matrix:
5376
include:
@@ -180,3 +203,22 @@ jobs:
180203
path: Pester5Coverage*.xml
181204
if-no-files-found: ignore
182205
retention-days: 30
206+
207+
scale-down:
208+
name: Scale VMSS to 0 instances
209+
needs: test
210+
if: always()
211+
runs-on: ubuntu-latest
212+
steps:
213+
- name: Azure Login
214+
uses: azure/login@v1
215+
with:
216+
creds: ${{ secrets.AZURE_CREDENTIALS }}
217+
218+
- name: Scale VMSS back to 0
219+
run: |
220+
echo "Scaling VMSS back to 0 instances..."
221+
az vmss scale \
222+
--name dbatools-runner-vmss \
223+
--resource-group dbatools-ci-runners \
224+
--new-capacity 0

0 commit comments

Comments
 (0)