I have a matrix job which creates 4 concurrent jobs, this is causing problems and I would rather not split these jobs for sake of cleaner code, is it possible to force a matrix job to run all pipelines sequentially and one after the other.
- infra_market_apply:
name: infra-apply-web-app-<< matrix.market >>-staging
matrix:
parameters:
market: [
“uk”,
“ca”,
“fr”,
“in”
]
environment: [“staging”]
infra_directory: [“web-app”]
context: maverick-aws
requires:
- infra-check
this config creates four concurrent jobs uk,ca,fr,in
i need these to run sequentially rather than in parallel?
also is it possible to declare this array only once somewhere and not repeat it all over the config?
[
“uk”,
“ca”,
“fr”,
“in”
]
I’ve not used the matrix support so can not comment on how to have a matrix processed sequentially rather than in parallel. This is in part because I use a single self-hosted runner so in my configuration everything currently is handled sequentially regardless of how I express things.
From past answers, I think you will find that the current matrix feature is hard-coded to take the values and turn them into parallel jobs.
I can provide some background regarding being able to declare something just once - which is often referred to as DRY (Don’t repeat yourself).
CircleCI does not provide direct support for what you are looking for instead its scripts can use a yaml feature that CircleCI inheritance from the environment it operates in.
but a more general search of the internet can provide better/clearer examples.