Home:ALL Converter>How to test a GitLab CI/CD pipeline

How to test a GitLab CI/CD pipeline

Ask Time:2020-06-20T09:26:11         Author:Philipp

Json Formatter

We use GitLab CI/CD on a private GitLab server and maintain a quite complex gitlab-ci.yaml with includes and rules:

  • Some pipeline jobs only run on specific branches
  • Some pipeline jobs only run when specific variables are set
  • Some pipeline jobs are taken from the include without changes
  • Some pipeline jobs are taken from the include, but overwritten in the current file
  • etc.

Currently, our quality assurance steps are:

  • Using the GitLab API to lint the file
  • Building, testing and deploying a test project to test the pipeline roughly (smoke tests)

What we would like to add are unit tests where we can test the behaviour of the pipeline under specific conditions (specific branches, variables, other conditions) so we can ensure that specific settings lead to a specific pipeline configuration. Unfortunately, I was not able to find any information on how to properly test GitLab CI pipelines. How can we do that?

Author:Philipp,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/62480620/how-to-test-a-gitlab-ci-cd-pipeline
yy