Difference between revisions of "Gitlab Migration"

From Public PIC Wiki
Jump to navigation Jump to search
Line 1: Line 1:
The gitlab service need to be upgraded to a new version and host.
+
In order to upgrade the gitlab service, it was required to move it to a new host.
It will be migrated from gitlab01.pic.es (running v6.x) to gitlab02.pic.es (running v11.x).
+
The migration of the git repositories from the old host to the new one cannot be done transparently because the previous version has not easy upgrade procedure.
This upgrade cannot be done transparently to the users because the actual version is too old.
 
 
For newer releases, all information will be preserved and the procedure will be done without any user intervention.
 
For newer releases, all information will be preserved and the procedure will be done without any user intervention.
  
 
'''Also, note that for this particular upgrade, all information from tickets, merge requests and wiki WILL NOT BE MIGRATED.'''
 
'''Also, note that for this particular upgrade, all information from tickets, merge requests and wiki WILL NOT BE MIGRATED.'''
If this information is vital to you, please contact us.
 
  
 
In order to migrate your git repositories to the new host, follow these instructions:
 
In order to migrate your git repositories to the new host, follow these instructions:
  
1) If you use want to use SSH authentication, log into https://gitlab02.pic.es with your PIC credentials and upload your SSH keys.
+
1) Log into https://gitlab.pic.es with your PIC credentials
  
2) Execute the following commands on each directory that holds a repository that need migration:
+
2) If you use want to use SSH authentication, you have to upload the corresponding public key. You can access this from the ''Settings'' drop-down menu in the top-left of the screen.
  
     # Create a remote called new_gitlab with the new address of the repository
+
3) For each git repository that you want to migrate, execute the the following commands onto the directory it resides:
     $ git remote add new_gitlab $(git remote -v | awk '{print $2}' | sort -u | sed s/gitlab01.pic.es/gitlab02.pic.es/g)
+
 
 +
     # Update the URL of the repository
 +
     $ git remote set-url origin $(git remote show -n origin | grep "Fetch URL" | awk '{print $3}' | sed s/gitlab01.pic.es/gitlab.pic.es/g)
 
      
 
      
     # Upload the repository to the new remote
+
     # Push everything to new remote
     $ git push new_gitlab --all
+
     $ git push origin --all
     $ git push new_gitlab --tags
+
     $ git push origin --tags
   
+
 
    # Rename the old remote
 
    $ git remote rename origin old_gitlab
 
   
 
    # Rename the new remote
 
    $ git remote rename new_gitlab origin
 
  
 
There will be a 3 month period where both gitlab host will coexist to give time users to migrate.
 
There will be a 3 month period where both gitlab host will coexist to give time users to migrate.

Revision as of 11:57, 13 December 2018

In order to upgrade the gitlab service, it was required to move it to a new host. The migration of the git repositories from the old host to the new one cannot be done transparently because the previous version has not easy upgrade procedure. For newer releases, all information will be preserved and the procedure will be done without any user intervention.

Also, note that for this particular upgrade, all information from tickets, merge requests and wiki WILL NOT BE MIGRATED.

In order to migrate your git repositories to the new host, follow these instructions:

1) Log into https://gitlab.pic.es with your PIC credentials

2) If you use want to use SSH authentication, you have to upload the corresponding public key. You can access this from the Settings drop-down menu in the top-left of the screen.

3) For each git repository that you want to migrate, execute the the following commands onto the directory it resides:

   # Update the URL of the repository
   $ git remote set-url origin $(git remote show -n origin | grep "Fetch URL" | awk '{print $3}' | sed s/gitlab01.pic.es/gitlab.pic.es/g)
   
   # Push everything to new remote
   $ git push origin --all
   $ git push origin --tags


There will be a 3 month period where both gitlab host will coexist to give time users to migrate. After that, gitlab01 will be decomissioned and the gitlab.pic.es alias will point to gitlab02.pic.es. Users shall then update their remotes to point to the alias so that future upgrades can be done transparently.

   # Change the remote called origin with the new address of the repository
   $ git remote set-url origin $(git remote -v | awk '{print $2}' | sort -u | sed s/gitlab02.pic.es/gitlab.pic.es/g)