Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gateixeira/gh-gei-migration-helper
https://github.com/gateixeira/gh-gei-migration-helper
gh-extension github migration
Last synced: 24 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/gateixeira/gh-gei-migration-helper
- Owner: gateixeira
- License: mit
- Created: 2023-03-20T21:01:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-10T15:52:19.000Z (27 days ago)
- Last Synced: 2024-12-10T17:21:16.479Z (27 days ago)
- Topics: gh-extension, github, migration
- Language: Go
- Homepage:
- Size: 22.9 MB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GEI Migration Helper
GitHub CLI Extension.
This is a wrapper tool to GitHub Enterprise Importer that orchestrate necessary steps between [GitHub's GEI](https://github.com/github/gh-gei) repository migration and GHAS secret and code scanning migrations.
It is a collection of scripts that can be used to help with the migration process by wrapping GEI commands and performing pre and post-migration changes
## Installation
the GEI Migration Helper can be installed via this command:
```
$ gh extension install gateixeira/gh-gei-migration-helper
```## Usage
Run the tool via command line:
```
$ gh gei-migration-helper --help
```## Migration process
Read all repositories from source organization and for each repository:
1. Check if code scanning analysis exist at source in default branch
- Activate code scanning at source if not already activated
- 1.2 Check if code scanning analysis exist at source
2. Disable GHAS at source
3. Disable workflows at source
4. Migrate repository
5. Disable workflows at target (they get re-enabled after a migration)
6. Check if target repository is archived
- 6.1 Unarchive target repository
7. Delete branch protections at target
8. Check if target repository is private
- 8.1 Change visibility of target repository to internal
9. Activate GHAS at target
10. If source repository has code scanning analysis
- 10.1 Activate code scanning at source
- 10.2 Migrate code scanning alerts
- 10.3 Deactivate code Scanning at source
11. Check if target repository is archived
- 11.1 Archive target repository
12. Reset origin
- 12.1 Reset GHAS settings at source
- 12.2 Reset workflows at source
13. Check if source repository is archived
- 13.1 Archive source repository## Manual steps to execute a migration
1. Download the [GitHub CLI](https://cli.github.com/)
2. Install the [GEI extension](https://github.com/github/gh-gei)
3. Create a [personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) for the source and target organization according to [these scopes](https://docs.github.com/en/enterprise-cloud@latest/migrations/using-github-enterprise-importer/preparing-to-migrate-with-github-enterprise-importer/managing-access-for-github-enterprise-importer#personal-access-tokens-for-github-products)
4. Run the migration helper scripts
5. `migrate-organization` to migrate all repositories in an organization
6. Wait for secret scanning to execute on the target organization
7. `migrate-secret-scanning` to migrate secret scanning results
8. `reactivate-target-workflow` to reactivate workflows at target that were deactivated during the migration process## Scripts
### `migrate-organization`
This script can be used to migrate all repositories in an organization.
It first looks for a repository called `migration-status` in the target org. If it exists, it means a migration is already in progress or finished in error and no new migration will be started, returning an error message.
If a migration finished only partially successful, you can delete the `migration-status` repository and run the migration again.
#### Usage
```
$ gh gh-gei-migration-helper migrate-organization --source-org --target-org --source-token --target-token
```### `migrate-repository`
This script can be used to migrate a single repository
#### Usage
```
$ gh gh-gei-migration-helper migrate-repository --repo --source-org --target-org --source-token --target-token
```### `migrate-secret-scanning`
Wrapper to migrate secret scan results. It migrates for all repositories in an org if no `--repo` is provided.
#### Usage
```
$ gh gh-gei-migration-helper migrate-secret-scanning --repo --source-org --target-org --source-token --target-token
```### `reactivate-target-workflow`
Resets the target repository workflows to their original state. It reactivates all workflows that were deactivated during the migration process.
Omit the repository flag to run against the whole organization.
#### Usage
```
$ gh gh-gei-migration-helper reactivate-target-workflow --source-org --target-org --source-token --target-token
```### `migration-status`
Check progress of the migration. This is based on the existance of a `migration-status` repository at target and a single issue inside of it, which is created when a migration finishes to provide an overview.
- If the repository does not exist, a migration was not started
- If repository exists but without the issue, a migration is in progress or finished in error
- If the repository exists with the issue, a migration was finishedTo retry a migration on the repositories that have not been migrated, delete the `migration-status` repository and run the migration again.
#### Usage
```
$ gh gh-gei-migration-helper migration-status --source-org --target-org --source-token --target-token
```