Skip to content

Commit 7a87c8f

Browse files
committed
self-hosted-runner: switch back to using Azure/login
We do not need the custom Action: `Azure/login` logs in using the Azure CLI, and subsequent `az` calls work just fine. So let's drop the complexity of the custom Action and go back to using `Azure/login` instead. The only downside is that we now need to specify the subscription ID even though `az login` would work without it. But that's a small price to pay, as the `delete-self-hosted-runner` workflow _still_ uses the `Azure/login` Action and has to have that information as a repository secret anyway. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent d6c5749 commit 7a87c8f

File tree

3 files changed

+10
-33
lines changed

3 files changed

+10
-33
lines changed

.github/workflows/azure-login/action.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/cleanup-self-hosted-runners.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ permissions:
2929
# --role 'Contributor'
3030
# AZURE_TENANT_ID - The Tenant ID of the Azure Managed Identity (i.e. the Azure Active Directory in which
3131
# the Identity lives)
32+
# AZURE_SUBSCRIPTION_ID - The Subscription ID with which the Azure Managed Identity is associated
33+
# (technically, this is not necessary for `az login --service-principal` with a
34+
# managed identity, but `Azure/login` requires it anyway)
3235
# AZURE_RESOURCE_GROUP - Resource group to find the runner(s) in. It's recommended to set up a resource
3336
# group specifically for self-hosted Actions Runners.
3437
jobs:
@@ -38,10 +41,11 @@ jobs:
3841
steps:
3942
- uses: actions/checkout@v4
4043
- name: Azure Login
41-
uses: ./.github/workflows/azure-login
44+
uses: azure/login@v2
4245
with:
4346
client-id: ${{ secrets.AZURE_CLIENT_ID }}
4447
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
48+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
4549
- name: Discover VMs to delete
4650
env:
4751
GH_APP_ID: ${{ secrets.GH_APP_ID }}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ permissions:
7676
# --role 'Contributor'
7777
# AZURE_TENANT_ID - The Tenant ID of the Azure Managed Identity (i.e. the Azure Active Directory in which
7878
# the Identity lives)
79+
# AZURE_SUBSCRIPTION_ID - The Subscription ID with which the Azure Managed Identity is associated
80+
# (technically, this is not necessary for `az login --service-principal` with a
81+
# managed identity, but `Azure/login` requires it anyway)
7982
# AZURE_RESOURCE_GROUP - Resource group to create the runner(s) in
8083
# AZURE_VM_USERNAME - Username of the VM so you can RDP into it
8184
# AZURE_VM_PASSWORD - Password of the VM so you can RDP into it
@@ -178,10 +181,11 @@ jobs:
178181
echo "AZURE_ARM_PARAMETERS=$AZURE_ARM_PARAMETERS" >> $GITHUB_ENV
179182
180183
- name: Azure Login
181-
uses: ./.github/workflows/azure-login
184+
uses: azure/login@v2
182185
with:
183186
client-id: ${{ secrets.AZURE_CLIENT_ID }}
184187
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
188+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
185189

186190
- uses: azure/arm-deploy@v2
187191
id: deploy-arm-template

0 commit comments

Comments
 (0)