Skip to content

Commit 1c162b0

Browse files
authored
Merge pull request #1555 from github/add-gitlab-archive-adapter
Add gl2gh GitLab adapter
2 parents 9a6d313 + 8792089 commit 1c162b0

63 files changed

Lines changed: 4311 additions & 8 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
},
1717

1818
"features": {
19-
"ghcr.io/devcontainers/features/github-cli:1": {}
19+
"ghcr.io/devcontainers/features/github-cli:1": {},
20+
"ghcr.io/devcontainers/features/dotnet:2": {
21+
"version": "8.0"
22+
}
2023
},
2124

2225
"remoteUser": "vscode"

.github/workflows/CI.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,15 @@ jobs:
148148
dist/linux-x64/ado2gh-linux-amd64
149149
dist/linux-x64/bbs2gh-linux-amd64
150150
dist/linux-x64/gei-linux-amd64
151+
dist/linux-x64/gl2gh-linux-amd64
151152
dist/osx-x64/ado2gh-darwin-amd64
152153
dist/osx-x64/bbs2gh-darwin-amd64
153154
dist/osx-x64/gei-darwin-amd64
155+
dist/osx-x64/gl2gh-darwin-amd64
154156
dist/win-x64/ado2gh-windows-amd64.exe
155157
dist/win-x64/bbs2gh-windows-amd64.exe
156158
dist/win-x64/gei-windows-amd64.exe
159+
dist/win-x64/gl2gh-windows-amd64.exe
157160
158161
e2e-test:
159162
permissions:
@@ -166,7 +169,7 @@ jobs:
166169
fail-fast: false
167170
matrix:
168171
runner-os: [windows-latest, ubuntu-latest, macos-latest]
169-
source-vcs: [AdoBasic, AdoCsv, Bbs, Ghes, Github]
172+
source-vcs: [AdoBasic, AdoCsv, Bbs, Ghes, Github, Gitlab]
170173
runs-on: ${{ matrix.runner-os }}
171174
concurrency: integration-test-${{ matrix.source-vcs }}-${{ matrix.runner-os }}
172175
steps:
@@ -191,9 +194,11 @@ jobs:
191194
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
192195
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
193196
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
197+
New-Item -Path "./" -Name "gh-gl2gh" -ItemType "directory"
194198
Copy-Item ./dist/linux-x64/gei-linux-amd64 ./gh-gei/gh-gei
195199
Copy-Item ./dist/linux-x64/ado2gh-linux-amd64 ./gh-ado2gh/gh-ado2gh
196200
Copy-Item ./dist/linux-x64/bbs2gh-linux-amd64 ./gh-bbs2gh/gh-bbs2gh
201+
Copy-Item ./dist/linux-x64/gl2gh-linux-amd64 ./gh-gl2gh/gh-gl2gh
197202
shell: pwsh
198203

199204
- name: Copy binary to root (windows)
@@ -202,9 +207,11 @@ jobs:
202207
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
203208
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
204209
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
210+
New-Item -Path "./" -Name "gh-gl2gh" -ItemType "directory"
205211
Copy-Item ./dist/win-x64/gei-windows-amd64.exe ./gh-gei/gh-gei.exe
206212
Copy-Item ./dist/win-x64/ado2gh-windows-amd64.exe ./gh-ado2gh/gh-ado2gh.exe
207213
Copy-Item ./dist/win-x64/bbs2gh-windows-amd64.exe ./gh-bbs2gh/gh-bbs2gh.exe
214+
Copy-Item ./dist/win-x64/gl2gh-windows-amd64.exe ./gh-gl2gh/gh-gl2gh.exe
208215
shell: pwsh
209216

210217
- name: Copy binary to root (macos)
@@ -213,16 +220,19 @@ jobs:
213220
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
214221
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
215222
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
223+
New-Item -Path "./" -Name "gh-gl2gh" -ItemType "directory"
216224
Copy-Item ./dist/osx-x64/gei-darwin-amd64 ./gh-gei/gh-gei
217225
Copy-Item ./dist/osx-x64/ado2gh-darwin-amd64 ./gh-ado2gh/gh-ado2gh
218226
Copy-Item ./dist/osx-x64/bbs2gh-darwin-amd64 ./gh-bbs2gh/gh-bbs2gh
227+
Copy-Item ./dist/osx-x64/gl2gh-darwin-amd64 ./gh-gl2gh/gh-gl2gh
219228
shell: pwsh
220229

221230
- name: Set execute permissions
222231
run: |
223232
chmod +x ./gh-gei/gh-gei
224233
chmod +x ./gh-ado2gh/gh-ado2gh
225234
chmod +x ./gh-bbs2gh/gh-bbs2gh
235+
chmod +x ./gh-gl2gh/gh-gl2gh
226236
227237
- name: Install gh-gei extension
228238
run: gh extension install .
@@ -245,6 +255,13 @@ jobs:
245255
env:
246256
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
247257

258+
- name: Install gh-gl2gh extension
259+
run: gh extension install .
260+
shell: pwsh
261+
working-directory: ./gh-gl2gh
262+
env:
263+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
264+
248265
- name: Integration Test
249266
env:
250267
ADO_PAT: ${{ secrets.ADO_PAT }}
@@ -266,6 +283,7 @@ jobs:
266283
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
267284
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
268285
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }}
286+
GITLAB_PAT: ${{ secrets.GITLAB_PAT }}
269287
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:${{ github.workspace }}/src/OctoshiftCLI.IntegrationTests/bin/Debug/net8.0/runtimes/ubuntu.18.04-x64/native"
270288
run: dotnet test src/OctoshiftCLI.IntegrationTests/OctoshiftCLI.IntegrationTests.csproj --filter "${{ matrix.source-vcs }}ToGithub" --logger:"junit;LogFilePath=integration-tests.xml" --logger "console;verbosity=normal" /p:VersionPrefix=9.9
271289

@@ -386,6 +404,21 @@ jobs:
386404
./dist/osx-x64/bbs2gh-darwin-amd64
387405
./dist/osx-arm64/bbs2gh-darwin-arm64
388406
407+
- name: Create gh-gl2gh Release
408+
# a06a81a03ee405af7f2048a818ed3f03bbf83c7b is tag v2, pinned to avoid supply chain attacks
409+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b
410+
with:
411+
body_path: ./RELEASENOTES.md
412+
repository: github/gh-gl2gh
413+
token: ${{ secrets.RELEASE_NOTES_PAT }}
414+
files: |
415+
./dist/win-x86/gl2gh-windows-386.exe
416+
./dist/win-x64/gl2gh-windows-amd64.exe
417+
./dist/linux-x64/gl2gh-linux-amd64
418+
./dist/linux-arm64/gl2gh-linux-arm64
419+
./dist/osx-x64/gl2gh-darwin-amd64
420+
./dist/osx-arm64/gl2gh-darwin-arm64
421+
389422
- name: Archive Release Notes
390423
shell: pwsh
391424
run: |

.github/workflows/integration-tests.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,23 @@ jobs:
7878
dist/linux-x64/ado2gh-linux-amd64
7979
dist/linux-x64/bbs2gh-linux-amd64
8080
dist/linux-x64/gei-linux-amd64
81+
dist/linux-x64/gl2gh-linux-amd64
8182
dist/osx-x64/ado2gh-darwin-amd64
8283
dist/osx-x64/bbs2gh-darwin-amd64
8384
dist/osx-x64/gei-darwin-amd64
85+
dist/osx-x64/gl2gh-darwin-amd64
8486
dist/win-x64/ado2gh-windows-amd64.exe
8587
dist/win-x64/bbs2gh-windows-amd64.exe
8688
dist/win-x64/gei-windows-amd64.exe
89+
dist/win-x64/gl2gh-windows-amd64.exe
8790
8891
e2e-test:
8992
needs: [ build-for-e2e-test ]
9093
strategy:
9194
fail-fast: false
9295
matrix:
9396
runner-os: [windows-latest, ubuntu-latest, macos-latest]
94-
source-vcs: [AdoBasic, AdoCsv, Bbs, Ghes, Github]
97+
source-vcs: [AdoBasic, AdoCsv, Bbs, Ghes, Github, Gitlab]
9598
runs-on: ${{ matrix.runner-os }}
9699
concurrency: integration-test-${{ matrix.source-vcs }}-${{ matrix.runner-os }}
97100
steps:
@@ -124,9 +127,11 @@ jobs:
124127
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
125128
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
126129
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
130+
New-Item -Path "./" -Name "gh-gl2gh" -ItemType "directory"
127131
Copy-Item ./dist/linux-x64/gei-linux-amd64 ./gh-gei/gh-gei
128132
Copy-Item ./dist/linux-x64/ado2gh-linux-amd64 ./gh-ado2gh/gh-ado2gh
129133
Copy-Item ./dist/linux-x64/bbs2gh-linux-amd64 ./gh-bbs2gh/gh-bbs2gh
134+
Copy-Item ./dist/linux-x64/gl2gh-linux-amd64 ./gh-gl2gh/gh-gl2gh
130135
shell: pwsh
131136

132137
- name: Copy binary to root (windows)
@@ -135,9 +140,11 @@ jobs:
135140
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
136141
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
137142
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
143+
New-Item -Path "./" -Name "gh-gl2gh" -ItemType "directory"
138144
Copy-Item ./dist/win-x64/gei-windows-amd64.exe ./gh-gei/gh-gei.exe
139145
Copy-Item ./dist/win-x64/ado2gh-windows-amd64.exe ./gh-ado2gh/gh-ado2gh.exe
140146
Copy-Item ./dist/win-x64/bbs2gh-windows-amd64.exe ./gh-bbs2gh/gh-bbs2gh.exe
147+
Copy-Item ./dist/win-x64/gl2gh-windows-amd64.exe ./gh-gl2gh/gh-gl2gh.exe
141148
shell: pwsh
142149

143150
- name: Copy binary to root (macos)
@@ -146,16 +153,19 @@ jobs:
146153
New-Item -Path "./" -Name "gh-gei" -ItemType "directory"
147154
New-Item -Path "./" -Name "gh-ado2gh" -ItemType "directory"
148155
New-Item -Path "./" -Name "gh-bbs2gh" -ItemType "directory"
156+
New-Item -Path "./" -Name "gh-gl2gh" -ItemType "directory"
149157
Copy-Item ./dist/osx-x64/gei-darwin-amd64 ./gh-gei/gh-gei
150158
Copy-Item ./dist/osx-x64/ado2gh-darwin-amd64 ./gh-ado2gh/gh-ado2gh
151159
Copy-Item ./dist/osx-x64/bbs2gh-darwin-amd64 ./gh-bbs2gh/gh-bbs2gh
160+
Copy-Item ./dist/osx-x64/gl2gh-darwin-amd64 ./gh-gl2gh/gh-gl2gh
152161
shell: pwsh
153162

154163
- name: Set execute permissions
155164
run: |
156165
chmod +x ./gh-gei/gh-gei
157166
chmod +x ./gh-ado2gh/gh-ado2gh
158167
chmod +x ./gh-bbs2gh/gh-bbs2gh
168+
chmod +x ./gh-gl2gh/gh-gl2gh
159169
160170
- name: Install gh-gei extension
161171
run: gh extension install .
@@ -178,6 +188,13 @@ jobs:
178188
env:
179189
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180190

191+
- name: Install gh-gl2gh extension
192+
run: gh extension install .
193+
shell: pwsh
194+
working-directory: ./gh-gl2gh
195+
env:
196+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
197+
181198
- name: Integration Test
182199
env:
183200
ADO_PAT: ${{ secrets.ADO_PAT }}
@@ -199,6 +216,7 @@ jobs:
199216
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
200217
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
201218
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }}
219+
GITLAB_PAT: ${{ secrets.GITLAB_PAT }}
202220
GEI_DEBUG_MODE: 'true'
203221
LD_LIBRARY_PATH: '$LD_LIBRARY_PATH:${{ github.workspace }}/src/OctoshiftCLI.IntegrationTests/bin/Debug/net8.0/runtimes/ubuntu.18.04-x64/native'
204222
run: dotnet test src/OctoshiftCLI.IntegrationTests/OctoshiftCLI.IntegrationTests.csproj --filter "${{ matrix.source-vcs }}ToGithub" --logger:"junit;LogFilePath=integration-tests.xml" --logger "console;verbosity=normal" /p:VersionPrefix=9.9

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ The [GitHub Enterprise Importer](https://docs.github.com/en/migrations/using-git
88
> GEI is generally available for repository migrations originating from Azure DevOps or GitHub that target GitHub Enterprise Cloud. It is in public beta for repository migrations from BitBucket Server and Data Center to GitHub Enterprise Cloud.
99
1010
## Using the GEI CLI
11-
There are 3 separate CLIs that we ship as extensions for the official [GitHub CLI](https://github.com/cli/cli#installation):
11+
There are 4 separate CLIs that we ship as extensions for the official [GitHub CLI](https://github.com/cli/cli#installation):
1212
- `gh gei` - Run migrations between GitHub products
1313
- `gh ado2gh` - Run migrations from Azure DevOps to GitHub
1414
- `gh bbs2gh` - Run migrations from BitBucket Server or Data Center to GitHub
15+
- `gh gl2gh` - Run migrations from GitLab to GitHub _(not yet generally available)_
1516

1617
To use `gh gei` first install the latest [GitHub CLI](https://github.com/cli/cli#installation), then run the command
1718
>`gh extension install github/gh-gei`
@@ -22,6 +23,11 @@ To use `gh ado2gh` first install the latest [GitHub CLI](https://github.com/cli/
2223
To use `gh bbs2gh` first install the latest [GitHub CLI](https://github.com/cli/cli#installation), then run the command
2324
>`gh extension install github/gh-bbs2gh`
2425
26+
To use `gh gl2gh` first install the latest [GitHub CLI](https://github.com/cli/cli#installation), then run the command
27+
>`gh extension install github/gh-gl2gh`
28+
29+
> **Note:** `gh gl2gh` is not yet generally available. The extension repo and releases may not be published yet.
30+
2531
We update the extensions frequently, so make sure you update them on a regular basis:
2632
>`gh extension upgrade github/gh-gei`
2733
@@ -33,6 +39,8 @@ To see the available commands and options run:
3339
3440
>`gh bbs2gh --help`
3541
42+
>`gh gl2gh --help`
43+
3644
### GitHub to GitHub Usage (GitHub.com -> GitHub.com)
3745
1. Create Personal Access Tokens with access to the source GitHub org, and the target GitHub org (for more details on scopes needed refer to our [official documentation](https://docs.github.com/en/migrations/using-github-enterprise-importer/preparing-to-migrate-with-github-enterprise-importer/managing-access-for-github-enterprise-importer)).
3846

@@ -87,6 +95,24 @@ Refer to the [official documentation](https://docs.github.com/en/migrations/usin
8795

8896
Refer to the [official documentation](https://docs.github.com/en/migrations/using-github-enterprise-importer/migrating-repositories-with-github-enterprise-importer/migrating-repositories-from-bitbucket-server-to-github-enterprise-cloud) for more details.
8997

98+
### GitLab to GitHub Usage
99+
1. Create a Personal Access Token for the source GitLab instance (with `api` and `read_repository` scopes) and one for the target GitHub org (for more details on scopes needed refer to our [official documentation](https://docs.github.com/en/migrations/using-github-enterprise-importer/preparing-to-migrate-with-github-enterprise-importer/managing-access-for-github-enterprise-importer)).
100+
101+
2. Set the `GITLAB_PAT` and `GH_PAT` environment variables.
102+
103+
3. Run the `generate-script` command to generate a migration script.
104+
```
105+
> gh gl2gh generate-script --gitlab-server-url GITLAB-SERVER-URL \
106+
--github-org DESTINATION \
107+
--output FILENAME
108+
```
109+
110+
The `--gitlab-server-url` flag accepts both GitLab.com (`https://gitlab.com`) and self-hosted GitLab instances.
111+
112+
4. The previous command will have created a `migrate.ps1` PowerShell script. Review the steps in the generated script and tweak if necessary.
113+
114+
5. The `migrate.ps1` script requires PowerShell to run. If not already installed see the [install instructions](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.2) to install PowerShell on Windows, Linux, or Mac. Then run the script.
115+
90116
### Skipping version checks
91117

92118
When the CLI is launched, it logs if a newer version of the CLI is available. You can skip this check by setting the `GEI_SKIP_VERSION_CHECK` environment variable to `true`.

RELEASENOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added new `gl2gh` CLI (not yet generally available) for migrating GitLab repositories (GitLab.com and self-hosted) to GitHub. Includes `migrate-repo`, `generate-script`, and `inventory-report` along with the standard supporting commands (e.g. `download-logs`, `wait-for-migration`, `abort-migration`, `grant-migrator-role`, `revoke-migrator-role`, `create-team`, `generate-mannequin-csv`, `reclaim-mannequin`). Archives can be uploaded via Azure Blob Storage, AWS S3, or GitHub-owned storage.

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.410",
3+
"version": "8.0.421",
44
"rollForward": "minor"
55
}
66
}

justfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ run-ado2gh *args: build
6060
run-bbs2gh *args: build
6161
dotnet run --project src/bbs2gh/bbs2gh.csproj {{args}}
6262

63+
# Build and run the gl2gh CLI locally
64+
run-gl2gh *args: build
65+
dotnet run --project src/gl2gh/gl2gh.csproj {{args}}
66+
6367
# Watch and auto-rebuild gei on changes
6468
watch-gei:
6569
dotnet watch build --project src/gei/gei.csproj
@@ -72,6 +76,10 @@ watch-ado2gh:
7276
watch-bbs2gh:
7377
dotnet watch build --project src/bbs2gh/bbs2gh.csproj
7478

79+
# Watch and auto-rebuild gl2gh on changes
80+
watch-gl2gh:
81+
dotnet watch build --project src/gl2gh/gl2gh.csproj
82+
7583
# Build self-contained binaries for all platforms (requires PowerShell)
7684
publish:
7785
pwsh ./publish.ps1
@@ -115,19 +123,21 @@ install-extensions: publish-linux
115123
set -euo pipefail
116124
117125
# Create extension directories
118-
mkdir -p gh-gei gh-ado2gh gh-bbs2gh
126+
mkdir -p gh-gei gh-ado2gh gh-bbs2gh gh-gl2gh
119127
120128
# Copy binaries
121129
cp ./dist/linux-x64/gei-linux-amd64 ./gh-gei/gh-gei
122130
cp ./dist/linux-x64/ado2gh-linux-amd64 ./gh-ado2gh/gh-ado2gh
123131
cp ./dist/linux-x64/bbs2gh-linux-amd64 ./gh-bbs2gh/gh-bbs2gh
132+
cp ./dist/linux-x64/gl2gh-linux-amd64 ./gh-gl2gh/gh-gl2gh
124133
125134
# Set execute permissions
126-
chmod +x ./gh-gei/gh-gei ./gh-ado2gh/gh-ado2gh ./gh-bbs2gh/gh-bbs2gh
135+
chmod +x ./gh-gei/gh-gei ./gh-ado2gh/gh-ado2gh ./gh-bbs2gh/gh-bbs2gh ./gh-gl2gh/gh-gl2gh
127136
128137
# Install extensions
129138
cd gh-gei && gh extension install . && cd ..
130139
cd gh-ado2gh && gh extension install . && cd ..
131140
cd gh-bbs2gh && gh extension install . && cd ..
141+
cd gh-gl2gh && gh extension install . && cd ..
132142
133143
echo "Extensions installed successfully!"

0 commit comments

Comments
 (0)