Feedback

Chat Icon

Cloud Native CI/CD with GitLab

From Commit to Production Ready

Consice, Reusable and Refactored Definitions
25%

Multiple Inheritance with "extends"

It's possible to extend multiple sections in a job using the extends keyword. This is useful when you want to combine configurations from different sections. Here is an example:

stages:
  - test

.base_definition:
  stage: test
  image: alpine:latest

.before_after_scripts:
  before_script:
    - echo "Setting up the environment..."
  after_script:
    - echo "Cleaning up..."

test:
  extends:
    - .base_definition
    - .before_after_scripts
  script:
    - echo "Running tests for test1..."

The resulting test will look like this:

test:
  stage: test
  image: alpine:latest
  before_script:
    - echo "Setting up the environment..."

Cloud Native CI/CD with GitLab

From Commit to Production Ready

Enroll now to unlock all content and receive all future updates for free.