azure-sdk-for-cpp/eng/common/testproxy/scripts/resolve-asset-conflict
Azure SDK Bot 84f000c7c6
Sync eng/common directory with azure-sdk-tools for PR 7537 (#5278)
* Add ConflictedFile to git-helpers.ps1, add git-helpers.tests.ps1 to exercise basic functionality.
* Add `resolve-asset-conflict.ps1` a script that can autoresolve an assets.json file.

---------

Co-authored-by: Scott Beddall (from Dev Box) <scbedd@microsoft.com>
Co-authored-by: Scott Beddall <45376673+scbedd@users.noreply.github.com>
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2024-01-17 14:08:35 -08:00
..
README.md
resolve-asset-conflict.ps1

Merge Proxy Tags Script

This script is intended to allow easy resolution of a conflicting assets.json file.

In most cases where two branches X and Y have progressed alongside each other, a simple

git checkout X && git merge Y can successfully merge other than the assets.json file.

That often will end up looking like this:

{
  "AssetsRepo": "Azure/azure-sdk-assets-integration",
  "AssetsRepoPrefixPath": "python",
  "TagPrefix": "python/storage/azure-storage-blob",
<<<<<<< HEAD
  "Tag": "integration/example/storage_feature_addition2"
=======
  "Tag": "integration/example/storage_feature_addition1"
>>>>>>> test-storage-tag-combination
}

This script uses git to tease out the source and target tags, then merge the incoming tag into the recordings of the base tag.

This script should only be used on an already conflicted assets.json file. Otherwise, no action will be executed.

Usage

PreReqs

Call the script

For simplicity when resolving merge-conflicts, invoke the script from the root of the repo. The help instructions from merge-asset-tags use paths relative from repo root.

# including context to get into a merge conflict
cd "path/to/language/repo/root"
git checkout base-branch
git merge target-branch
# auto resolve / merge conflicting tag values
./eng/common/testproxy/scripts/resolve-asset-conflict/resolve-asset-conflict.ps1 sdk/storage/azure-storage-blob/assets.json
# user pushes
test-proxy push -a sdk/storage/azure-storage-blob/assets.json

Resolving conflicts

When an assets.json merge has conflicts on the test recordings side, the merge-proxy-tags script will exit with an error describing how to re-invoke the merge-proxy-tags script AFTER you resolve the conflicts.

  • cd into the assets location output by the script
  • resolve the conflict or conflicts
  • add the resolution, and invoke git cherry-pick --continue

Afterwards, re-invoke the merge-proxy-tags script with arguments given to you in original error. This will leave the assets in a touched state that can be test-proxy push-ed.