Skip to content

Commit

Permalink
Enable continue on error for our mirror steps (#7430)
Browse files Browse the repository at this point in the history
- Enable continueonerror for our mirroring steps so one bad
  repo doesn't stop the others from mirroring
- React to recent change to git cli git/git@54f98fe
  Instead of passing --theirs we can get away with --ignore-unmerged given
  we are tryig to avoid any merge conflicts at all and want to simply pick
  and choose which files we want to include from which branches
  • Loading branch information
weshaggard authored Dec 11, 2023
1 parent 9b4ae8c commit b842845
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions eng/pipelines/templates/steps/sync-repo-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ parameters:
steps:

- ${{ each repo in parameters.Repos }}:

- ${{ each target in repo.value.TargetRepos }}:

- task: PowerShell@2
displayName: Sync Repo from ${{ repo.key }} to ${{ target.key }}
continueOnError: true
inputs:
pwsh: true
workingDirectory: ${{ parameters.WorkingDirectory }}
Expand Down
2 changes: 2 additions & 0 deletions eng/pipelines/templates/steps/sync-repo-merge-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ steps:
- task: PowerShell@2
displayName: Merge branch from ${{ repo.value.Branch }} into ${{ target.key }}
continueOnError: true
inputs:
pwsh: true
workingDirectory: ${{ parameters.WorkingDirectory }}/${{ repo.key }}
Expand Down Expand Up @@ -79,6 +80,7 @@ steps:
Write-Host "gh pr merge $mergeBranch --auto --merge --repo ${{ repo.key }}"
gh pr merge $mergeBranch --auto --merge --repo ${{ repo.key }}
displayName: Create Pull Request for merge
continueOnError: true
workingDirectory: ${{ parameters.WorkingDirectory }}/${{ repo.key }}
env:
GH_TOKEN: $(azuresdk-github-pat)
12 changes: 6 additions & 6 deletions eng/scripts/Merge-Branch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ if ($LASTEXITCODE -and -not $mergeOutput.EndsWith('Automatic merge failed; fix c

# update paths matching "theirs", except for "ours" and "merge", to the state in $SourceBranch
if ($Theirs.Length) {
Write-Verbose "git restore -s $SourceBranch --worktree --theirs -- $theirIncludes $ourExcludes $mergeExcludes"
git restore -s $SourceBranch --worktree --theirs -- $theirIncludes $ourExcludes $mergeExcludes
Write-Verbose "git restore -s $SourceBranch --worktree --ignore-unmerged -- $theirIncludes $ourExcludes $mergeExcludes"
git restore -s $SourceBranch --worktree --ignore-unmerged -- $theirIncludes $ourExcludes $mergeExcludes
if ($LASTEXITCODE) { ErrorExit $LASTEXITCODE }
Write-Verbose "git add -A"
git add -A
Expand All @@ -66,17 +66,17 @@ if ($Theirs.Length) {

# update paths matching "ours", except for "merge", to their pre-merge state
if ($Ours.Length) {
Write-Verbose "git restore -s (git rev-parse HEAD) --worktree --theirs -- $ourIncludes $mergeExcludes"
git restore -s (git rev-parse HEAD) --worktree --theirs -- $ourIncludes $mergeExcludes
Write-Verbose "git restore -s (git rev-parse HEAD) --worktree --ignore-unmerged -- $ourIncludes $mergeExcludes"
git restore -s (git rev-parse HEAD) --worktree --ignore-unmerged -- $ourIncludes $mergeExcludes
if ($LASTEXITCODE) { ErrorExit $LASTEXITCODE }
Write-Verbose "git add -A"
git add -A
if ($LASTEXITCODE) { ErrorExit $LASTEXITCODE }
}

if ($AcceptTheirsForFinalMerge) {
Write-Verbose "git restore -s $SourceBranch --worktree --theirs -- $mergeIncludes"
git restore -s $SourceBranch --worktree --theirs -- $mergeIncludes
Write-Verbose "git restore -s $SourceBranch --worktree --ignore-unmerged -- $mergeIncludes"
git restore -s $SourceBranch --worktree --ignore-unmerged -- $mergeIncludes
if ($LASTEXITCODE) { ErrorExit $LASTEXITCODE }
Write-Verbose "git add -A"
git add -A
Expand Down

0 comments on commit b842845

Please sign in to comment.