|
|
---
|
|
|
title: Migrate GitLab projects and groups from Forgemia to Cirad
|
|
|
---
|
|
|
- Context: https://forge-inrae.pages.mia.inra.fr/www/post/
|
|
|
-
|
|
|
- ## Procedure guidelines
|
|
|
- Re-create groups at Cirad
|
|
|
- For each group
|
|
|
- Transcribe group parameters
|
|
|
- Group Description
|
|
|
- Group Avatar
|
|
|
- For each project in Forgemia
|
|
|
- Export project and download export file (`Settings > General > Advanced`)
|
|
|
- Alternatively, make a direct transfer
|
|
|
- This is possible for public projects.
|
|
|
- For private or internal projects you need the user name and a PAT
|
|
|
`famuvie Mfrk3upQH1jVnyeNpjzF`
|
|
|
- Import project from file in Cirad (`New Project > Import > From GitLab export`)
|
|
|
- Make a direct transfer
|
|
|
- Import project from URL in Cirad (`New Project > Import > Repository by URL`)
|
|
|
- This is possible for public projects (use the `https://` URL)
|
|
|
- For private or internal projects you need the user name and a PAT
|
|
|
`famuvie Mfrk3upQH1jVnyeNpjzF`
|
|
|
- Alternatively, export project and download export file (`Settings > General > Advanced`)
|
|
|
- Import project from file in Cirad (`New Project > Import > From GitLab export`)
|
|
|
- Transcribe project parameters that were not exported
|
|
|
- Projec avatar
|
|
|
- Project topics (tags and keywords) - no accents allowed in Cirad
|
|
|
- Deprecate the Forgemia repo
|
|
|
- Edit the project description to:
|
|
|
`This repository moved to <url>`
|
|
|
- Archive the project (`Settings > General > Advanced > Archive project`)
|
|
|
- Visibility parameters of the project and of GitLab pages, if any.
|
|
|
- Update the URLs in the local repository
|
|
|
- Rename the old origin
|
|
|
```bash
|
... | ... | @@ -43,57 +44,51 @@ title: Migrate GitLab projects and groups from Forgemia to Cirad |
|
|
User git
|
|
|
```
|
|
|
But I think it is not necessary.
|
|
|
- __If the project is a R package__
|
|
|
collapsed:: true
|
|
|
- Fix URLs in package files
|
|
|
```bash
|
|
|
sed -i 's/umr-astre\.pages\.mia\.inra\.fr/astre\.gitlab\.cirad\.fr/g' DESCRIPTION
|
|
|
sed -i 's/forgemia.inra.fr\/umr-astre/gitlab\.cirad\.fr\/astre/g' DESCRIPTION
|
|
|
sed -i 's/install_github("Cirad-ASTRE\/<projectname>")/install_gitlab("astre\/<projectname>", host = "gitlab.cirad.fr")/g' README.Rmd
|
|
|
```
|
|
|
- Update package web site
|
|
|
```bash
|
|
|
Rscript -e "pkgdown::build_site()"
|
|
|
```
|
|
|
- Push changes
|
|
|
```bash
|
|
|
git add .
|
|
|
git commit -m "Migrate to Cirad"
|
|
|
git push
|
|
|
```
|
|
|
- __If GitLab pages is enabled__
|
|
|
collapsed:: true
|
|
|
- Create a new tracking branch off `old-origin/main` (or `master`)
|
|
|
```bash
|
|
|
git checkout -b deprecate-forgemia --track old-origin/main
|
|
|
```
|
|
|
- Substitute the contents of `public/index.html` with:
|
|
|
```html
|
|
|
<!DOCTYPE html>
|
|
|
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
|
|
|
<head>
|
|
|
<meta http-equiv="Refresh" content="0; url='https://astre.gitlab.cirad.fr/<projectname>/'">
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
<meta charset="utf-8">
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>Redirect to new website</title>
|
|
|
- </head>
|
|
|
<body>
|
|
|
- This site moved to <a href="https://astre.gitlab.cirad.fr/<projectname>/">https://umr-astre.pages.mia.inra.fr/<projectname>/</a>
|
|
|
- </body>
|
|
|
</html>
|
|
|
```
|
|
|
- Push changes
|
|
|
```bash
|
|
|
git add .
|
|
|
git commit -m "Migrate to Forgemia"
|
|
|
git push -f --set-upstream old-origin deprecate-github:master
|
|
|
```
|
|
|
- Revert to branch `main`
|
|
|
```bash
|
|
|
git checkout main
|
|
|
```
|
|
|
- __If alternative CI/CD systems (Travis-CI, Appveyor) are in use__
|
|
|
collapsed:: true
|
|
|
- Update the continuous integration systems of the repository |
|
|
\ No newline at end of file |
|
|
- __If the project is a R package__
|
|
|
collapsed:: true
|
|
|
- Fix URLs in package files
|
|
|
```bash
|
|
|
sed -i 's/umr-astre\.pages\.mia\.inra\.fr/astre\.gitlab\.cirad\.fr/g' DESCRIPTION
|
|
|
sed -i 's/forgemia.inra.fr\/umr-astre/gitlab\.cirad\.fr\/astre/g' DESCRIPTION
|
|
|
sed -i 's/install_github("Cirad-ASTRE\/<projectname>")/install_gitlab("astre\/<projectname>", host = "gitlab.cirad.fr")/g' README.Rmd
|
|
|
```
|
|
|
- Update package web site
|
|
|
```bash
|
|
|
Rscript -e "pkgdown::build_site()"
|
|
|
```
|
|
|
- Push changes
|
|
|
```bash
|
|
|
git add .
|
|
|
git commit -m "Migrate to Cirad"
|
|
|
git push
|
|
|
```
|
|
|
- __If GitLab pages is enabled__
|
|
|
- Uncheck `Deploy > Pages > Settings > Use unique domain`
|
|
|
- Create a new tracking branch off `old-origin/main` (or `master`)
|
|
|
```bash
|
|
|
git checkout -b deprecate-forgemia --track old-origin/main
|
|
|
```
|
|
|
- Change the build script for pages to write a redirect file
|
|
|
```yaml
|
|
|
- mkdir public
|
|
|
# Redirect to forge Cirad
|
|
|
# https://docs.gitlab.com/ee/user/project/pages/redirects.html#splats
|
|
|
- echo '/<project-slug>/* https://astre.gitlab.cirad.fr/<project-slug>/:splat 301' > public/_redirects
|
|
|
```
|
|
|
- Push changes
|
|
|
```bash
|
|
|
git add .gitlab-ci.yml
|
|
|
git commit -m "Migrate to forge Cirad."
|
|
|
git push -f --set-upstream old-origin deprecate-forgemia:main # (or master)
|
|
|
```
|
|
|
- Revert to branch `main` (or `master`)
|
|
|
```bash
|
|
|
git checkout main # (or master)
|
|
|
```
|
|
|
- __If alternative CI/CD systems (Travis-CI, Appveyor) are in use__
|
|
|
collapsed:: true
|
|
|
- Update the continuous integration systems of the repository
|
|
|
- Deprecate the Forgemia repo
|
|
|
- Edit the project description to:
|
|
|
`This repository moved to <url>`
|
|
|
- Archive the project (`Settings > General > Advanced > Archive project`) |
|
|
\ No newline at end of file |