README.md 2.54 KB
Newer Older
Florian Hindenlang's avatar
Florian Hindenlang committed
1
2
3
# Getting started
This is a project to get started on the gitlab CI for compiling and testing code.

Florian Hindenlang's avatar
Florian Hindenlang committed
4
5
6
7
The master branch has a very rudimentary `.gitlab-ci.yml` file to build the project once.

You find the  branches `testlevel*`  with increasing test complexity in the script `.gitlab-ci.yml`.

Florian Hindenlang's avatar
Florian Hindenlang committed
8
Important things:
Florian Hindenlang's avatar
Florian Hindenlang committed
9
-  Explanations of the YAML syntax of the file **.gitlab-ci.yml** [found here](https://docs.gitlab.com/ce/ci/yaml)
Florian Hindenlang's avatar
Florian Hindenlang committed
10
- commits to not check: add `[CI skip]` in the commit message
11
- you can disable the email notifications under your personal notification settings in the gitlab
Florian Hindenlang's avatar
Florian Hindenlang committed
12

Florian Hindenlang's avatar
Florian Hindenlang committed
13

Florian Hindenlang's avatar
Florian Hindenlang committed
14
## Setup a local runner:
15
16
17
18
19
- Installation of a local runner [found here](https://docs.gitlab.com/runner/install/) be sure to install the version ~~<= 1.11.4~~   
  compatible with the mpcdf gitlab version (which is 9.1.4 since 15.05.2017), a compatibility chart can be 
  [found here](https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/README.md)  
  `sudo apt-get install gitlab-ci-multi-runner`  
  or, for installing a specific version, `sudo apt-get install gitlab-ci-multi-runner=1.11.4` 
Florian Hindenlang's avatar
Florian Hindenlang committed
20
21
- After installation of the runner, execute **in your home directory**  
  `gitlab-runner register`  
Florian Hindenlang's avatar
Florian Hindenlang committed
22
  follow the steps with the url and token given on the `Settings->CI/CD pipeline` of your project on the gitlab page
Florian Hindenlang's avatar
Florian Hindenlang committed
23
24
- then start the runner  
  `gitlab-runner run`  
Florian Hindenlang's avatar
Florian Hindenlang committed
25
  You should see the runner on the gitlab page  `Settings->CI/CD pipeline`
Florian Hindenlang's avatar
Florian Hindenlang committed
26

Florian Hindenlang's avatar
Florian Hindenlang committed
27
## Tags:
Florian Hindenlang's avatar
Florian Hindenlang committed
28
A tag or a list of tags allows to choose on which runner the job will be executed.
Florian Hindenlang's avatar
Florian Hindenlang committed
29

Florian Hindenlang's avatar
Florian Hindenlang committed
30
The use of tags is recommended, use at least one tag for the job, corresponding to the tag(s) of the runner. 
Florian Hindenlang's avatar
Florian Hindenlang committed
31

Florian Hindenlang's avatar
Florian Hindenlang committed
32
33
34
Note the following:
1. Each job is assigned to only **one** runner! If you want to execute the same job on another runner,  
   you have to copy the job and change the tag!
Florian Hindenlang's avatar
Florian Hindenlang committed
35
1. If job has no tag
Florian Hindenlang's avatar
Florian Hindenlang committed
36
    - one runner must be configured to run untagged jobs, else the job cannot be executed 
Florian Hindenlang's avatar
Florian Hindenlang committed
37
1. Job has tags
Florian Hindenlang's avatar
Florian Hindenlang committed
38
39
40
    - **all** tags of a job **must match a subset** of the tags of **one** runner

**Careful**, different runners should not have the same tag!
Florian Hindenlang's avatar
Florian Hindenlang committed
41
42
43
44
45
46
47
48
49
50
51
52

Each job can have one or multiple tags, here an example:
```
job_1:
  stage: build
  tags:
    - tag1_runnerA
job_2:
  stage: build
  tags:
    - tag1_runnerB
job_3:
Florian Hindenlang's avatar
Florian Hindenlang committed
53
  stage: test
Florian Hindenlang's avatar
Florian Hindenlang committed
54
55
56
57
58
59
  tags:
    - tag1_runnerA
    - tag2_runnerA
```
- runner A  has the tags `tag1_runnerA` and `tag2_runnerA` ... and therefore runs  `job_1` and `job_3`
- runner B  has the tags `tag1_runnerB` and `tag2_runnerB` ... and therefore runs only `job_2`
Florian Hindenlang's avatar
Florian Hindenlang committed
60
- **Careful**, the tag list of one job should contain only tags of **one** runner!