GitLab Tutorial — Biogitflow 1.1.1 Documentation

biogitflow Logo 2.0.1

Contents:

  • Introduction
  • Development workflow
  • Nominal procedure
  • Hotfix procedure
  • Git tutorial
  • GitLab tutorial
    • Create a new project in Gitlab
      • Add the new projet
      • Add the templates for the issues and merge requests
      • Create the branches
      • Set the default branch
      • Set the protected branches
      • Set the protected tags
      • Add a set of labels for the issues
      • Add members to the project
      • Configure GitLab-CI
        • Disable the Shared runners
        • Increase the timeout of gitlab-ci jobs
    • Create a Merge Request in Gitlab
      • Add a new Merge Request
      • Set the source branch
      • Set the target branch
      • Add a description using the Merge Request template
      • Assign the Merge Request to a user with the Maintainer role
      • Add a label
      • Link the Milestone
      • Set the option to delete the branch after the merge
      • Submit the Merge Request
      • Review and merge of the Merge Request by the Maintainer
  • Schedule an operational testing periodically in GitLab CI/CD
  • Exercises
biogitflow
  • »
  • GitLab tutorial
  • View page source
GitLab tutorial¶

Create a new project in Gitlab¶

We recommend that the project is created from the biogitflow template or you can follow the procedure below.

Add the new projet¶

  • Select Projects in the upper left menu

_images/gitlab_projects.png
  • Click on gitlab_new-project-button

  • Link your project to a group (if needed)

_images/gitlab_newproject_group.png
  • Give a name and a description to your new project

  • Check that the Visibility Level is set to Private

  • Select the option Initialize repository with a README

Add the templates for the issues and merge requests¶

  • Clone the new project:

git clone git@gitlab.com:biogitflow/biogitflow-demo.git cd biogitflow-demo
  • Create the hidden folder .gitlab:

mkdir .gitlab
  • Copy the content of the directory biogitflow templates such that the .gitlab folder contains the following folders:

issue_templates merge_request_templates
  • Push the templates on the main branch on the remote repository:

git add .gitlab git commit -m "[ADD] templates for issues and merge requests" git push origin main

Create the branches¶

  • Click in the Repository menu in the left panel, in order to create the release, hotfix and devel branches from the main branch

    • Click on the New branch button:

    gitlab-newbranch

    • in the form, fill Branch name = devel and Create from = main

    gitlab-newproject-branch-devel

    • Iterate the same procedure twice to create:

    • the release branch

    • the hotfix branch

Set the default branch¶

  • Click in the Settings menu in the left panel, select the Repository sub-menu, then click on the Default Branch button to expand the section:

_images/gitlab_default_branch.png
  • Select Default branch = devel in the scrolling menu and click on the Save changes button:

_images/gitlab_default_branch_devel.png

Set the protected branches¶

  • Click in the Settings menu in the left panel, select the Repository sub-menu, then click on the Protected Branches button to expand the section:

_images/gitlab_protected_branches.png
  • Protect the release branch such that only the users with the Maintainers role can push and merge:

    • In the form select Branch = release, Allowed to merge = Maintainers and Allowed to push = Maintainers, then click on the Protect button:

_images/gitlab_protect_branch_release.png
  • Check that main, hotfix and release branches are protected

_images/gitlab_3protected_branches.png

Set the protected tags¶

The use of the tags is reserved to the user with the Maintainer role.

  • Click in the Settings menu in the left panel, select the Repository sub-menu, then click on the Protected Tags button to expand the section:

_images/gitlab_protected_tags.png
  • In the fields Tag, add * and then click on Create wildcard *

_images/gitlab_wildcard_protected_tags.png
  • Check that the field Allowed to create is set to Maintainers and then click on the Protect button:

_images/gitlab_button_protected_tags.png

Add a set of labels for the issues¶

  • Click in the Issues menu in the left panel, select the Labels sub-menu

  • It is possible that some labels already exist if the project has been created inside a group for which some labels have been already set (using the Promote to Group Label functionality for example)

  • If there is no label, then click on Generate a default set of labels:

_images/gitlab_default_labels.png
  • Create the labels need by biogitflow documentation that are not in the default set:

_images/gitlab_new_label.png
  • Create the new labels label_validation for the Validation of a new release by the end-users:

_images/gitlab_add_label_validation.png
  • Create the new label label_mep for the Deployment in the production environment:

    _images/gitlab_add_label_production.png
  • Check that all the labels required by biogitflow documentation are available:

    • label_enhancement

    • label_bug

    • label_validation

    • label_mep

Add members to the project¶

  • Click in the Settings menu in the left panel, select the Members sub-menu

    • by default, all the members of the group have access to the new project

    • if needed, add additional members with their specific role

    _images/gitlab_add_members.png

Configure GitLab-CI¶

If you use GitLab-CI to deploy the pipeline, some configuration may be required. In our infrastructure, we have to apply the settings described below.

Disable the Shared runners¶

For each pipeline GitLab repository, the sys admin has to setup a runner (which is implemented using rootless podman container). It is important to check that the Shared runners are disabled. In order to check the runner configuration:

  • go to Settings > CI/CD

  • expand the Runners section

The configuration should look like this:

_images/gitlab-ci-runner-config.png

Increase the timeout of gitlab-ci jobs¶

Some job may take some time:

  • the job which builds the containers

  • the job which launches the test on the pipeline

  • the jobs which submit task on slurm (which may be queued for a while)

Therefore, it is important to change the timeout. In your project:

  • go to Settings > CI/CD

  • expand the General pipeline section

  • set Timeout to 1d

  • Save changes

    _images/gitlab-ci-runner-timeout.png

Create a Merge Request in Gitlab¶

Add a new Merge Request¶

  • Click in the Merge Requests menu in the left panel:

_images/gitlab_new_merge_request.png

Set the source branch¶

MR-sourcebranch

Set the target branch¶

MR-targetbranch

Add a description using the Merge Request template¶

_images/gitlab_merge_request_template.png

Assign the Merge Request to a user with the Maintainer role¶

MR-assign

Add a label¶

The default label in the Merge Request template is label_bug. Change it if needed:

MR-label

Link the Milestone¶

Whenever available, link the Merge Request to the relevant Milestone:

MR-milestone

Set the option to delete the branch after the merge¶

MR-removebranch

Submit the Merge Request¶

Click on Submit merge request.

Review and merge of the Merge Request by the Maintainer¶

The Maintainer reviews the Merge Request and click on Merge:

MR-accept

Tag » Add Branch Gitlab