GitLab CI/CD pipeline reference architectures

We currently have several projects that all have similar pipelines (some parts almost identical, some parts different). We’re looking to restructure to share as many of the steps as possible in a common repository (including the required parts in the pipelines as required).

For example, we have a build-angular step, which, other than directory names, is identical. Our build-dotnet step is identical except for solution names and .NET versions.Docker is just a docker build with the same arguments. The deployment phase is almost identical as well.

Are there examples of enterprise pipelines that have been built, or approximate architectures, that we could follow? I’ve had a look at the templates in (lib/gitlab/ci/templates · master · GitLab.org / GitLab · GitLab).

Some things we’re thinking of:

  • ability to do the same “steps”, but on different .NET versions (ie service1 uses .NET 6, service2 needs .NET 7, etc), is this possible without - include: 'build-.NET6.yaml, include: builfd-.NET7.yaml
  • optional dependencies (if a pipeline includes angular, we need the build-docker step dependent on both the build-angular and build-docker step, but if it also includes Cypress, then the dependencies change.

Or, how have others solved these types of problems?