Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix switch to target branch CI step #4636

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading