You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,13 @@
1
-
# FIXME Lesson title
2
-
1
+
# GitLab CI/CD in CMS(SW)
3
2
[](https://swc-slack-invite.herokuapp.com/)
4
3
5
4
This repository generates the corresponding lesson website from [The Carpentries](https://carpentries.org/) repertoire of lessons.
6
5
6
+
> **Note**
7
+
> Click [here](https://oer-particle-physics.github.io/gitlab-cms) for the training website!
8
+
9
+
The aim of this module is to learn how to run CMS software workflows (CMSSW) in a reproducible and secure way using the GitLab installation at CERN.
10
+
7
11
## Contributing
8
12
9
13
We welcome all contributions to improve the lesson! Maintainers will do their best to help you if you have any
@@ -19,15 +23,11 @@ nicely explained in the chapter [Contributing to a Project](http://git-scm.com/b
19
23
by Scott Chacon.
20
24
Look for the tag . This indicates that the maintainers will welcome a pull request fixing this issue.
21
25
22
-
23
26
## Maintainer(s)
24
27
25
28
Current maintainers of this lesson are
26
29
27
-
* FIXME
28
-
* FIXME
29
-
* FIXME
30
-
30
+
*[Clemens Lange](https://clange.ch/)
31
31
32
32
## Authors
33
33
@@ -37,4 +37,9 @@ A list of contributors to the lesson can be found in [AUTHORS](AUTHORS)
37
37
38
38
To cite this lesson, please consult with [CITATION](CITATION)
39
39
40
+
## Open Educational Resources (OER) on Zenodo
41
+
42
+
This lesson is included in the ETH Domain Open Educational Resources for Research Data Management (RDM) community on Zenodo. These resources support researchers, students, and RDM staff in implementing best practices across the research data lifecycle. The materials developed here are published under open licenses (CC BY 4.0) and can be freely reused and adapted for teaching and training initiatives worldwide.
Copy file name to clipboardExpand all lines: _episodes/01-introduction.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
---
2
-
title: "Setting up an environment using CVMFS in GitLab CI (e.g. to run CMSSW)"
2
+
title: "Setting up CMSSW in GitLab CI with CernVM File System (CVMFS)"
3
3
teaching: 10
4
4
exercises: 10
5
5
questions:
6
6
- "Which GitLab runners are needed?"
7
7
- "What's different w.r.t. LXPLUS?"
8
8
objectives:
9
-
- "Know how to source the CMSSW environment"
10
-
- "Understand the different commands that need to be used"
9
+
- "Know how to source the CMSSW environment."
10
+
- "Understand the different commands that need to be used."
11
11
keypoints:
12
12
- "Special GitLab CVMFS runners are required to run CI jobs that need CVMFS, e.g. to run CMSSW."
13
13
- "If the setup script tries to access unset variables, then that can cause the CI to fail when using strict shell scripting checks."
@@ -18,19 +18,19 @@ CI/CD and also CERN-specific information:
18
18
-[GitLab CI/CD documentation][gitlab-ci]
19
19
-[CERN Knowledge Base Articles for the Git Service][snow-git]
20
20
21
-
These pages serve as a good entrypoint in case of problems and questions.
21
+
These pages serve as a good entry point in case of problems and questions.
22
22
23
23
> ## Create a new GitLab project to follow along
24
24
> Please [create a new GitLab project][gitlab-newproject] now to follow along.
25
25
> To do so, select "Create blank project" and provide a project name.
26
-
> You can for instance call it `awesome-gitlab-cms`.
26
+
> You can, for instance, call it `awesome-gitlab-cms`.
27
27
> You need to specify the project visibility level. Private, the default, is fine for this tutorial.
28
-
> In the following, we will assume that all your work is in a directory called `awesome-workshop` in your
29
-
> home directory and we will now clone the newly created project in a local repository therein:
28
+
> In the following, we will assume that all your work is into a directory called `awesome-workshop` in your
29
+
> home directory, and we will now clone the newly created project in a local repository therein:
30
30
> `~/awesome-workshop/awesome-gitlab-cms`
31
31
{: .callout}
32
32
33
-
The commands would look like this (replace `${USER}`by your CERN
33
+
The commands would look like this (replace `${USER}`with your CERN
34
34
username in case it isn't the same as on your laptop):
35
35
36
36
~~~
@@ -43,9 +43,9 @@ cd awesome-gitlab-cms
43
43
44
44
## Choosing the correct GitLab runner
45
45
46
-
We are now going to setup a GitLab CI. For that, we need to create a `.gitlab-ci.yml` file.
46
+
We are now going to set up a GitLab CI. For that, we need to create a `.gitlab-ci.yml` file.
47
47
Standard [GitLab CI runners at CERN](https://gitlab.docs.cern.ch/docs/Build%20your%20application/CI-CD/Runners/)
48
-
do not mount CVMFS, which is required in many cases, for example for setting up CMSSW, to create a grid proxy, or to access LCG software stacks in `/cvmfs/sft.cern.ch/`.
48
+
do not mount CVMFS, which is required in many cases, for example, for setting up CMSSW, to create a grid proxy, or to access LCG software stacks in `/cvmfs/sft.cern.ch/`.
49
49
In order to get a runner that mounts CVMFS, you need
50
50
to add a `tag` to your `gitlab-ci.yml` file:
51
51
@@ -69,7 +69,7 @@ cmssw_setup:
69
69
The `cmssw_setup` line defines the name of the job, and all the job does is
70
70
list `/cvmfs/cms.cern.ch/`, which would fail if CVMFS isn't mounted.
71
71
72
-
To trigger the pipeline we need to commit the file and push it to GitLab:
72
+
To trigger the pipeline, we need to commit the file and push it to GitLab:
73
73
74
74
~~~
75
75
git add .gitlab-ci.yml
@@ -78,12 +78,12 @@ git push
78
78
~~~
79
79
{: .language-bash}
80
80
81
-
If you now navigate the GitLab UI with your browser you will see the CI running and eventually finishing.
81
+
If you now navigate the GitLab UI with your browser, you will see the CI running and eventually finishing.
82
82
You can check the output, and also the `cvmfs` label:
83
83
84
84

85
85
86
-
In the following you'll will learn how to setup a GitLab CI job that runs CMSSW.
86
+
In the following, you'll learn how to set up a GitLab CI job that runs CMSSW.
87
87
88
88
This should be regarded as an example for any CI job requiring access to CVMFS and accessing CMS-restricted files.
89
89
@@ -108,7 +108,7 @@ cmsenv
108
108
~~~
109
109
{: .language-bash}
110
110
111
-
The first command is needed because CMSSW_10_6_30 is pretty old (we chose an old one on purpose!) and it does not have any build for the recent alma9 LXPLUS.
111
+
The first command is needed because CMSSW_10_6_30 is pretty old (we chose an old one on purpose!), and it does not have any build for the recent alma9 LXPLUS.
112
112
So we need to start a CentOS7 container first, which we do with the `cmssw-el7` command, as described in the [CMS singularity guide](https://cms-sw.github.io/singularity.html).
113
113
114
114
Depending on the software version chosen, the third command may print out a warning such as
@@ -150,14 +150,14 @@ of this command is that a few helper functions are defined, such as `cmsrel` and
150
150
151
151
A common pitfall when setting up CMSSW in GitLab is that the execution
152
152
fails because the setup script doesn't follow best practices for shell
153
-
scripts such as returning non-zero return values even if the setup is OK or
154
-
using unset variables. Even if the script exits without visible error message,
153
+
scripts, such as returning non-zero return values even if the setup is OK or
154
+
using unset variables. Even if the script exits without a visible error message,
155
155
there could be something wrong. It is therefore often a good idea to
156
156
circumvent issues like that by disabling strict checks (issuing `set +u`) before running the
157
157
setup command and enabling these checks afterwards again (issuing `set -u`).
158
158
159
159
> ## Exercise: Set up CMSSW in GitLab
160
-
> Knowing all this, can you write the `.gitlab-ci.yml` file to set up CMSSW in GitLab starting from the fragment above and check if this is all working by executing `cmsRun --help` at the end?
160
+
> Knowing all this, can you write the `.gitlab-ci.yml` file to set up CMSSW in GitLab, starting from the fragment above, and check if this is all working by executing `cmsRun --help` at the end?
161
161
{: .challenge}
162
162
163
163
> ## Solution: Set up CMSSW in GitLab
@@ -181,8 +181,8 @@ setup command and enabling these checks afterwards again (issuing `set -u`).
181
181
> ~~~
182
182
> {: .language-yaml}
183
183
>
184
-
> The `image` directive tells the gitlab runner that it should run in a CentOS7 container, just like you would manually do on LXPLUS issuing `cmssw-el7`.
185
-
> The `set +u` command turns off errors for referencing unset variables. It isn't really needed here, since `-u` (i.e. not allowing to use unset variables) isn't set by default, but the script would fail if one used `set -u` somewhere else, so it's safer to catch this here.
184
+
> The `image` directive tells the GitLab runner that it should run in a CentOS7 container, just like you would manually do on LXPLUS issuing `cmssw-el7`.
185
+
> The `set +u` command turns off errors for referencing unset variables. It isn't really needed here, since `-u` (i.e., not allowing to use unset variables) isn't set by default, but the script would fail if one used `set -u` somewhere else, so it's safer to catch this here.
186
186
{: .solution}
187
187
188
188
The reason why in the example above the variable `${CMS_PATH}` is used and not simply
Simply pasting them into GitLab does not work since the line breaks will not
67
-
be reflected correctly. There is a trick we can play though: we can encode the
67
+
be reflected correctly. There is a trick we can play, though: we can encode the
68
68
files including line breaks so that they are simply a string, which we can
69
69
decode to yield the same result as the input. The tool of our choice is
70
70
`base64`. Let's give this a go.
@@ -73,7 +73,7 @@ decode to yield the same result as the input. The tool of our choice is
73
73
>
74
74
> Copy the output of the `cat ~/.globus/usercert.pem` output above into a
75
75
> text file called `testcert.txt`, and pipe the content of this file to the
76
-
> `base64` command or use it as input file directly (hint: `base64 --help`).
76
+
> `base64` command or use it as an input file directly (hint: `base64 --help`).
77
77
>
78
78
{: .challenge}
79
79
@@ -139,12 +139,12 @@ There are a couple of important things to keep in mind when adding passwords
139
139
and certificates as variables to GitLab:
140
140
141
141
- Variables should always be set to `Protected` state.
142
-
- As an additional safety measure, set them as `Masked` as well if possible (this will not work for the certificates but should for your grid password).
142
+
- As an additional safety measure, set them as `Masked` as well if possible (this will not work for the certificates, but should for your grid password).
0 commit comments