5

I have gitlab CI/CD defined through .gitlab-ci.yml.

It runs different jobs if the pipeline is triggered manually, from a merge request or from a scheduled pipeline.

It accepts a bunch of environment variables used to modify some job behaviors or launch specific jobs (for example for developers to build debug images).

When I change .gitlab-ci.yml I currently have to run manual tests triggering the pipelines in all possible ways with all the different variables to ensure I have no regression.

Do I have a way to automate that? Is there other CI/CD tools that allow that?

2 Answers 2

1

You should use CI lint. See this to simulate your CI/CD pipeline and validate when you make changes to the yml file - https://docs.gitlab.com/ee/ci/lint.html

1
  • I do not want to check syntax. I want to control that depending on the environment variables, the jobs are created correctly. in the lint tool I cannot specify environment variables (or secrets) when I check 'simulate a pipeline for the default branch' and as a result nothing runs.
    – John Doe
    Mar 25, 2022 at 10:45
0

This is where using Terraform or some other Infrastructure as Code tool can really help. You could on a merge, create a test environment and then run through the various deployments to that environment. If you have some sort of acceptance tests built-in, you can verify that the builds/deployments still work, and that the code still functions. After the tests are done, you can teardown the test environment and proceed to deploy normally.

Another option would be to build a pipeline that triggers these builds you need to test. So when you change this root file -> trigger one "build" that causes all of the dependent builds to fire.

1
  • what i want to test is not the build output but that the build pipeline is itself created correctly. e.g. if this env var is set it should trigger this command, etc..
    – John Doe
    Jan 2, 2023 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.