Skip to content

Migrating from ADO to github

GitHub Repository and Workflow Migration Guide

This guide walks you through the process of migrating repositories and pipelines (workflows) from Azure DevOps (ADO) to GitHub.

1. Migrate Repository from ADO to GitHub

Notify your team about your intentions to migrate the repository.

2. Migrate Repository from ADO to GitHub

We created a pipeline to migrate your repository to GitHub.
You can trigger use it here

image.png


3. Configure your GitHub repository

We created a pipeline to configure automatically every morning backend repositories.
You can trigger it manually here

image.png

4. Update your service Argo CD app to use GitHub


#### 4.1 Update image tag in be-deployment repo - Make sure image tag in the github repo [be-deployment](https://github.com/majority-dev/be-deployments) matches the current image on cluster(or [bank-deployment](https://dev.azure.com/MAJORITY/Bank/_git/bank-deployments) repo) [PR example](https://github.com/majority-dev/be-deployments/pull/65/files) #### 4.2. Update your service Argo CD configuration Update the ArgoCD application configuration [here](https://dev.azure.com/MAJORITY/Bank/_git/bank-azure-infrastructure?path=/Minority/Canary/ArgoCD/Applications/values.yaml) to point to the GitHub repository URL. #### 4.3 Verify your Argo CD app Click on refresh in your Argo CD app, no diff should appear. You can verify GitHub is the new sources by clicking on details in Argo CD. ![image.png](/migrated-devops-attachments/image-3ae6f71d-dd7e-46e8-9a2e-6d4bf80386db.png)



5. Create migration Pull Request to start deploying from GitHub

Note: Step 7-8 below also includes updates to your new github repo. You can include them in the same PR, so you don't have to ask for reviews multiple times.

In your new GitHub repository, create a new branch and includes these changes:

Full example PR

#### 5.1 Remove Sourcelink Package Reference - If your `.csproj` file uses the Azure Repos version of SourceLink, Remove it. - Remove this package:
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="8.0.0">
   ...
</PackageReference>
#### 5.2 Create a CODEOWNERS File Create a `CODEOWNERS` file in the `.github` directory to manage code review responsibilities. To begin, you can include the entire backend team such as this [example](https://github.com/majority-dev/be-cicd/blob/master/.github/CODEOWNERS) (You do not need platform team). Note: You need to include the CODEOWNERS in your first PR otherwise it will not pass check [More Examples](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners). #### 5.3 Create GitHub Actions Workflow directory Create a directory at the root of your repository: `.github/workflows/`. #### 5.4 Create PR Workflow YAML Create a file named `pr_workflow.yaml` in the `.github/workflows` directory with the following contents:
  name: be-kyc-pr   # <-- replace with <your-repo-name>-pr

  on:
    pull_request:
      branches:
        - 'master'
    workflow_dispatch:

  jobs:
    run-pr-build:
      permissions:
        contents: write
        actions: write
        checks: write
        packages: read
      uses: majority-dev/be-cicd/.github/workflows/pr_pipeline_github.yml@master
      with:
        solutionPath: 'Minority/Minority.Bank.sln' # <-- replace with your sln path
        area: 'Minority.IdologyKyc'  # <- replace with your area name
        buildDb: true
        dbName: 'MinorityIdologyKyc' # <- replace with your DB name
      secrets: inherit
#### 5.5 Create CICD Workflow Create a file named `cicd_workflow.yaml` in the `.github/workflows` directory with the following contents:
name: cicd

permissions:
  contents: read
  packages: write
  attestations: write
  pull-requests: write
  actions: read
  checks: write

on:
  workflow_dispatch:
  push:
    branches:
      - master

jobs:
  use-template:
    uses: majority-dev/be-cicd/.github/workflows/cicd.yaml@master
    secrets: inherit
    with:
      projects: '["Minority.Check.Api", "Minority.Check.Service"]' # <- Replace with your list of projects, make sure to define this as a string
      rootfolder: Minority
      area: Minority.Check  # <- replace with your area nema
      packageFilter: ''
      appName: bank-check  # <- replace with your app name
      dbDeploy: true
      #dbNameOverride: 'mf-remittance'
#### 5.6 (Only for CDE) Add mandatory CDE pr template and pr check + update codeowners - Update codeowners to also include `@majority-dev/cde-change-managers` - Create a new `pr_check_cde_approvals.yml` file to add a workflow to your .github folder (see [example](https://github.com/majority-dev/be-cde-template/blob/master/.github/workflows/pr-check-cde-approvals.yml)) - Add PR template file `PULL_REQUEST_TEMPLATE.md` to .github folder (see [example](https://github.com/majority-dev/be-cde-template/blob/master/.github/PULL_REQUEST_TEMPLATE.md)) #### 5.6 Copy configurations(configmaps) from ADO to github STEPS CAN BE SKIPPED FOR NOW, ONLY DO IT IF REGRESSION TEST IS FAILING IN GITHUB For regression/smoke test we take the configs from configurations repos in github. So make sure you move the newly added configurations to both ADO and github repos.



6. Ask Managers or Platform team to whitelist your repo for deploying to prod

Procedure:
- Go to this GitHub Organization settings page
- Click on wheels button and select the new service repo to allow

image.png


7. Update your service to our GitHub Renovate

Update renovate.json file to refer to the new shared renovate configuration file hosted in GitHub.

"extends": ["github>majority-dev/be-cicd//renovate/dotnet-config"]

Add GitHub package source to nuget.config. It will indicate Renovate to check our GitHub packages repository when searching for new versions.

Add this first in the list of packageSources to make it the default in VS package browser

<add key="github" value="https://nuget.pkg.github.com/majority-dev/index.json" />

7.1 Update user secrets

User secrets need to be updated to use be- instead of bank- see this pr for reference https://github.com/majority-dev/be-auditing/pull/479/files
Remember to run Initialize-UserSecrets for the area afterwards.


8. Cleanup

  • Delete the .azure-devops folder in your GitHub repository
  • Ask managers to disable the repository in Azure DevOps

9. How to pull GitHub packages locally

  • (Step already done for Renovate) Add GitHub package source to nuget.config. It will indicate Renovate to check our GitHub packages repository when searching for new versions.
    <add key="github" value="https://nuget.pkg.github.com/majority-dev/index.json" />
    
  • Install GitHub CLI (https://cli.github.com/manual/)
  • Login to GitHub via the cli tool (gh auth login --scopes read:packages)
  • Get GitHub oauth token ( gh auth token)
  • In Visual Studio, enter your GitHub username and token for password