In GitLab, where does a project's pipeline configuration come from, and what runs when the repository has no .gitlab-ci.yml?
answer
- the repository root, by default
- one project setting can move it
- path@group/project or a .yml URL
- no file: Auto DevOps, maybe
- needs a Dockerfile or buildpack
basics
~20 sGitLab reads .gitlab-ci.yml from the repository root unless the project's CI/CD configuration file setting names another path, another project's file or a .yml URL. With no file, only Auto DevOps can run, if enabled and it finds a Dockerfile or buildpack.
solid answer
~50 sBy default GitLab looks for `.gitlab-ci.yml` in the root of the repository at the commit being built. The project's **CI/CD configuration file** setting (under the general pipeline settings) can point elsewhere: a path relative to the root such as `ci/pipeline.yml`, a file in another project written `path@group/project` (read from that project's default branch unless you append `:refname`), or a full URL that ends in `.yml`. Jobs see the chosen path in `CI_CONFIG_PATH`. When the project has no configuration file at all, nothing runs unless Auto DevOps is on — through **Default to Auto DevOps pipeline** on the project, inherited from its group, or switched on for every project by an instance administrator — and Auto DevOps only runs automatically when it finds a `Dockerfile` or a matching buildpack. A real `.gitlab-ci.yml` always takes precedence over Auto DevOps.
go deeper
Know that GitLab reads .gitlab-ci.yml from the repository root by default, and that a project can have no pipeline at all if that file is missing.
Explain the three forms the CI/CD configuration file setting accepts, how CI_CONFIG_PATH reports the choice, and the exact conditions under which Auto DevOps runs instead.
Show you can find where an inherited project's pipeline really comes from — moved file, another project, external URL, inherited Auto DevOps — and weigh the trust cost of each source.
Discuss when separating pipeline ownership from code ownership is worth the friction, and why moving the file is not the same as enforcing jobs across an organisation.
## The default: a file in the repository A GitLab **pipeline** is created from a **CI/CD configuration file**, a YAML document that lists the jobs to run. Unless someone changes a setting, GitLab looks for a file named `.gitlab-ci.yml` in the **root directory** of the repository, at the exact commit the pipeline is for. That has two useful consequences: - The configuration is **versioned with the code**: a branch that changes the build also changes the pipeline that tests it. - A branch can change its own pipeline, and the change is tested on that branch before it reaches the default branch. The predefined variable `CI_CONFIG_PATH` tells a running job which path was used; it defaults to `.gitlab-ci.yml`. What the file may contain (jobs, stages, `include:` of other files and so on) is a separate subject, covered with the GitLab CI keywords; this answer is about where GitLab reads it from. ## Moving the file: the CI/CD configuration file setting Each project has a **CI/CD configuration file** field in its general pipeline settings. It accepts three forms: | Form | Example | Read from | |---|---|---| | Path in this repository | `my/path/.my-custom-file.yml` | this project, relative to the root | | File in another project | `.gitlab-ci.yml@acme/ci-config` | that project's default branch, or `...@acme/ci-config:refname` | | External file | `https://config.example.com/generate/ci/config.yml` | the URL, which must end in `.yml` | Teams usually move the file for one of two reasons: 1. **A tidier repository** — the configuration lives under a `ci/` folder with its helpers. 2. **Separating who may edit the pipeline from who may edit the code** — the file sits in a separate project where only a few people have write access, while other projects can read it but not change it. The second pattern has costs. The project's **pipeline editor** cannot edit a configuration file that lives in another project or on an external site, so changes go through the other project's own review. An external URL means the pipeline definition is fetched from outside GitLab at pipeline creation, so whoever controls that URL controls what your jobs run. And the setting itself belongs to the project: it moves the file, it does not on its own stop the project from being pointed elsewhere. Forcing jobs into every project's pipeline is a different mechanism, covered with GitLab CI templates and policies. ## When there is no file: Auto DevOps **Auto DevOps** is GitLab's ready-made pipeline that detects the language, builds, tests, scans and can deploy. It only matters when a project has **no** configuration file: - It is switched on with **Default to Auto DevOps pipeline**, per project (Maintainer or Owner), per group (Owner; subgroups and projects inherit it and can opt out), or for every project on an instance with **Default to Auto DevOps pipeline for all projects** (an administrator setting). - It **runs automatically only if** the repository has a `Dockerfile` or code that matches a buildpack. - If a `.gitlab-ci.yml` exists, **your configuration takes precedence** and the Auto DevOps pipeline does not run. - Without deployment preparation (a base domain and a deployment target), it can build and test but cannot deploy. - GitLab can **switch Auto DevOps off** for a project on its own. The documented causes are that the setting was only inherited from a group or the instance rather than enabled in the project, that the project has no successful Auto DevOps pipelines, and that an Auto DevOps pipeline failed. Enabling it in the project itself and fixing the failing pipeline is the remedy. A project that wants Auto DevOps plus its own jobs writes a `.gitlab-ci.yml` that includes the Auto DevOps template; at that point it is an ordinary configuration file and the setting no longer decides anything. ## When nothing runs at all Two situations leave a project with no pipelines: - **No configuration file and no Auto DevOps** (or Auto DevOps on but nothing it can detect). - **CI/CD turned off** for the project in its visibility and feature settings. The CI/CD menu, the pipelines and jobs pages disappear; existing pipelines are hidden, not deleted, and come back if CI/CD is turned on again. ## Reading a project you have just inherited When you take over a set of projects, the quickest audit is: does each one have a root `.gitlab-ci.yml`, does its **CI/CD configuration file** setting point somewhere else, and is Auto DevOps enabled on the project, a parent group or the instance? A pipeline nobody can find in the repository usually comes from one of the last two.
- In GitLab, what changes for a project's developers when its CI/CD configuration file lives in a separate project?They can no longer change the pipeline from their own repository or its pipeline editor; edits go through the configuration project, with its own write permissions and review. GitLab reads the file from that project's default branch unless the setting appends `:refname`, so a change there affects every pipeline that points at it from then on.
- In GitLab, can a project use Auto DevOps and its own .gitlab-ci.yml together?Yes, but only by making Auto DevOps part of its own file: the project's `.gitlab-ci.yml` includes the `Auto-DevOps.gitlab-ci.yml` template and adds or overrides jobs. The **Default to Auto DevOps pipeline** setting only decides what happens when there is no configuration file, so once the file exists the setting has no effect.
- GitLab runs any YAML file it finds anywhere in the repository.
- The configuration file must always be .gitlab-ci.yml in the repository root.
- Auto DevOps runs alongside a project's own .gitlab-ci.yml pipeline.
- Auto DevOps builds any project, even with no Dockerfile or matching buildpack.
- Turning off CI/CD for a project deletes its existing pipelines.