Monorepo - initial branch build

Hey, so we’re just reading through the docs for creating a pipelines with a monorepo

Assuming we have the following structure:


Assuming the glob expressions are configured to run pipelines for each “service” directory… how would we run builds for ALL service folders when a new branch is created and no files have changed?

Hello and welcome to the Codefresh community

Can you explain a bit your usecase? I mean, if no files have changed, then why run a pipeline at all?

If you already have individual pipelines for each service then you can always create a “master” pipeline which is parent to all using the Codefresh run step.

HI @Kostis - thanks for the welcome.

The use case is, a developer creates a new branch of the parent repository, we want a complete application (all services in the parent repo to run their pipelines) to be deployed, from that point on, every commit to the new branch would use glob/folder builds to only re-build and deploy the changed services.

This obviously worked using a commit trigger with a monolith but since the shift to a monorepo and having glob/folder based builds for each service, we trying to find an elegant way to run that initial “build all” when a new branch is created.

I see

You didn’t specify how exactly you deploy your apps, so I assume you have a classic push based deployment pipeline.

The cleanest way would be to use ArgoCD/Codefresh GitOps since it can monitor a single git repo and automatically update any number of services according to the paths specified. So if you point it at an empty environment it will deploy all apps that are “missing” (so in your case all services). See GitOps Deployments · Codefresh | Docs for more details.

So we mostly suggest using monorepos only for code compilation/packaging instead of deployments as shown in the docs Git Triggers · Codefresh | Docs

The big limitation in general is that the “modified files” information is coming from the Git provider. It is not something that Codefresh controls. To my knowledge, if you only a create a branch, then “modified files” is completely empty.

If you simply want to use temporary/preview environments you might find this interesting

To answer your original question I can think of two workarounds

A. Simply create a master pipeline that calls all the child ones and deploys everything. Call this pipeline manually when you create a branch for the whole repo.

B. Add another folder to your repo like this


and setup monorepo support for the all folder to call this master pipeline. You can have a dummy file in the “all” folder that you update when you want to update everything.

But I would strongly suggest you take a look at ArgoCD/Codefresh GitOps. It is designed explicitly for deployments.

Alternatively you could also open a ticket with support (from the top-right menu in the Codefresh UI). Maybe our support team has seen this scenario before and might have additional suggestions.