Skip to main content

This component executes test in component catalogs. It executes child pipelines as unit or end to end tests isolated from your main pipeline. In addition it will lint the test pipeline against the GitLab pipeline linter.

Variables

NamerequiredHints
CI_UNIT_TEST_TEMPLATE---Is injected with the value of the current tested template e.g. templates/my-component/test.yaml into the environment

Usage

  • Create a new component my-component in your new component catalog project my-catalog that needs testing
  • Create a new pipeline file templates/my-component/test.yaml including a usage example
include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/components/my-catalog/my-component@$CI_COMMIT_SHA
inputs:
parameter-01: true
parameter-02: "string"
  • Add a test component to your main pipeline file templates/my-component/test.yml including a usage example
include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@$CI_COMMIT_SHA
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/test-component@$CI_COMMIT_SHA
inputs:
stage: test
name: test-my-catalog
template: 'templates/my-component/test.yml'

Inputs

NameDescriptionDefaultType
------------
allow-failureIf true, the job will not fail the pipeline if it failsfalseboolean
nameThe name of the jobstring
needsThe jobs that this job depends on.[]array
projectThe project to test$CI_PROJECT_PATHstring
rulesThe jobs that this job depends on.[{"if":"$CI_PIPELINE_SOURCE == \"schedule\"","when":"never"},{"if":"$CI_COMMIT_TAG","when":"never"},{"if":"$CI_PIPELINE_SOURCE == \"merge_request_event\"","when":"on_success"},{"when":"on_success"}]array
stageThe name of the stageteststring
strategyThe trigger strategymirrorstring
templateThe name of the template for the teststring
versionThe version of the component to test. Usually a branch name or tag. Defaults to the commit hash.$CI_COMMIT_SHAstring