Skip to content

fix(ci): renew Azure login for delayed probe cleanup - #968

Merged
Xuanwo merged 3 commits into
mainfrom
xuanwo/azure-probe-cleanup-reauth
Nov 19, 2026
Merged

Xuanwo merged 3 commits into
mainfrom
xuanwo/azure-probe-cleanup-reauth

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

A long-running Azure Pipelines live test can outlive the GitHub OIDC assertion used by azure/login. When cleanup runs after that assertion expires, refreshing the DevOps token or deleting the probe fails even though the federated credential is still valid.

Renew the Azure CLI login only after a token or blob-delete failure, using the job's existing id-token: write permission, the same client and tenant, and the existing api://AzureADTokenExchange audience. Keep the login helper's ::add-mask:: command on the runner's stdout while capturing only the returned token. Retry the failed operation once. The queue POST, run ID ownership, 3,300-second poll budget, #959/#969 curl 35 and HTTP 503 status retries, and original exit status remain unchanged; a failed cancel still does not prevent probe deletion.

Validation on the merged branch:

No new secrets, permissions, or long-lived state; no live Azure credentials were used.

A 55-minute Azure Pipelines run can outlive the GitHub OIDC assertion used by azure/login. Token refresh then fails during cleanup, leaving the unfinished run and probe behind.

Request a fresh assertion with the job existing id-token permission and audience, and log in again as the same service principal. Use it only after a failed token or blob delete, and retry that operation once. The queue POST, run ownership, polling timeout, and original exit status remain unchanged.

Cover normal cleanup, expired assertion cleanup for both the pipeline run and blob-only path, and reauthentication failure.
The login helper ::add-mask:: command was captured by command substitution together with the refreshed DevOps token. In Actions mode the Authorization header then contained the mask command and a newline, so cleanup status reads failed and the run was not cancelled.

Set the global access_token directly and call the helper outside command substitution so the workflow command reaches the runner on stdout. Add Actions-mode expiry coverage with exact DevOps bearer checks, and restore the #959 cleanup probe-deletion assertion.
…eanup-reauth

# Conflicts:
#	.github/azure-live-tests/test_scripts.py
@Xuanwo
Xuanwo merged commit 047a5c1 into main Nov 19, 2026
62 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/azure-probe-cleanup-reauth branch November 19, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants