> ## Documentation Index
> Fetch the complete documentation index at: https://inframan.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Pipelines

> Decide which pushes and pull requests release an application, and run tests, migrations and checks around each release.

A **pipeline** decides when an application releases and what runs around the release. It has a trigger, a Git event and a branch pattern, and up to three lists of steps: before the build, before the deploy and after the deploy.

Pipelines run on Inframan, on your infrastructure. There's no CI file to keep in your repository and no CI service to connect.

## Default pipelines

Each infrastructure gets a pipeline as soon as its CI/CD is ready:

| Infrastructure tag | Pipeline | Trigger |
| - | - | - |
| Non-production | **Development Deploy** | A push to any branch |
| Production | **Production Deploy** | A push to `main` |

When you [create an application](https://inframan.mintlify.site/deploy/create-application.md), you choose which pipelines it uses. A pipeline does nothing for an application until it's linked to it.

## Triggers

| Event | Releases when | The branch pattern matches |
| - | - | - |
| `push` | Commits are pushed | The pushed branch |
| `pull_request` | A pull request is opened or updated | The pull request's head branch |
| `pull_request_merged` | A pull request is merged | The base branch it merged into |

Branch patterns are globs: `main`, `release/*`, `feature-*`. A `*` doesn't match across a `/`, except that a pattern of just `*` matches every branch.

> [!WARNING]
>
> A `pull_request` pipeline releases the pull request's branch into the application itself. It doesn't create a separate preview environment. With the default traffic mode, that release takes all of the application's traffic.

## Steps

| Stage | Where it runs | If it fails |
| - | - | - |
| `pre_build` | Before the image is built, in a container with your repository checked out as its working directory. Good for tests and linting. | The release stops |
| `pre_deploy` | As a Kubernetes Job in the application's namespace, with the service's environment, secrets and connections. Good for database migrations. | The release stops |
| `post_deploy` | As a Kubernetes Job after the service is deployed. Good for smoke tests and notifications. | The release continues |

Each step has:

| Field | Description |
| - | - |
| `name` | Shown on the release's page |
| `image` | The container image to run. Required for `pre_build`. For `pre_deploy` and `post_deploy` it defaults to the service's freshly built image. |
| `commands` | Shell commands, run in order with `sh -c` and joined with `&&`, so the first failure stops the step |
| `timeout` | Seconds before the step is stopped. Defaults to 600. |

## Write a pipeline in YAML

The pipeline editor has a YAML view, and you can export any pipeline as YAML:

```yaml pipeline.yaml theme={null}
name: Development Deploy
description: Test, migrate and release every push
trigger:
  event: push
  branch: "*"
pre_build:
  - name: test
    image: node:22
    commands:
      - npm ci
      - npm test
pre_deploy:
  - name: migrate
    commands:
      - "{{MIGRATE_CMD}}"
post_deploy:
  - name: notify
    image: curlimages/curl:8.10.1
    commands:
      - curl -fsS -X POST "$DEPLOY_WEBHOOK_URL"
```

Here `DEPLOY_WEBHOOK_URL` is one of the service's own secrets, which every `pre_deploy` and `post_deploy` step can read.

Unknown keys are rejected, so a typo is caught when you save.

### Pipeline variables

`{{MIGRATE_CMD}}` above comes from `pipeline_variables` in the application's [`inframan.yaml`](https://inframan.mintlify.site/deploy/inframan-yaml):

```yaml inframan.yaml theme={null}
pipeline_variables:
  MIGRATE_CMD: "npm run migrate"
```

This lets one pipeline serve applications that migrate differently. Variables are substituted in `pre_deploy` and `post_deploy` commands. A `{{NAME}}` with no matching variable is left as it is.

## Manage pipelines

* **Create and edit:** open the infrastructure and click **Pipelines**. Set the **Pipeline name**, the **Event** (**Push**, **Pull Request** or **PR Merged**) and the **Branch pattern**, then add steps around the fixed **Clone Repository**, **Build & Push Image** and **Deploy to Cluster** stages.
* **See an application's pipelines:** open the application and select **Pipelines**. Click **Detach** to stop a pipeline releasing that application.

A connected AI assistant can create, update and link pipelines, and export them as YAML. Deleting a pipeline is only possible in the console.

## Skip a release

Put `[skip inframan]`, `[inframan skip]`, `[skip ci]` or `[ci skip]` in a commit message, and that push doesn't release.

## Watch a release

Every release has a page with each stage and step, its status, duration and logs. It updates live while the release runs. Open it from the application's **Deployments** tab, or from the `inframan/<service>` status check on the commit in GitHub.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.