@@ -18,10 +18,8 @@ To get the most of this page, you should have already set up your
1818[ build integration] and read the more
1919[ high-level document on running ClusterFuzzLite] .
2020
21- ## Gitlab runner
22- The following examples use a ` docker ` gitlab runner running sibling containers:
23- See this [ doc] ( https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-socket-binding )
24- for more information.
21+ The following documentation is primarily meant for Gitlab.com with the use of shared runners.
22+ It works also for self-managed Gitlab instances.
2523
2624## .gitlab-ci.yml
2725For basic ClusterFuzzLite functionality, all you need is a single job
@@ -38,24 +36,24 @@ To enable more features, we recommend having different jobs for:
3836To add a fuzzing job that fuzzes all merge requests to your repo, add the
3937following default configurations to ` .gitlab-ci.yml ` :
4038
41- This configuration requires at least GitLab 13.3 to be run.
39+ For self-managed Gitlab instances, this configuration requires at least GitLab 13.3 to be run.
4240With older versions, the ` parallel ` keywords does not exist, but you can define ` SANITIZER ` as a Gitlab CI variable.
4341
4442{% raw %}
4543``` yaml
4644variables :
4745 SANITIZER : address
4846 CFL_PLATFORM : gitlab
49- DOCKER_HOST : " tcp://docker:2375"
50- DOCKER_IN_DOCKER : " true"
47+ DOCKER_HOST : " tcp://docker:2375" # may be removed in self-managed Gitlab instances
48+ DOCKER_IN_DOCKER : " true" # may be removed in self-managed Gitlab instances
5149
5250
5351clusterfuzzlite :
5452 image :
5553 name : gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:v1
5654 entrypoint : [""]
5755 services :
58- - docker:dind
56+ - docker:dind # may be removed in self-managed Gitlab instances
5957
6058 stage : test
6159 parallel :
@@ -80,7 +78,8 @@ clusterfuzzlite:
8078` ` `
8179{% endraw %}
8280
83- You may also wish to set [tags](https://docs.gitlab.com/runner/#tags) to select a relevant runner.
81+ For self-managed Gitlab instances, you may also wish to set [tags](https://docs.gitlab.com/runner/#tags)
82+ to select a relevant runner.
8483
8584Optionally, edit the following variables to customize your settings:
8685- ` SANITIZER` Select sanitizer(s)
@@ -106,7 +105,7 @@ clusterfuzzlite-corpus:
106105 name: gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:v1
107106 entrypoint: [""]
108107 services:
109- - docker:dind
108+ - docker:dind # may be removed in self-managed Gitlab instances
110109 stage: test
111110 rules:
112111 - if: $MODE == "prune"
@@ -127,6 +126,9 @@ In one, you should set the variable `MODE` to `batch` to run the actual batch fu
127126In the other, you should set the variable `MODE` to `prune` for corpus pruning once a day.
128127These schedules should target the main/default/`CFL_BRANCH` branch.
129128
129+ Note that you can also use gitlab-ci.yml [extends](https://docs.gitlab.com/ee/ci/yaml/#extends)
130+ keyword to avoid duplicating most of the common parameters between the different type of jobs.
131+
130132![gitlab-schedule-mode]
131133
132134# ## Continuous builds
@@ -148,7 +150,7 @@ clusterfuzzlite-build:
148150 name: gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:v1
149151 entrypoint: [""]
150152 services:
151- - docker:dind
153+ - docker:dind # may be removed in self-managed Gitlab instances
152154 stage: test
153155 rules:
154156 # Use $CI_DEFAULT_BRANCH or $CFL_BRANCH.
@@ -179,7 +181,7 @@ clusterfuzzlite-coverage:
179181 name: gcr.io/oss-fuzz-base/clusterfuzzlite-run-fuzzers:v1
180182 entrypoint: [""]
181183 services:
182- - docker:dind
184+ - docker:dind # may be removed in self-managed Gitlab instances
183185 stage: test
184186 variables:
185187 SANITIZER: "coverage"
@@ -202,6 +204,30 @@ This schedule should target the main/default/`CFL_BRANCH` branch.
202204
203205# # Extra configuration
204206
207+ # ## Gitlab runners on self-managed Gitlab instances
208+
209+ The previous examples used [Docker in docker](https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker)
210+
211+ From a performance point of view, it is recommended to use a `docker` gitlab runner running sibling containers :
212+ See this [doc](https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-socket-binding)
213+ for more information.
214+
215+ To do so, if you have such a runner ready, you simply need to remove the following lines from the configuration :
216+ {% raw %}
217+ ` ` ` yaml
218+ variables:
219+ DOCKER_HOST: "tcp://docker:2375" # may be removed in self-managed Gitlab instances
220+ DOCKER_IN_DOCKER: "true" # may be removed in self-managed Gitlab instances
221+
222+ services:
223+ - docker:dind # may be removed in self-managed Gitlab instances
224+ ` ` `
225+
226+ Note that it should be possible to achieve the same functionality using a shell
227+ executor, though this is unsupported.
228+ In that case, the `.gitlab-ci.yml` will different. For one you must explicitly
229+ call the `docker` commands on ClusterFuzzLite images.
230+
205231# ## Gitlab filestore
206232
207233You can use the variable `FILESTORE : gitlab` to use Gitlab artifacts for storing
@@ -232,11 +258,15 @@ git repository for storage.
232258You need to create a project access token for this repository, with
233259` read_repository` and `write_repository` rights.
234260
261+ You can also use a personal access token if you do not have access to
262+ project access token, due to your Gitlab license.
263+
235264![gitlab-project-token]
236265
237266And this token should be used from the fuzzed repository as a CI/CD variable.
238267You can name this variable as you like, in the following example it is named
239268` CFL_TOKEN` . This variable should be defined as masked to avoid leaks.
269+ It should not be protected if you need it on unprotected branches.
240270
241271![gitlab-variable-token]
242272
@@ -267,12 +297,6 @@ This job will build a static web site with everything which is in the `public` d
267297You may then access the site at `https://baseurl/coverage/latest/report/linux/report.html` where
268298` baseurl` is the domain you configured for your GitLab pages.
269299
270- # # Shell executor
271- Note that it should be possible to achieve the same functionality using a shell
272- executor, though this is unsupported.
273- In that case, the `.gitlab-ci.yml` will different. For one you must explicitly
274- call the `docker` commands on ClusterFuzzLite images.
275-
276300[GitLab] : https://about.gitlab.com/
277301[build integration] : {{ site.baseurl }}/build-integration/
278302[high-level document on running ClusterFuzzLite] : {{ site.baseurl }}/running-clusterfuzzlite/
0 commit comments