Skip to content

Commit 76b4653

Browse files
committed
Resort to secrets again for legacy MSI build
1 parent 543ff51 commit 76b4653

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

windows-release/msi-steps.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ steps:
6767
Include: ''
6868
ExportCommand: SignCommand
6969
SigningCertificate: ${{ parameters.SigningCertificate }}
70+
# WiX is struggling with WIF authentication and sign.exe right now,
71+
# so we still rely on the client secret for legacy builds.
72+
# We disable the service connection here to skip the login steps.
73+
AzureServiceConnectionName: ''
7074

7175
- powershell: |
7276
$cmd = $env:SignCommand -replace '"', '\"'
@@ -83,6 +87,10 @@ steps:
8387
Platform: x86
8488
# Only need the variable here for msi.props to detect
8589
SigningCertificate: ${{ parameters.SigningCertificate }}
90+
${{ if parameters.SigningCertificate }}:
91+
AZURE_TENANT_ID: $(TrustedSigningTenantId)
92+
AZURE_CLIENT_ID: $(TrustedSigningClientId)
93+
AZURE_CLIENT_SECRET: $(TrustedSigningClientSecret)
8694
8795
- ${{ each b in parameters.Bundles }}:
8896
- script: |
@@ -97,6 +105,10 @@ steps:
97105
TclTkLibraryDir: $(Pipeline.Workspace)\${{ b.TclTkArtifact }}
98106
# Only need the variable here for msi.props to detect
99107
SigningCertificate: ${{ parameters.SigningCertificate }}
108+
${{ if parameters.SigningCertificate }}:
109+
AZURE_TENANT_ID: $(TrustedSigningTenantId)
110+
AZURE_CLIENT_ID: $(TrustedSigningClientId)
111+
AZURE_CLIENT_SECRET: $(TrustedSigningClientSecret)
100112
101113
- powershell: |
102114
del $env:ResponseFile -ErrorAction Continue

windows-release/sign-files.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,30 @@ steps:
3434
env:
3535
EXPORT_COMMAND: ${{ parameters.ExportCommand }}
3636
37-
# We sign in once with the AzureCLI task, as it uses OIDC to obtain a
38-
# temporary token. But the task also logs out, and so we save the token and
39-
# use it to log in persistently (for the rest of the build).
40-
- task: AzureCLI@2
41-
displayName: 'Authenticate signing tools (1/2)'
42-
inputs:
43-
azureSubscription: ${{ parameters.AzureServiceConnectionName }}
44-
scriptType: 'ps'
45-
scriptLocation: 'inlineScript'
46-
inlineScript: |
47-
"##vso[task.setvariable variable=AZURE_CLIENT_ID;issecret=true]${env:servicePrincipalId}"
48-
"##vso[task.setvariable variable=AZURE_ID_TOKEN;issecret=true]${env:idToken}"
49-
"##vso[task.setvariable variable=AZURE_TENANT_ID;issecret=true]${env:tenantId}"
50-
"##vso[task.setvariable variable=AZURE_TOKEN_CREDENTIALS]AzureCliCredential"
51-
addSpnToEnvironment: true
37+
- ${{ if parameters.AzureServiceConnectionName }}:
38+
# We sign in once with the AzureCLI task, as it uses OIDC to obtain a
39+
# temporary token. But the task also logs out, and so we save the token and
40+
# use it to log in persistently (for the rest of the build).
41+
- task: AzureCLI@2
42+
displayName: 'Authenticate signing tools (1/2)'
43+
inputs:
44+
azureSubscription: ${{ parameters.AzureServiceConnectionName }}
45+
scriptType: 'ps'
46+
scriptLocation: 'inlineScript'
47+
inlineScript: |
48+
"##vso[task.setvariable variable=AZURE_CLIENT_ID;issecret=true]${env:servicePrincipalId}"
49+
"##vso[task.setvariable variable=AZURE_ID_TOKEN;issecret=true]${env:idToken}"
50+
"##vso[task.setvariable variable=AZURE_TENANT_ID;issecret=true]${env:tenantId}"
51+
"##vso[task.setvariable variable=AZURE_TOKEN_CREDENTIALS]AzureCliCredential"
52+
addSpnToEnvironment: true
5253

53-
- powershell: >
54-
az login --service-principal
55-
-u $(AZURE_CLIENT_ID)
56-
--tenant $(AZURE_TENANT_ID)
57-
--allow-no-subscriptions
58-
--federated-token $(AZURE_ID_TOKEN)
59-
displayName: 'Authenticate signing tools (2/2)'
54+
- powershell: >
55+
az login --service-principal
56+
-u $(AZURE_CLIENT_ID)
57+
--tenant $(AZURE_TENANT_ID)
58+
--allow-no-subscriptions
59+
--federated-token $(AZURE_ID_TOKEN)
60+
displayName: 'Authenticate signing tools (2/2)'
6061
6162
- ${{ if parameters.Include }}:
6263
- powershell: |

0 commit comments

Comments
 (0)