Changes
Page history
git: all-in-one import command (
#41215
)
authored
Apr 15, 2024
by
anarcat
Hide 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
### TPA part: lock down the repository and add redirections
This part handles the server side of things. It will i
nstall a
`pre-receive`
hook in the Git repository to forbid pushes,
redirections in the Git web interfaces, and document the change in
Gitolite.
This part handles the server side of things. It will i
mport the
repository to GitLab, optionally archive it, install a
`pre-receive`
hook in the Git repository to forbid pushes, redirections in the Git
web interfaces, and document the change in
Gitolite.
WARNING: it assumes the repository has already been migrated! If you
are migrating a TPA repository, or migrating a third party repository,
you can do the actual migration with this command:
This one fabric command should do it all:
fab gitlab.create-project \
-p $GITLAB_PROJECT \
--name "$GITLAB_PROJECT_NAME" \
--import-url https://git.torproject.org/$GITOLITE_REPO.git \
--description "Archive from Gitolite: $GITOLITE_DESCRIPTION"
fab -H cupani.torproject.org \
gitolite.migrate-repo \
--name "$PROJECT_NAME" \
--description "$PROJECT_DESCRIPTION"
--issue-url=$ISSUE_URL
--import-project \
$GITOLITE_REPO \
$GITLAB_PROJECT \
If the repository is to be archived in GitLab, also provide the
`--archive`
flag.
Example:
For example, this is an actual run:
fab -H cupani.torproject.org \
gitolite.migrate-repo \
--name "letsencrypt-domains" \
--description "torproject letsencrypt domains"
--issue-url=https://gitlab.torproject.org/tpo/tpa/team/-/issues/41574 \
--import-project \
admin/letsencrypt-domains \
tpo/tpa/letsencrypt-domains \
fab gitlab.create-project \
-p tpo/tpa/dip \
--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"
If the repository is to be archived, you can also pass the
`--archive`
flag.
### Manual procedures
NOTE: This procedure is deprecated and replaced by the above "all in
one" procedure.
The procedure is this simple two-step process:
...
...
@@ -382,51 +390,25 @@ The following changes are done by the Fabric task:
repo debian/torproject-keyring
> That said, it *should* be possible to automate the import from
> gitolite. For now, the manual procedure for TPA repositories is:
>
> 1. visit the [project import page](https://gitlab.torproject.org/projects/new#import_project)
>
> 2. enter the project URL, something like:
>
> https://git.torproject.org/$GITOLITE_PROJECT
>
> 3. pick a project name, verify the project slug matches
>
> 4. pick the project namespace (hint: `tpa` will autocomplete to
> `tpo/tpa`)
>
> 5. hit <kbd>Create</kbd>
>
> 6. once the import complete, if requested, archive the repository
> by going to Settings -> General (Advanced) -> Expand -> Archive
> Project
>
> 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.)
We were then manually importing the repository in GitLab with:
fab gitlab.create-project \
-p $GITLAB_PROJECT \
--name "$GITLAB_PROJECT_NAME" \
--import-url https://git.torproject.org/$GITOLITE_REPO.git \
--description "Archive from Gitolite: $GITOLITE_DESCRIPTION"
If the repository is to be archived in GitLab, also provide the
`--archive`
flag.
For example, this is an actual run:
fab gitlab.create-project \
-p tpo/tpa/dip \
--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"
## Migration to other servers
...
...
...
...