CI - Scope the Azure log shipping test databases by run id so concurrent runs do not share a blob name - #10717
Open
andreasjordan wants to merge 1 commit into
Open
andreasjordan wants to merge 1 commit into
andreasjordan wants to merge 1 commit into
Conversation
…ent runs do not share a blob name Both Azure log shipping tests in gh-actions.ps1 used a fixed database name, and Invoke-DbaDbLogShipping builds the blob name from the database name and a timestamp with second resolution. Two runs on different branches that reached the backup within the same second fought over one blob in the shared container, and the loser failed with "exists on the remote endpoint, and WITH FORMAT was not specified" (#10667). The names now carry GITHUB_RUN_ID and GITHUB_RUN_ATTEMPT, so every run and rerun uses its own database and blobs. The blob cleanup lists by the database name as prefix, so it keeps finding its own blobs. Carries the CI script part of #10679 by simonyang08. (do Invoke-DbaDbLogShipping) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
andreasjordan
requested review from
niphlod and
potatoqualitee
as code owners
September 16, 2026 09:20
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10667. Carries the
.github/scripts/gh-actions.ps1part of #10679 by @simonyang08, as proposed in the review there; the command change and the source-reading test file of that PR are left out.The flake
On 2026-08-31 three PRs pushed within about 30 seconds ran "sets up log shipping to Azure blob storage using SAS token" at the same second. The test used the fixed database name
dbatoolsci_logship_azure, andInvoke-DbaDbLogShippingnames the blob<database>_FullBackup_PreLogShipping_<yyyyMMddHHmmss>.bak, so all three runs wrote to the same blob in the shared container. The run for #10665 lost:The change
Both Azure log shipping test database names (
dbatoolsci_logship_azureanddbatoolsci_logship_addsecondary) now carryGITHUB_RUN_IDandGITHUB_RUN_ATTEMPT, for exampledbatoolsci_logship_azure_31789177009_1. Every run and every rerun then works on its own database and its own blobs, whatever the timestamp says. The blob cleanup at the end of each test lists by the database name as prefix, so it keeps finding its own blobs; the derived names of the second test (_second,_missing) build on the scoped name and follow along. Nothing else in the repository uses the old literal names.No command change: the collision is a property of the shared CI container and the fixed test name, not of the command, and a finer timestamp would also rename the on-premises backup file for every user.
What this does not do
The first test's cleanup sits after its assertions, without a
finally. A run that fails before it now leaves its blobs behind under its own run id, where the next run's broad prefix used to sweep them. Sweeping the old broad prefix again would delete another concurrent run's backup while it restores, which is the same race from the other side, so the leftovers are the price of the fix and can be removed by hand from the container when it matters.Verification
The script parses, and the name resolves to
dbatoolsci_logship_azure_<run id>_<attempt>with the GitHub environment set.Run Cross Platform Teststriggers on the push of this branch with the real SAS token, so the Azure tests run on this PR's CI.created by Claude and reviewed by Andreas Jordan
🤖 Generated with Claude Code