
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
You can choose a Kubernetes Job to run your migration workload. This option is great if you have a Kubernetes cluster and you need the migration to run through completely.
The advantages of running jobs and workloads inside Kubernetes are
Without further ado let's step up and perform the repository migration.
When you setup the spreadsheet ensure that it has columns for
Then take the column names and add them to the below configuration file.
The software expects that the main configuration file will be
migrate-configuration.ini~/configuration/migrate-configuration.ini[source] bitbucket.host=bitbucket # this must match the Host directive in ~/.ssh/config bitbucket.port=7999 # which port should the cloning use [destination] github.username=mygithubusername github.access.token=abcdef0123456789fedcba987654321 github.separator=- github.organization=<ORGANIZATION_ID_STRING> github.team.id=<TEAM_ID_INTEGER> [spreadsheet] sheet.filepath=data/team-repo-migration-data.xlsx sheet.column.repository.name="Repository Name" sheet.column.bitbucket.project="BitBucket Project Name" sheet.column.github.prefix="Github Repo Prefix" sheet.column.github.repo.name="Github Repo Name"
The filepath for the spreadsheet is relative to the home directory of the executing user.
What if you want a specific Github repository name rather than being constrained to the prefix plus the bitbucket repository name?
sheet.column.github.repo.name="Github Repo Name"
If you provide the above optional configuration and then create an appropriate column in the spreadsheet, then you can dictate the exact github repository name. This is useful when you want a specific naming convention, or when the bitbucket repository name contains spaces, or when you have capital letters in the source repository name and you want the destination to provide lowercase letters.
Use these API calls to retrieve the Github Team ID integer. The best way to find the team is to use the slugs and remember that teams form a hierarchy.
curl -H "Authorization: token <GITHUB_ACCESS_TOKEN>" https://api.github.com/orgs/<ORGANIZATION_ID_STRING>/teams curl -H "Authorization: token <GITHUB_ACCESS_TOKEN>" https://api.github.com/orgs/<ORGANIZATION_ID_STRING>/teams/<TEAM_SLUG>
The script needs you to be able to connect to bitbucket via SSH. Follow these rules to perform the SSH configuration.
Host directive must match bitbucket.host in the INI configuration fileHostname, User and Port directives~ to prefix the IdentityFile path to keep the script portablePut this config file in the .ssh folder.
Host bitbucket HostName bitbucket-something.com User <lowercase-user-id> Port 7999 IdentityFile ~/.ssh/<private-key-name>.pem StrictHostKeyChecking no
Use forward slashes to run the script in Docker, Kubernetes, MacOs or Linux. Use backslashes if executing from a Windows development environment.
You are ready once you have a kubernetes cluster and you have satisfied the script dependencies (INI configuration file, excel spreadsheet, bitbucket ssh key and ssh config). You are going to set the
Kubernetes SecretKubernetes SecretKubernetes Secret (together with)Kubernetes Secretkubectl create secret generic migration-config --from-file=migrate-configuration.ini kubectl create secret generic migration-sheetkey --from-file=spreadsheet=team-repo-migration-data.xlsx --from-file=ssh-key=bitbucket-private-key.pem kubectl create secret generic migration-sshconfig --from-file=sshconfigkey=config kubectl create -f kubernetes-job-do.yml
Kubernetes keeps the pod alive so we can retrieve the logs until we delete the job. Optionally you can also delete the migrated repositories (the backups will be inside the pod).
kubectl logs -f job/migration-job-do
Also visit the Github interface and assess the quality and quantity of the repository migration.
You delete the destination Github repositories in order to rinse and repeat. The deletion script only removes the repositories it finds - it skips the deletion if the destination repository does not exist.
kubectl create -f kubernetes-job-delete.yml kubectl logs -f job/migration-job-delete
These commands will come in handy at some point.
kubectl describe job/migration-job-do kubectl describe job/migration-job-delete kubectl describe secret/migration-sheetkey kubectl describe secret/migration-sshconfig kubectl describe secret migration-sshfiles kubectl get jobs -o wide kubectl get secrets kubectl get pods -o wide kubectl delete job migration-job-do kubectl delete job migration-job-delete kubectl delete secret migration-config kubectl delete secret migration-sheetkey kubectl delete secret migration-sshconfig
Aside from a local development environment and a kubernetes workload we can also use docker to guarantee a consistent script environment for the migration.
docker runIn order for the docker run to succeed you must ensure that you have mapped the 4 files from their local location to their expected path inside the docker machine.
docker run \ --volume $HOME/path/to/migrate-configuration.ini:/var/opt/migrator/configuration/migrate-configuration.ini \ --volume $HOME/path/to/team-repo-migration-data.xlsx:/var/opt/migrator/data/team-repo-migration-data.xlsx \ --volume $HOME/path/to/config:/var/opt/migrator/.ssh/config \ --volume $HOME/path/to/bitbucket-private-key.pem:/var/opt/migrator/data/bitbucket-private-key.pem \ devops4me/migrator do
docker run \ --volume $HOME/path/to/migrate-configuration.ini:/var/opt/migrator/configuration/migrate-configuration.ini \ --volume $HOME/path/to/team-repo-migration-data.xlsx:/var/opt/migrator/data/team-repo-migration-data.xlsx \ --volume $HOME/path/to/config:/var/opt/migrator/.ssh/config \ --volume $HOME/path/to/bitbucket-private-key.pem:/var/opt/migrator/data/bitbucket-private-key.pem \ devops4me/migrator delete
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务