Skip to content

Commit 109dee3

Browse files
committed
self-hosted-runners: optionally skip deallocation
For now, we manually spin up the runners. It makes more sense to keep them running so that they can pick up the job immediately instead of deallocating them and then manually restart them. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 37df492 commit 109dee3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.github/workflows/create-azure-self-hosted-runners.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,18 @@ on:
2323
type: string
2424
required: false
2525
description: Repo to deploy the runner to. Only needed if runner_scope is set to "repo-level" (defaults to current repository)
26+
deallocate_immediately:
27+
type: boolean
28+
required: true
29+
description: Deallocate the runner immediately after creating it (useful for spinning up runners preemptively)
30+
default: true
2631

2732
env:
2833
AMOUNT_OF_RUNNERS: ${{ github.event.inputs.amount_of_runners }}
2934
ACTIONS_RUNNER_SCOPE: ${{ github.event.inputs.runner_scope }}
3035
ACTIONS_RUNNER_ORG: "${{ github.event.inputs.runner_org || github.repository_owner }}"
3136
ACTIONS_RUNNER_REPO: "${{ github.event.inputs.runner_repo || github.event.repository.name }}"
37+
DEALLOCATE_IMMEDIATELY: ${{ github.event.inputs.deallocate_immediately }}
3238
# This has to be a public URL that the VM can access after creation
3339
POST_DEPLOYMENT_SCRIPT_URL: https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/azure-self-hosted-runners/post-deployment-script.ps1
3440

@@ -138,6 +144,7 @@ jobs:
138144
parameters: ./azure-self-hosted-runners/azure-arm-template-example-parameters.json githubActionsRunnerRegistrationUrl="${{ env.ACTIONS_RUNNER_REGISTRATION_URL }}" githubActionsRunnerToken="${{ env.ACTIONS_RUNNER_TOKEN }}" postDeploymentPsScriptUrl="${{ env.POST_DEPLOYMENT_SCRIPT_URL }}" virtualMachineName=${{ steps.generate-vm-name.outputs.vm_name }} virtualMachineSize=Standard_D8pls_v5 publicIpAddressName1=${{ steps.generate-vm-name.outputs.vm_name }}-ip adminUsername=${{ secrets.AZURE_VM_USERNAME }} adminPassword=${{ secrets.AZURE_VM_PASSWORD }}
139145

140146
- name: Deallocate the VM for later use
147+
if: env.DEALLOCATE_IMMEDIATELY == 'true'
141148
uses: azure/CLI@v1
142149
with:
143150
azcliversion: 2.43.0

0 commit comments

Comments
 (0)