[devops] Always run the step to get the AzDo.BearerToken. (#21250)

We need the AzDo.BearerToken in later steps that have the 'always()'
condition, and unless we actually get the AzDo.BearerToken under the same
conditions, those later steps will fail.

One example is if the job was cancelled, or previous steps failed (which is
common when running tests).

Example failure for re-enabling macOS bots:

```
AzDO.BearerToken : The term 'AzDO.BearerToken' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\AzDO\_work\_temp\9b207e8a-c163-4c97-93d3-e7e3bb908583.ps1:6 char:23
+ $azdoBearerToken = "$(AzDO.BearerToken)"
+                       ~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (AzDO.BearerToken:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
```

This problem causes a lot of bots to end up disabled, because we fail to
re-enable them after using them.
This commit is contained in:
Rolf Bjarne Kvinge 2024-09-18 18:17:56 +02:00 коммит произвёл GitHub
Родитель 6fa626f3ac
Коммит 31efecac61
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -10,6 +10,7 @@ steps:
- task: AzureCLI@2
displayName: 'AzDO.BearerToken based on service connection'
enabled: true
condition: always()
inputs:
azureSubscription: 'DevDiv - SharedUntrustedAgentPool-Manage'
scriptType: 'pscore'