Is there a way to switch CI environments?

Hi folks.

I have several jobs that I want to run in different environments: dev, staging, prod etc.

Is there a way to run the same pipeline for different environments? I.e., to define the environment somewhere in the pipeline or its props and then run the pipeline for it.

So instead of having a pile of:

build_dev: { extends: .build, environment: { name: dev }}
build_staging: { extends: .build, environment: { name: staging }}
build_prod: { extends: .build, environment: { name: prod }}
build_image_dev: { extends: .build_image, environment: { name: dev }}
build_image_staging: { extends: .build_image, environment: { name: staging }}
build_image_prod: { extends: .build_image, environment: { name: prod }}

I would like to have just normal jobs - build, build_image, deploy and define the differences in the CI ENV variables only.

Because all the jobs are just the same in any environment.

Is it possible?

1 Like

Let me bump please

1 Like


1 Like


I believe parallel:matrix will do what you’re looking to do. This blog post may offer some other ideas you can use to accelerate your pipeline.

I hope this helps.

-James H, GitLab Product Manager, Verify:Pipeline Execution


Sorry, colleague, I missed you reply. Many thanks, reading!

1 Like