Changes
Page history
git: all-in-one import command (
#41215
)
authored
Apr 15, 2024
by
anarcat
Show whitespace changes
Inline
Side-by-side
howto/git.md
View page @
390a0188
...
@@ -310,32 +310,40 @@ although that one doesn't use the proper verb tenses
...
@@ -310,32 +310,40 @@ although that one doesn't use the proper verb tenses
### TPA part: lock down the repository and add redirections
### TPA part: lock down the repository and add redirections
This part handles the server side of things. It will install a
This part handles the server side of things. It will import the
`pre-receive`
hook in the Git repository to forbid pushes,
repository to GitLab, optionally archive it, install a
`pre-receive`
redirections in the Git web interfaces, and document the change in
hook in the Git repository to forbid pushes, redirections in the Git
Gitolite.
web interfaces, and document the change in Gitolite.
This one fabric command should do it all:
fab -H cupani.torproject.org \
gitolite.migrate-repo \
--name "$PROJECT_NAME" \
--description "$PROJECT_DESCRIPTION"
--issue-url=$ISSUE_URL
--import-project \
$GITOLITE_REPO \
$GITLAB_PROJECT \
WARNING: it assumes the repository has already been migrated! If you
Example:
are migrating a TPA repository, or migrating a third party repository,
you can do the actual migration with this command:
fab gitlab.create-project \
fab -H cupani.torproject.org \
-p $GITLAB_PROJECT \
gitolite.migrate-repo \
--name "$GITLAB_PROJECT_NAME" \
--name "letsencrypt-domains" \
--import-url https://git.torproject.org/$GITOLITE_REPO.git \
--description "torproject letsencrypt domains"
--description "Archive from Gitolite: $GITOLITE_DESCRIPTION"
--issue-url=https://gitlab.torproject.org/tpo/tpa/team/-/issues/41574 \
--import-project \
admin/letsencrypt-domains \
tpo/tpa/letsencrypt-domains \
If the repository is to be archived
in GitLab, also provide the
If the repository is to be archived
, you can also pass the
`--archive`
`--archive`
flag.
flag.
For example, this is an actual run:
### Manual procedures
fab gitlab.create-project \
NOTE: This procedure is deprecated and replaced by the above "all in
-p tpo/tpa/dip \
one" procedure.
--name "dip" \
--import-url https://git.torproject.org/admin/services/gitlab/dip.git \
--archive \
--description "Archive from Gitolite: Ansible recipe for running dip from debian salsa"
The procedure is this simple two-step process:
The procedure is this simple two-step process:
...
@@ -382,51 +390,25 @@ The following changes are done by the Fabric task:
...
@@ -382,51 +390,25 @@ The following changes are done by the Fabric task:
repo debian/torproject-keyring
repo debian/torproject-keyring
> That said, it *should* be possible to automate the import from
We were then manually importing the repository in GitLab with:
> gitolite. For now, the manual procedure for TPA repositories is:
>
fab gitlab.create-project \
> 1. visit the [project import page](https://gitlab.torproject.org/projects/new#import_project)
-p $GITLAB_PROJECT \
>
--name "$GITLAB_PROJECT_NAME" \
> 2. enter the project URL, something like:
--import-url https://git.torproject.org/$GITOLITE_REPO.git \
>
--description "Archive from Gitolite: $GITOLITE_DESCRIPTION"
> https://git.torproject.org/$GITOLITE_PROJECT
>
If the repository is to be archived in GitLab, also provide the
> 3. pick a project name, verify the project slug matches
`--archive`
flag.
>
> 4. pick the project namespace (hint: `tpa` will autocomplete to
For example, this is an actual run:
> `tpo/tpa`)
>
fab gitlab.create-project \
> 5. hit <kbd>Create</kbd>
-p tpo/tpa/dip \
>
--name "dip" \
> 6. once the import complete, if requested, archive the repository
--import-url https://git.torproject.org/admin/services/gitlab/dip.git \
> by going to Settings -> General (Advanced) -> Expand -> Archive
--archive \
> Project
--description "Archive from Gitolite: Ansible recipe for running dip from debian salsa"
>
> 7. change the `.mrconfig` in [tpo/tpa/repos.git](https://gitlab.torproject.org/tpo/tpa/repos.git) to point to the
> new repository
>
> Alternatively, the [create project API has an `import_url` field](https://docs.gitlab.com/ee/api/projects.html#create-project)
> which could be used to automate the above.
>
> Another way to do this, from the command-line, would be:
>
> 1. clone the repository
>
> git clone https://git.torproject.org/$GITOLITE_PROJECT
>
> 2. push to GitLab ([creating a private project](https://docs.gitlab.com/ee/user/project/#create-a-new-project-with-git-push))
>
> git remote set-url origin https://gitlab.torproject.org/$GITLAB_PROJECT
>
> 3. adjust the project's privacy setting (making it public, most
> likely)
>
> 4. optionally archive the GitLab project
>
> 5. change the `.mrconfig` in [tpo/tpa/repos.git](https://gitlab.torproject.org/tpo/tpa/repos.git) to point to the
> new repository
>
> Steps 4 and 5 would require GitLab API access.)
## Migration to other servers
## Migration to other servers
...
...
...
...