Jor-El
Jor-El

Reputation: 437

How to import a yml file based on condition?

Present we kept multiple pipelines in separate yml files and all of them are included in the mail ci yml file. using include statements.

Is there anyway to make it conditional.

Like I will have pipeline1 and pipeline2 yaml files.

So I can create another pipeline.yml where I can choose among the above two files based on some condition.

Upvotes: 2

Views: 228

Answers (1)

Novikov
Novikov

Reputation: 720

Gitlab is designed for deterministic pipelines, all other solutions add-on that looks implicit.

Web service

Include in .gitlab-ci.yml link to the web server, which could be a dynamically generated yml file.

include:
  - 'https://your-service.com/gitlab-ci-generate' 

Unfortunately, It's not possible to use CI variables in link to server. gitlab issue link

Dynamic child pipelines

You have complete control of the pipeline. Write a simple bash script, which renames your pre-pushed .yml files and executes that pipeline.

Upvotes: 1

Related Questions