gitlab

Gitlab

What is Gitlab?

Definition:
GitLab is a web-based Git repository manager that helps Software Development Teams to collaborate on software projects by providing a platform for version control, collaboration, and continuous integration.

Gitlab is a crucial component in the software development pipeline. As a part of the software pipeline, Gitlab primarily functions as a Git repository manager facilitating the control of source code (aka Version Control System). Beyond being a Distributed-VCS Gitlab, as does most Git repository management systems,
seamlessly integrates with other components of the software development pipeline by providing features such as continuous integration, continuous deployment, issue tracking, and code review. This integration streamlines the development process, allowing DEV-teams to manage their source code, automate the testing and deployment of the software, tracking issues (more below), and to collaborate on source code changes within a 'unified' environment

Key Features

  1.  Git Repository Management : allows users to create, manage and collaborate on software projects. It also provides users the ability to define a granular permissions schema for accessing and using the repositories
  2.  Continuous Integration/Continuous Deployment (CI/CD) : With built-in CI/CD pipelines, GitLab automates the testing and deployment processes, ensuring code quality and efficient delivery. CI stands for Continuous Integration and CD for Continuous Delivery
  3.  Issue Tracking : Issues let you track your work (feature requests, bug reports...) where development happens
  4.  Code Review : collaborative code quality review
  5.  Wiki and Documentation : for keeping technical documentation in the same project as your code, one might use the wiki GitLab
  6.  Collaboration Tools : Features like Code Review, Merge Request Approval allow, e.g. teams to work in distributed and asynchronous environments, to manage source code changes and version remotely and to track approvals of proposed changes.

Different Usage of GitLab

Version Control

  1.  Tracks changes to source code over time: GitLab's version control system enables tracking of changes, managing branches, and merging contributions for promoting a streamlined development workflow.
  2.  Facilitates collaboration among developers: The Collaboration is enhanced, as multiple developers can work on the same project concurrently, with GitLab managing version conflicts and promoting a controlled access to the assets of the project.
     

Continous Integration 

  1.  Automates the building, testing, and deployment of code: GitLab's CI/CD tools automate building, testing, and (in some cases at PSI) deployment, reducing manual errors and accelerating the development lifecycle.
  2.  Ensures code quality and reduces manual errors: Developers can easily monitor and analyze CI pipeline results (of running and past jobs) to ensure the stability and reliability of their code
     

Issue Tracking

  1.  Manages and tracks tasks, bugs, and feature requests, ideally related to the development of an application or system: At PSI, the default issue tracking tool for projects is JIRA. Gitlab Issues Tracker is a simple issue tracker for managing your issues on a per-project basis.
    Although it is not as advanced as a solution like JIRA, it can be very useful and flexible if used to follow the work as close as possible to the code. It is also possible to cross-reference Jira issues while working with GitLab issues and merge requests.
  2.  Enhances collaboration among team members: By associating issues with specific code changes, developers can maintain a clear connection between problem-solving and code development.
     

Code Review

  1.  Facilitates collaborative code reviews for quality assurance: GitLab's code review feature facilitates the collaboration among team members by providing a media for constructive feedback and improving the source code quality.
  2.  Improves codebase through feedback and suggestions: Through merge requests and discussions, developers can efficiently review and refine code changes before merging them into the main codebase. The codebase can be further improved by defining appropriates Approval rules. One can, for instance, define the number of approvals a merge request must receive before it can be
    merged, and also which users should do the approving, and so hardened the review of code changes.

How to access and use GitLab

Accessing Gitlab

Our GitLab service provides two instances: an internal and external. It is recommended to primarily use the internal instance for all workloads due to its default adhoc status. Additionally, it offers shared runners for building GitLab pages. It is especially crucial to switch to the internal instance when the code contains sensitive data, including comments and source code, ensuring a secure environment for such information. However, the external instance should be exclusively utilized when collaborating with other institutes, ensuring a dedicated environment for collaborative efforts beyond the internal scope. Both instances can currently be accessed by anyone owing a valid PSI Account.

Accessing GitLab by external users incurs associated costs (for the PSI) that should be taken into consideration. It is important to evaluate the financial implications of external access, as these costs may impact the service budget. Read Only Users consume a seat. Additionally, the project's visibility should also be a factor in decision-making, as an inappropriate visibility might expose project details to a broader audience. Weighing these considerations will help ensure an informed and cost-effective approach to utilizing GitLab for external collaboration.
 

Creating a Project

After successfully logging in, users can create a new project within GitLab, establishing a dedicated space for code development, collaboration, and documentation.

As a good practice, it is recommended not to create projects under an individual's personal namespace in GitLab. Instead, consider either joining an existing group or creating a new group for the project. Group-based organization enhances collaboration, simplifies access control, and provides a more structured environment for managing multiple projects. Projects created under a user's namespace e.g. gitlab.psi.ch/username are considered private and when the user leaves PSI, no transfer of permissions will be possible.

 

Accessing Git Repository

  1.  Clone the repository using Git command line or a Git client.
  2.  Access the repository through the web interface. The web interface also allows users to explore repositories, view code history, and manage branches.

 

CI/CD Setup

  1.  Configure CI/CD pipelines for automated testing involves defining automated workflows for building, testing, and deploying code changes. Mostly by editing the gitlab-ci.yml file
  2.  Users can easily monitor pipeline results through the GitLab interface, gaining insights into the success and status of automated processes.

 

Issue Tracking and Collaboration

  1.  Create, assign and manage issues for tasks and bugs.
  2.  Merge requests and discussions foster communication and collaboration among team members during the code review process.

 

Accessing Documentation and Wiki

  1.  Utilize the wiki and documentation features for project technical information.
  2.  Collaborative editing features allow team members to contribute to and update project documentation, ensuring it remains accurate and up-to-date and in sync with
    the source code.