forked from Azure/azure-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Use TME via OIDC in build-cli (Azure#4519)
Now that `azd` supports OIDC in Azure Pipelines via Azure#4343, let's use it in the `build-cli` leg of CI. Since we now use OIDC, we can also migrate to the TME environment for the resources created during our tests, by using the new `azd-service-connection` service connection. In addition to the build authoring updates, I needed to make some small changes to the integration testing framework and recording framework to get these changes to work when running in playback mode. I added `AZD_DEBUG_LOGIN_FORCE_SUBSCRIPTION_REFRESH` which can be used to force `azd login` to load (and cache) subscriptions when you log in. This refresh does not usually happen for service principal based logins, but we want it to happen here so that the subscription list can be served from cache instead of hitting the `/subscriptions` endpoint of ARM to list subscriptions in each test (and record the result). This also ensures the environment during playback is a bit closer to the one like a developer will have when hacking on `azd` (since they too will have run `azd login` locally thus primed their subscription cache). Moving to the TME user also exposed an issue with `azd` during playback if the list of subscriptions the user has does not include the subscription that was used for a recorded test. In this case, `azd` could end up trying to fetch information about this subscription, leading to test failures because this generates requests that don't have recorded interactions. To work around this issue, I've added a new `AZD_DEBUG_SYNTHETIC_SUBSCRIPTION` environment variable that can be set to a subscription ID. When set, the `SubscriptionManager` ensures the list of subscriptions returned by `GetSubscriptions` includes an entry for this subscription. The integration test framework arranges for this value to be set during playback. This allows the rest of the test to work (the fact that the principal running the test doesn't have access to the subscription used for the recording ends up not mattering, since we serve all requests from the recordings instead of against live Azure). Finally, we needed to add the endpoint that is used inside Azure DevOps to fetch the ID token during the OIDC flow to the list of URLs that the recording infrastructure that should not be recorded. With this change, the `azd-login` step is no longer used across any pipelines, so we can remove it. Fixes Azure#4341 Fixes Azure#4501
- Loading branch information
Showing
7 changed files
with
59 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.