Difference between revisions of "Gitlab"

From Public PIC Wiki
Jump to navigation Jump to search
Line 25: Line 25:
 
* [https://docs.gitlab.com/ee/user/project/web_ide/index.html Web IDE]
 
* [https://docs.gitlab.com/ee/user/project/web_ide/index.html Web IDE]
 
* [https://docs.gitlab.com/ee/ci/yaml/ CI/CD .yaml file syntax reference]
 
* [https://docs.gitlab.com/ee/ci/yaml/ CI/CD .yaml file syntax reference]
 +
  
 
= Best practices / recommendations =
 
= Best practices / recommendations =
Line 40: Line 41:
  
 
* '''Use git!!''' If you work alone or in a team, use it!
 
* '''Use git!!''' If you work alone or in a team, use it!
* '''Do not upload big binary files to a git repository''' Git is not for data, it is for code. If you still want to do it you can use git LFS.
+
* '''Do not upload big binary files to a git repository''' Git is not for data, it is for code. If you still want to do it you can use git LFS (see above).
Use .gitignore to track only relevant files
+
* '''Use .gitignore to track only relevant files''' [https://git-scm.com/docs/gitignore official docs] and [https://github.com/github/gitignore/tree/main some examples]
Do not track  jupyter notebooks (.ipynb) directly, pair them with a script
+
* '''Do not track  jupyter notebooks (.ipynb)''' pair them with a script using [[JupyterHub#jupytext]]
Do not upload confidential data (NEVER!) passwords, ssh keys, etc will be there forever
+
* '''Do not upload confidential data''' passwords, ssh keys, etc will be there forever

Revision as of 11:02, 3 November 2023

Introduction

Gitlab is a Dev(Sec)Ops platform to handle all the elements in the software development life cycle.

Main features:

  • Git repository management
  • Software development planning
  • Continuous Integration and Continuous Deployment (CI/CD)

The service can be accessed at [1] with your PIC account.

The groups inside gitlab are not synced with the LDAP groups, if you want to have access to some specific group or project in gitlab you have to request it through the application.


Official Gitlab documentation

The official Gitlab documentation can be found here: https://docs.gitlab.com/

Make sure that the documentation you are viewing applies to the Free (Community Edition) distribution and the version deployed at gitlab.pic.es. You can easily find the version number in the Help menu.

The official documentation can be overwhelming, here are some useful links:


Best practices / recommendations

General rules

  • Make small and atomic changes Commit / push often.
  • Use branches for dedicated/long developments
  • Keep the main branch stable the tests should always pass (yes you should have tests!!)
  • Write descriptive commit messages Avoid messages like “changes”, “test” or “.”
  • Adopt a branching strategy gitflow, trunk-based,...
  • Do code reviews if possible Specially if working in a team

Our contributions

  • Use git!! If you work alone or in a team, use it!
  • Do not upload big binary files to a git repository Git is not for data, it is for code. If you still want to do it you can use git LFS (see above).
  • Use .gitignore to track only relevant files official docs and some examples
  • Do not track jupyter notebooks (.ipynb) pair them with a script using JupyterHub#jupytext
  • Do not upload confidential data passwords, ssh keys, etc will be there forever