CHORE: add GitHub->ADO mirror sync pipeline - #547
Merged
Conversation
Adds OneBranchPipelines/github-ado-sync.yml, which keeps the Azure DevOps mirror (sqlclientdrivers/mssql-django) identical to GitHub while preserving full commit history. Design: - SDL-clean: the pipeline's source repository is the ADO mssql-django repo (checkout: self), not GitHub. It only does a plain, unauthenticated git fetch of the public GitHub repo -- no GitHub service connection. - History preserved: pushes GitHub main's actual commit graph (identical SHAs), not a squashed replace-all commit. - No force: after a one-time ADO "Import repository" seed, every sync is a fast-forward push. - No ADO-only files / no ado-only-paths.txt: this YAML lives on GitHub and mirrors to ADO like everything else. - Cadence + location match mssql-python (daily 17:00 IST, OneBranchPipelines/). Targets GitHub `main`; land after the dev->main default-branch switch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep GitHub's default branch as `dev` (no rename needed) and mirror it to the ADO `dev` branch, so GitHub and ADO share the same branch name. Avoids a default-branch rename (admin/ruleset-gated) and retargeting open PRs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ADO/1ES conventions (TSA, Ownership Enforcer, OneBranch) expect the mirror's stable branch to be `main`. Branch names need not match across remotes, so keep GitHub default as `dev` (no rename) and mirror GitHub dev -> ADO main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
⚠️ Not ready to approve
The pipeline/documentation currently hard-codes syncing GitHub dev (conflicting with the PR’s stated post-switch target of main) and uses a non-idempotent git remote add that can break on agent workspaces reused across runs.
Pull request overview
Adds an Azure DevOps (OneBranch) YAML pipeline intended to keep an ADO mirror repository in sync with the GitHub repo by fast-forwarding the mirror branch and pushing tags, while avoiding GitHub service connections.
Changes:
- Introduces
OneBranchPipelines/github-ado-sync.ymldefining a scheduled, ADO-sourced mirror-sync job. - Implements a
git fetchfrom public GitHub and a fast-forwardgit pushback to the ADO mirror.
File summaries
| File | Description |
|---|---|
| OneBranchPipelines/github-ado-sync.yml | Adds scheduled pipeline to fetch from GitHub and fast-forward push to the ADO mirror branch (plus tags). |
Review details
Comments suppressed due to low confidence (2)
OneBranchPipelines/github-ado-sync.yml:12
- This file (and the script below) are written to mirror GitHub
devinto ADOmain, but the PR description says the pipeline should target GitHubmainafter the default-branch switch. Please align the branch mapping documentation here with the intended post-switch behavior so it doesn’t become stale/misleading in the mirror repo.
# Branch mapping: GitHub's default branch is `dev`; the Azure DevOps mirror's
# default/stable branch is `main` (ADO/1ES conventions -- TSA, Ownership
# Enforcer, OneBranch official builds -- expect `main`). Branch names need not
# match across the two remotes, so we sync GitHub `dev` -> ADO `main`.
#
OneBranchPipelines/github-ado-sync.yml:63
- The sync script hard-codes fetching
devand also usesgit remote add github ..., which can fail on agents that reuse the workspace (remote already exists). If this pipeline is meant to run after the branch switch (GitHubmain), fetchmainand make the remote configuration idempotent.
# Fetch GitHub dev's real commits + tags. Public repo -> no auth, no
# service connection (keeps the pipeline source ADO-only for SDL).
git remote add github https://github.com/microsoft/mssql-django.git
git fetch --tags github dev
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Low
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
Switch the GitHub->ADO mirror sync from a direct fast-forward push to main to the PULL REQUEST mechanism (same as mssql-python), while PRESERVING full commit history (real commits + SHAs) instead of python's squashed replace-all. - Push GitHub dev's actual commits to a fresh sync/github-dev-<ts> branch (fast-forward, no force, never touches main directly). - Open a PR sync -> main, auto-completed as a MERGE (--squash false) so the individual commits are retained on main. - No direct writes to main, no force-push anywhere. Build Service needs Contribute + Contribute to PRs (same surface as python). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jahnvi480
approved these changes
Jul 27, 2026
bewithgaurav
added a commit
that referenced
this pull request
Jul 27, 2026
…550) The sync YAML merged in #547 runs `az repos pr create` on the Django-1ES-pool Linux image, which does not ship the Azure CLI -> the sync failed with `az: command not found`. - Move the job to a Microsoft-hosted `windows-latest` agent, where az is preinstalled (same tooling as the mssql-python sync). Script converted to pwsh accordingly. - Still preserves full commit history: pushes GitHub dev's real commits to a sync/github-dev-<ts> branch and opens a PR auto-completed as a MERGE (--squash false). No direct push to main, no force. - Link the tracking work item on every sync PR (--work-items 46645, "GH<>ADO Sync PRs") for traceability and to satisfy the work-item policy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the GitHub → Azure DevOps mirror sync pipeline:
OneBranchPipelines/github-ado-sync.yml.It keeps the ADO mirror (
sqlclientdrivers/mssql-django) identical to GitHub, preserving full commit history (real commits, identical SHAs) via a fast-forward push — no squashed single-diff commit, and no force-push.Design (per discussion)
mssql-djangorepo (checkout: self), not GitHub. It only does a plain, unauthenticatedgit fetchof the public GitHub repo — no GitHub service connection, no GitHub-sourced pipeline.main's actual commit graph (vs mssql-python's squashed replace-all).ado-only-paths.txt. This YAML lives on GitHub and mirrors to ADO like everything else.Contribute.OneBranchPipelines/).Assumes / sequencing
main— land after thedev→maindefault-branch switch.Contribute.Draft until the ADO mirror is re-imported and the pipeline definition is created.