WIP: script to migrate an org on gitea #42

Draft
zramsay wants to merge 1 commits from mirror-org into main
Member

Setup:

#cloud-init
runcmd:
- export CERC_REPO_BASE_DIR=/home/ubuntu
- laconic-so --stack build-support build-containers
- laconic-so --stack package-registry setup-repositories
- laconic-so --stack package-registry build-containers
- laconic-so --stack package-registry deploy up
- echo "127.0.0.1 gitea.local" >> /etc/hosts

Then:

  • go to IP:3000 and login with gitea_admin/admin1234
  • create a new org with the identical value as any GitHub org: i.e., <org> for below
  • create a new token with scope repo
  • set these env vars:
export CERC_GITEA_AUTH_TOKEN=<your_token>
export CERC_GITEA_API_URL=gitea.local:3000
export CERC_GITEA_MIRROR_REPO=true

then, ssh into the server and run ./hosting/gitea/migrate-org.sh <org>

Refresh IP:3000 for that org, notice the mirrored repos.

Limitations:

  • limited to the first 100 repos of an org ... appears to be a GH API pagination / limit issue. ChatGPT tried to help by suggesting the GitHub GraphQL API, which came with its own set of snags (e.g., you have to be a member of the org & include a token in the request)
  • mirroring users is incomplete/undocumented
Setup: ``` #cloud-init runcmd: - export CERC_REPO_BASE_DIR=/home/ubuntu - laconic-so --stack build-support build-containers - laconic-so --stack package-registry setup-repositories - laconic-so --stack package-registry build-containers - laconic-so --stack package-registry deploy up - echo "127.0.0.1 gitea.local" >> /etc/hosts ``` Then: - go to IP:3000 and login with `gitea_admin/admin1234` - create a new org with the identical value as any GitHub org: i.e., `<org>` for below - create a new token with scope `repo` - set these env vars: ``` export CERC_GITEA_AUTH_TOKEN=<your_token> export CERC_GITEA_API_URL=gitea.local:3000 export CERC_GITEA_MIRROR_REPO=true ``` then, ssh into the server and run `./hosting/gitea/migrate-org.sh <org>` Refresh IP:3000 for that org, notice the mirrored repos. Limitations: - limited to the first 100 repos of an org ... appears to be a GH API pagination / limit issue. ChatGPT tried to help by suggesting the GitHub GraphQL API, which came with its own set of snags (e.g., you have to be a member of the org & include a token in the request) - mirroring users is incomplete/undocumented
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin mirror-org:mirror-org
git checkout mirror-org
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/hosting#42
No description provided.