Skip to content

Commit 6b81f53

Browse files
committed
Merge branch 'jenkins-update-docs' into 'master'
Add Groovy vs. YAML section to CI Jenkins doc See merge request gitlab-org/gitlab-ce!31601
2 parents 95075fe + 926b2d1 commit 6b81f53

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

doc/ci/jenkins/index.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,34 @@ There are some high level differences between the products worth mentioning:
3030
- GitLab comes with a [container registry](../../user/project/container_registry.md), and we recommend using
3131
container images to set up your build environment.
3232

33+
## Groovy vs. YAML
34+
35+
Jenkins Pipelines are based on [Groovy](https://groovy-lang.org/), so the pipeline specification is written as code.
36+
GitLab works a bit differently, we use the more highly structured [YAML](https://yaml.org/) format, which
37+
places scripting elements inside of `script:` blocks separate from the pipeline specification itself.
38+
39+
This is a strength of GitLab, in that it helps keep the learning curve much simpler to get up and running
40+
and avoids some of the problem of unconstrained complexity which can make your Jenkinsfiles hard to understand
41+
and manage.
42+
43+
That said, we do of course still value DRY (don't repeat yourself) principles and want to ensure that
44+
behaviors of your jobs can be codified once and applied as needed. You can use the `extends:` syntax to
45+
[templatize your jobs](../yaml/README.md#extends), and `include:` can be used to [bring in entire sets of behaviors](../yaml/README.md#include)
46+
to pipelines in different projects.
47+
48+
```yaml
49+
.in-docker:
50+
tags:
51+
- docker
52+
image: alpine
53+
54+
rspec:
55+
extends:
56+
- .in-docker
57+
script:
58+
- rake rspec
59+
```
60+
3361
## Artifact publishing
3462
3563
Artifacts may work a bit differently than you've used them with Jenkins. In GitLab, any job can define

0 commit comments

Comments
 (0)