Skip to content

CHORE: add GitHub->ADO mirror sync pipeline - #547

Merged
bewithgaurav merged 5 commits into
devfrom
bewithgaurav/github-ado-sync-pipeline
Jul 27, 2026
Merged

CHORE: add GitHub->ADO mirror sync pipeline#547
bewithgaurav merged 5 commits into
devfrom
bewithgaurav/github-ado-sync-pipeline

Conversation

@bewithgaurav

Copy link
Copy Markdown
Collaborator

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)

  • SDL-clean: the pipeline's source 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, no GitHub-sourced pipeline.
  • History preserved: pushes GitHub main's actual commit graph (vs mssql-python's squashed replace-all).
  • No hacks: zero ADO-only files, no ado-only-paths.txt. This YAML lives on GitHub and mirrors to ADO like everything else.
  • No force: the ADO repo is seeded once via ADO Import repository (full history), after which every sync is a fast-forward. Needs only Build Service Contribute.
  • Cadence + location match mssql-python (daily 17:00 IST, OneBranchPipelines/).

Assumes / sequencing

  • Targets GitHub main — land after the devmain default-branch switch.
  • ADO side (joint step): re-import the mirror from GitHub, create the pipeline definition (source = ADO mirror), grant Build Service Contribute.

Draft until the ADO mirror is re-imported and the pipeline definition is created.

bewithgaurav and others added 3 commits July 27, 2026 12:00
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>
@bewithgaurav
bewithgaurav marked this pull request as ready for review July 27, 2026 07:17
Copilot AI review requested due to automatic review settings July 27, 2026 07:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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.yml defining a scheduled, ADO-sourced mirror-sync job.
  • Implements a git fetch from public GitHub and a fast-forward git push back 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 dev into ADO main, but the PR description says the pipeline should target GitHub main after 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 dev and also uses git 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 (GitHub main), fetch main and 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.

Comment thread OneBranchPipelines/github-ado-sync.yml Outdated
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>
@bewithgaurav
bewithgaurav merged commit 4f1bac6 into dev Jul 27, 2026
4 of 5 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants