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

Adding the .yml file for the pipeline for mirroring the GitHub repo to Azure DevOps #388

Merged
merged 15 commits into from
May 16, 2024
Merged
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
51 changes: 50 additions & 1 deletion .azure/pipelines/azure-pipelines-mirror.yml
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
# This is a placeholder for Azure Mirror Github pipeline
resources:
repositories:
- repository: GarnetGithubRepo
type: github
name: microsoft/garnet
endpoint: ADO_to_Github_ServiceConnection
trigger:
branches:
include:
- main

pool:
vmImage: 'ubuntu-latest'

jobs:
- job: MirrorGithubToADO
displayName: 'Mirror GitHub main to Azure DevOps main'
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: GarnetGithubRepo
clean: true
persistCredentials: true

- script: |
# Set up Git identity
git config user.email "$(GIT_USER_EMAIL)"
git config user.name "$(GIT_USER_NAME)"
git config --global credential.helper 'cache --timeout=3600'

# Fetch the latest changes from the GitHub main branch
git fetch origin main

# Check out main branch locally
# git checkout main

# Ensure the local main branch is checked out and reset to match origin/main
git checkout -B main origin/main

# Reset the main branch to match the origin/main branch
# git reset --hard origin/main

# Push the updated main branch to Azure DevOps
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push https://dev.azure.com/msresearch/_git/Garnet main

displayName: 'Mirror GitHub main to Azure DevOps main'
env:
GIT_USER_EMAIL: $(GIT_USER_EMAIL)
GIT_USER_NAME: $(GIT_USER_NAME)
SYSTEM_ACCESSTOKEN: $(System.AccessToken)