CFMM Gitlab repositories

CFMM maintains both a private Gitlab instance at https://git.cfmm.uwo.ca and a public hosted group on https://gitlab.com/cfmm.

https://gitlab.com/cfmm

  • Most CFMM projects are hosted here and this should be the default location for new projects
  • Request assistance setting up new projects.
  • All projects with outside collaborators must be hosted on this public SaaS Gitlab instance.
  • Use the Gitlab project request access feature on the project overview page if you need more than default access to a project.

https://git.cfmm.uwo.ca

  • Restricted to Western users only
  • Access must be requested. Be sure to include your Western account name, supervisor, and reason for requesting access.
  • Repositories requiring access by outside users will be migrated to https://gitlab.com/cfmm

Mirroring https://git.cfmm.uwo.ca projects on https://gitlab.com/cfmm

Mirroring your internal CFMM git project on gitlab.com allows you to use gitlab.com pipeline runners and to share resulting artifacts with gitlab.com users. However generally migrating the entire project to https://gitlab.com/cfmm will be a better option.

These instructions apply to GitLab version 12.8.

Set up mirroring

  1. Create an empty repo on gitlab.com. Note its URL, e.g. https://gitlab.com/cfmm/proj1.

  2. In your internal CFMM git project (e.g. https://git.cfmm.uwo.ca/myusername/proj1):

  • Navigate to Settings -> Repository. Expand the Mirroring Repositories section.

  • URL: ssh://gitlab.com/cfmm/proj1.git, where cfmm/proj1 should be replaced with the location of the project form previous step.

  • Mirror direction: Push. (i.e. you’re pushing from this repo to the gitlab.com repo)

  • Authentication method: SSH Public Key.

  • Click on Mirror repository. An entry appears in a table below, with the URL you entered. Click the Copy SSH public key icon to put it in your clipboard. For more details, see gitlab documentation.

  1. In your gitlab.com project:
  • Navigate to Settings -> CI/CD. Expand the Deploy Keys section.

  • In the Key field, paste the public key you copied in the previous section when you configured repository mirroring. Put something descriptive as a name, e.g. git.cfmm.uwo.ca mirroring key. Make sure you check the Write access allowed checkbox, then Add.

  1. In your intenal CFMM git project:
  • Navigate again to the Mirroring Repositories section of Settings -> Repository.

  • Click the Update now icon located beside the Copy SSH public key icon you previously used.

  1. After a minute or so, the gitlab.com project should be synchronized with the internal CFMM git project.

  2. If you’re setting up CI/CD pipelines, and they will only be running on the gitlab.com project, you should turn off CI/CD on the git.cfmm.uwo.ca project:

  • Navigate to Settings -> General. Expand the Visibility, project features, permissions section.

  • Toggle off the Pipelines section.

Set up a CI pipeline task

This is supplemental documentation to the extensive Gitlab documentation section on CI and pipelines. It explains how a pipeline on gitlab.com will be able to clone private repositories on git.cfmm.uwo.ca (e.g. myuser/myproject1) using deploy tokens.

  1. Create a Deploy Token in myuser/myproject1 on git.cfmm.uwo.ca which you want to clone from gitlab.com
  • Navigate to Settings -> Repository. Expand the Deploy Tokens section.

  • Give a token a descriptive name, or just put the URL of the gitlab.com repo which will be using it.

  • Choose a descriptive username, e.g. gitlab-com-token.

  • Make sure to check read_repository to grant read-only access.

  • Save the password that appears. Also note that this is the one and only time you’ll ever see it. If you lose it, you’ll need to recreate the token.

  1. Save that password into a variable in your gitlab.com project which will run the pipeline:
  • Navigate to Settings -> CI/CD. Expand the Variables section.

  • Add a variable with a descriptive name, e.g. token_password_myuser_myproject1. Toggle the Masked button to ensure that it is not displayed in plaintext in pipeline job logs.

  1. You can now clone myuser/myproject1 on git.cfmm.uwo.ca from gitlab.com by putting the following in your pipeline script. Note that you’re using the variable name and the token username from previous steps, they have to match.

    git clone https://gitlab-com-token:${token_password_myuser_myproject1}@git.cfmm.uwo.ca/myuser/myproject1.git