# create a buildx builder
docker buildx create --use --name builder --driver docker-container --buildkitd-flags '--allow-insecure-entitlement security.insecure'
# create a ssh agent connection your builder can use
eval $(ssh-agent)
# add the target github enterprise key to ssh/scp payload
ssh-add ~/.ssh/id_rsa
# if you need to kill the builder
docker buildx builder rm
Just need to provide the source token (
SOURCE_TOKEN
) and organization(ORGANIZATION
) as env vars.
- Inputs:
- If the local out directory contains a file named
ORGANIZATION
.tar.gz then this is moved inside the container instead of pulling freshly from github cloud.
- If the local out directory contains a file named
- Outputs:
- Expect the
ORGANIZATION
to have been exported toORGANIZATION
.tar.gz within the container.
- Expect the
SOURCE_TOKEN=ghp_tokenabc123 \
ORGANIZATION=trailmix \
docker buildx bake export
Just need to provide the target token (
TARGET_TOKEN
), target user (TARGET_USER
), target hostname (TARGET_HOSTNAME
) and organization(ORGANIZATION
) as env vars.
- Inputs:
- If the local conflicts directory contains a file named
ORGANIZATION
-conflicts.csv then this is moved inside the container instead of checking the mappings. (This is useful if you tried to import and a failure occured and you need to manually edit the mappings.)
- If the local conflicts directory contains a file named
- Deps:
- Run export.
- Outputs:
- Expect the
ORGANIZATION
.tar.gz to move toTARGET_HOSTNAME
with theSSH_AUTH_SOCK
provided overTARGET_SSH_PORT
withTARGET_SSH_USER
.
- Expect the
TARGET_TOKEN=ghp_ENTtokenabc123 \
TARGET_USER=trilom-trailmix \
TARGET_HOSTNAME="github.vms.mud.name" \
ORGANIZATION=trailmix \
docker buildx bake import
Just need to provide the source token (
SOURCE_TOKEN
), target token (TARGET_TOKEN
), target user (TARGET_USER
), target hostname (TARGET_HOSTNAME
) and organization(ORGANIZATION
)
- Deps:
- Outputs:
- Expect the local out directory to contain the
ORGANIZATION
.tar.gz file andORGANIZATION
-conflicts.csv file.
- Expect the local out directory to contain the
- Exceptions:
- If there are conflicts and there was a failure, you can provide a file to override the derived conflicts file in the conflicts/ directory as
ORGANIZATION
-conflicts.csv.
- If there are conflicts and there was a failure, you can provide a file to override the derived conflicts file in the conflicts/ directory as
SOURCE_TOKEN=ghp_tokenabc123 \
TARGET_HOSTNAME="github.vms.mud.name" \
TARGET_USER=trilom-trailmix \
TARGET_TOKEN=ghp_ENTtokenabc123 \
ORGANIZATION=trailmix \
docker buildx bake
## list all repos in all migrations for an org
curl -H "Authorization: Bearer ghp_tokenabc123" -H "Accept: application/vnd.github+json" https://api.github.com/orgs/trailmix/migrations | jq -e '[.[].repositories[].name]' > repo-names.json
curl -H "Authorization: Bearer ghp_tokenabc123" -H "Accept: application/vnd.github+json" https://api.github.com/orgs/trailmix/migrations | jq -e '[.[].id]' > ids.json
# after two files exist, make a bunch of commands to unlock
echo 'jsonencode([for k,v in setproduct(jsondecode(file("ids.json")),jsondecode(file("repo-names.json"))): format("curl -H \"Authorization: Bearer ghp_tokenabc123\" -X DELETE -H \"Accept: application/vnd.github+json\" https://api.github.com/orgs/trailmix/migrations/%s/repos/%s/lock",v[0],v[1])])' | packer console -config-type=hcl2 | jq -r -e '.[]'