.gitlab-ci.yml Part Eight – Basics Of Include Extends Pages

.gitlab-ci.yml Part Eight – Basics Of Include Extends Pages

.gitlab-ci.yml Part Eight – Basics Of Include Extends Pages

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed .gitlab-ci.yml features like interruptible, resource_group and trigger.

https://cloudaffaire.com/gitlab-ci-yml-part-seven-basics-of-interruptible-resource-group-trigger/

In this blog post, we will discuss .gitlab-ci.yml features like include, extends and pages.

include:

Using the include keyword, you can allow the inclusion of external YAML files. include requires the external YAML file to have the extensions .yml or .yaml, otherwise the external file will not be included. The files defined in include are deep merged with those in .gitlab-ci.yml. and always evaluated first and merged with the content of .gitlab-ci.yml, regardless of the position of the include keyword.

  • include:local: include:local includes a file from the same repository as .gitlab-ci.yml. It’s referenced using full paths relative to the root directory (/).
  • include:file: To include files from another private project under the same GitLab instance, use include:file. This file is referenced using full paths relative to the root directory (/).
  • include:template: include:template can be used to include .gitlab-ci.yml templates that are shipped with GitLab.
  • include:remote: include:remote can be used to include a file from a different location, using HTTP/HTTPS, referenced by using the full URL. The remote file must be publicly accessible through a simple GET request as authentication schemas in the remote URL is not supported.

Note: include also supports nested includes, which allow you to compose a set of includes. A total of 100 includes is allowed. Duplicate includes are considered a configuration error.

extends:

extends defines entry names that a job that uses extends is going to inherit from. It is an alternative to using YAML anchors and is a little more flexible and readable. extends supports multi-level inheritance, however it is not recommended to use more than three levels. The maximum nesting level that is supported is 10.

pages:

pages is a special job that is used to upload static content to GitLab that can be used to serve your website. It has a special syntax, so the two requirements below must be met:

  • Any static content must be placed under a public/ directory.
  • artifacts with a path to the public/ directory must be defined.

Hope you enjoyed this article. In the next blog post, we will continue our discussion .gitlab-ci.yml.

To get more details on GitLab you can follow the below link.

https://docs.gitlab.com/ee/README.html

To Get more details on Git you can follow the below links.

https://cloudaffaire.com/category/devops/git/

https://git-scm.com/doc

 

Leave a Reply

Close Menu