Skip to content

Commit

Permalink
fix switch to target branch ci step (#4636)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisRumyantsev authored and vmapetr committed Feb 20, 2024
1 parent 775ceba commit d822230
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
7 changes: 3 additions & 4 deletions .azure-pipelines/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ jobs:
- checkout: self
clean: true

- task: PowerShell@2
displayName: 'Switch to target branch'
- task: Bash@3
displayName: Switch to target branch
inputs:
targetType: 'filePath'
filePath: .azure-pipelines/scripts/Switch-Branch.ps1
filePath: .azure-pipelines/scripts/switch-branch.sh
env:
TARGET_BRANCH: $(CheckoutBranch)
condition: |
Expand Down
8 changes: 0 additions & 8 deletions .azure-pipelines/scripts/Switch-Branch.ps1

This file was deleted.

11 changes: 11 additions & 0 deletions .azure-pipelines/scripts/switch-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
git config user.email "azure-pipelines-bot@microsoft.com"
git config user.name "azure-pipelines-bot"

git checkout -f origin/$TARGET_BRANCH

last_exit_code=$?

if [[ $last_exit_code != 0 ]]; then
echo "git checkout failed with exit code $last_exit_code"
exit 1
fi
7 changes: 3 additions & 4 deletions .vsts.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,10 @@ extends:
- checkout: self
clean: true

- task: PowerShell@2
displayName: 'Switch to release branch'
- task: Bash@3
displayName: Switch to release branch
inputs:
targetType: 'filePath'
filePath: .azure-pipelines/scripts/Switch-Branch.ps1
filePath: .azure-pipelines/scripts/switch-branch.sh
env:
TARGET_BRANCH: $(ReleaseBranch)

Expand Down

0 comments on commit d822230

Please sign in to comment.