In the above example `.gitlab-ci-before-script-template.yml` content will be automatically fetched and evaluated along with the content of `gitlab-ci.yml`.
In the above example `.before-script-template.yml` content will be automatically fetched and evaluated along with the content of `gitlab-ci.yml`.
`include` supports two types of files:
-**local** to the same repository, referenced using the relative path, or
-**remote** in a different location, accessed using HTTP protocol, referenced using the full URL
-**local** to the same repository, referenced using the paths in the same the repository, i.e:
```yaml
# Within the repository
include:'/templates/.gitlab-ci-template.yml'
```
-**remote** in a different location, accessed using HTTP/HTTPS protocol, referenced using the full URL, i.e:
- We can only use files that are currently tracked by Git on the same branch and commit your configuration file is. In other words, when using a **local file** make sure it's on the latest commit of your branch.
- Since external files defined on `include` are evaluated first, the content on `gitlab-ci.yml`**will take precedence over the content of the external files**, for example:
- We can only use files that are currently tracked by Git on the same branch your configuration file is. In other words, when using a **local file** make sure that both, `gitlab-ci.yml` and the local file are on the same branch.
- Since external files defined on `include` are evaluated first, the content on `gitlab-ci.yml`**will always take precedence over the content of the external files, no matters of the position of the `include` keyword, allowing to override values and functions with local definitions**, for example:
```yaml
# Content of http://company.com/default-gitlab-ci.yml
# Content of http://company.com/ruby-autodeploy-template.yml
image:php:5-fpm-alpine
variables:
KUBE_DOMAIN:example.com
job2:
script:php -v
build:
stage:build
script:
-command build
only:
-master
deploy:
stage:deploy
script:
-command deploy
environment:
name:production
url:http://production.example.com
only:
-master
```
```yaml
# Content of gitlab-ci.yml
include:
-http://company.com/default-gitlab-ci.yml
image:ruby:2.1
job1:
script:ruby -v
```
In this case both, `job1` and `job2` will be executed with `ruby:2.1`
In this case, the variable `KUBE_DOMAIN` and the `deploy` job defined on `ruby-autodeploy-template.yml` will override by the ones defined on `gitlab-ci.yml`.