Summary and Setup
In this lesson you will learn how to run jobs that require a CMS-specific software stack and how to access protected files in GitLab CI using the GitLab installation at CERN. We will use the use case of running CMS software (CMSSW) jobs as an example.
Basic understanding of the purpose of GitLab CI and of its use. Basic understanding of using and developing in CMSSW.
- “Special GitLab CVMFS runners are required to run CI jobs that need CVMFS, e.g. to run CMSSW.”
- “If the setup script tries to access unset variables, then that can cause the CI to fail when using strict shell scripting checks.”
Software Setup
To work with CERN GitLab CI/CD, you need to have Git installed on your local machine and set up SSH keys for secure communication with the GitLab server.
Adding Your SSH Key to CERN GitLab
To push code to your GitLab repository using SSH, you need to add your public SSH key to your CERN GitLab account.
Step 1: Check for an existing SSH key
Open a terminal and run:
If the file exists, you already have an SSH key. If not, generate one with:
Press Enter to accept the default file location and set a passphrase if you wish.
Step 3: Add the SSH key to CERN GitLab
- Go to CERN GitLab SSH Keys page.
- Paste your public key into the Key field.
- Optionally, add a title (e.g., “My Laptop”).
- Click Add key.
You can now use SSH to interact with your GitLab repositories.
Create a New GitLab Project to Follow Along
To get the most out of this tutorial, create your own GitLab project and follow each step hands-on.
Step 1: Create a new project on GitLab
- Go to GitLab CERN New Project.
- Click “Create blank project”.
- Enter a project name, for example:
cmsdas-gitlab-cms. - In Project URL, ensure it reads something like
gitlab.cern.ch/YOUR_USERNAME/cmsdas-gitlab-cms. - Set the project visibility. The default Private is fine for this tutorial.
- Click “Create project”.
Step 2: Clone your new project locally
We recommend working in a directory called cmsdas in
your home folder. Replace ${USER} with your CERN username
if it differs from your local username.
BASH
mkdir -p ~/nobackup/cmsdas #### ~/nobackup for cmslpc users
cd ~/nobackup/cmsdas
git clone ssh://git@gitlab.cern.ch:7999/${USER}/cmsdas-gitlab-cms.git
cd cmsdas-gitlab-cms
You are now ready to start adding files and configuring your project.