Skip to main content

Github Enterprise cloud migration tool

This tool helps you do the below tasks

Github Migration

Jenkins BMX Migration

Make repos private

Update topics

Find new git URL for CI/CD changes (SNOW)

Github Migration

Migrates provided github repos from source org to target organization

Generate Github Personal Access Token

  • Follow the steps here to generate personal access token. Copy the token.
  • For github enterprise cloud, the token should be enabled with SAML SSO
  • Follow the steps here

Access Needed

  • The user who is running this tool, should be an admin on the source organization.

Make Repos private

Before running the tool for migration make all the repos private. You have to be an admin on the organization to do so

Github Migration
? What do you want to do?  Make repos private
? Organization Name  nike-platform-fulfillment
? github personal access token  ****************************************
tesactions is internal, making it private
Made tesactions private for transfer
tesactions is internal, making it private

Running the tool

  • Install python3
    • On MAC OS - brew install python3
    • On Windows, download the installer from here

Run the below command to install the github migration tool

pip3 install --upgrade ghec-migration

Invoke the tool by running ghec-migration

Note: Set logging level by using environment variable LOGLEVEL. Default is INFO

export LOGLEVEL=DEBUG

Output of the tool

➜  ~ ghec-migration
Github Migration
? What do you want to do?  Github Migration
? Source github org  nike-platform-fulfillment
? Target github org  nike-internal
? Target Team Slug  fulfillment-squad-artemis
? Target Team Admin Slug  fulfillment-admins
? Team Prefix  fulfillment
? Github access token  <token>
? How do you want to get the repos?  Provide list of Repos
? Provide the file with the repo names to be migrated  /Users/vmari2/repos.txt

#output

Logged in as user vmari2_nike
Reading repos from /Users/vmari2/repos.txt

Transferring publishgempoc to target organization
Adding user vmari2_nike as adming to repo publishgempoc
User vmari2_nike added as admin to the repo publishgempoc
Renaming publishgempoc to fulfillment.publishgempoc
Renamed successfully
Renaming master to main
Renamed master to main
Transferring repo publishgempoc to nike-internal
Transfer completed for repo publishgempoc
changing team level access
Changed fulfillment to be a push
Changed fulfillment-squad-artemis to be a maintain
Changed fulfillment-admins to be a admin
Changed fulfillment-external-contributors to be a push
Made publishgempoc internal after transfer
Removing user vmari2_nike as adming to repo publishgempoc
User vmari2_nike removed as admin to the repo publishgempoc
Completed transfer for publishgempoc

Jenkins Migration

We can change the github url in the bmx job using this tool

Generate a jenkins following the steps here

You can provide the list of jobs you want to change. Create a text file with all the jobs you want to reconfigure. Example can be found here

if you don't provide the list of jobs, all the jobs in the jenkins instance will be reconfigured

Github Migration
? What do you want to do?  Jenkins BMX Migration
? Provide the jenkins url  https://logistics.jenkins.bmx.nikecloud.com/
? Provide the file with the list of jobs. Leave blank if you want to reconfigure all jobs in the jenkins instance  jobs.txt
? Jenkins Token  **********************************
? Jenkins Username  Vamsikrishna.Maringanti@nike.com
? New Github Org  nike-internal
? Old Github Org(s). Provide comma separated values   gflsdrepo
? Team Prefix  fulfillment
? Provide the new credentials to Change credentials id. Leave blank if not changing   

Update Topics on repos

This script finds the repos on which the given team has the provided access levels. For example, if you want to update topics on repos where fulfillment-squad-artemis has maintain access provide the below information

Arguments

Postion Argument Description
1 Source_Org the github organization name Ex nike-internal
2 team_slug the team slug Ex: fulfillment-squad-artemis
3 access_level the access level for the provided team - can take values ["push", "pull", "maintain", "admin", "triage"]
4 token github access token
5 Additional Topics Provide common separated topics ex: fulfillment,services
Github Migration
? What do you want to do?  Update topics
? Organization Name  nike-internal
? Team Slug  fulfillment-squad-artemis
? Select the permission level  maintain
? Additional topics, comma separated  artemis
? github personal access token  ****************************************

Find new urls for CI/CD template update

As part of bulk migration, the CICD templates are updated with intermediate organization ex nike-platform-logistics. You can use this tool to get the new URLs for the repos after migration

To run this, you will need the list of old repo URLS. This can be exported from service now

Create a text file with repo URLs. Run the tool selecting the right options

? What do you want to do?  Find new git URL for CI/CD changes (SNOW)
? Source github organization  nike-platform-fulfillment
? File path for the list of Old URLs  old_urls.txt
? Github Token  ****************************************
Getting new url for orderstatus
Getting new url for nikeidboxlabel
Getting new url for goodsissue
Getting new url for fgwschedulers
Completed process. The new git Urls can be found at new_references.csv

What this tool will not do

  • update QMA config in service now
  • Update master references to main in Code like Jenkinsfile, etc
  • If you use build flows based on the branch, you have to update them accordingly
  • Doesn't organize bmx jobs into folders
  • It can't skip bmx jobs

TODO

  • Add branch protection rules and status checks
  • Update Scan@Source metadata

Metadata

Release files for ghec-migration 3.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ghec-migration 3.1.2
File Size Uploaded Provenance
ghec_migration-3.1.2.tar.gz 13.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ghec-migration 3.1.2
File Interpreter ABI Platform
ghec_migration-3.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / ghec_migration-3.1.2.tar.gz

Download URL ghec_migration-3.1.2.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ebae8c1c4a86b005c6439bbb35ded34e91886eb7209f958677ac9f5cf3eaefcd
BLAKE2b-256 checksum
How to use checksums
02d854cdf0d018a505091cff2564a7526768070fe447f493b3e976ca29f70220
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / ghec_migration-3.1.2-py3-none-any.whl

Download URL ghec_migration-3.1.2-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3622218b345ef5b2653051987536ff06f1c24b0f4419e17bb3db8cd56a989a68
BLAKE2b-256 checksum
How to use checksums
419d7d7ad97f0ae3be509e5c5f66da0e5bc7faf817462c2ebf480f20b1abd300
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Security for ghec-migration 3.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page