Skip to content

How Pulumi Delivery works ​

In many organizations, delivery logic lives in standalone pipeline files and manual console steps, spread across tools that run separately from your infrastructure, secrets, and policies. Pulumi Delivery lets you define how a change moves from development through staging to production in the same language you write your infrastructure in, whether that's TypeScript, Python, Go, C#, Java, YAML, or HCL.

Because the pipeline is a Pulumi program, it's versioned and reviewed with your code. You can build it with loops, functions, and conditionals, and it gets previews and a history like any stack.

INFO

Pulumi Delivery is in public preview. Behavior, the SDK, and the REST API routes under /api/preview/ can change before general availability.

Pulumi Delivery needs Pulumi CLI v3.277.0 or later.

Pulumi Delivery inside Pulumi Cloud, promoting a release from your repository through dev, staging, and prod stages to your clouds

An example pipeline ​

This pipeline deploys an app from the acme/shop repository to dev, runs its tests, and then waits for someone to approve the release before it deploys to prod:

typescript
import * as delivery from "@pulumi/delivery";

const repo = new delivery.GitHubSource("repo", {
    repository: "acme/shop",
    branch: "main",
    trigger: { paths: ["app/**", "delivery/**"] },
});

const pipeline = new delivery.Pipeline("shop");

const dev = new delivery.Stage("dev", { pipeline });
new delivery.Stacks("dev", {
    stage: dev,
    stacks: { app: { stack: "shop-app/dev", source: repo, directory: "app" } },
});
new delivery.Job("test", {
    stage: dev,
    source: repo,
    directory: "app",
    command: "npm ci && npm test",
});

const prod = new delivery.Stage("prod", { pipeline, from: [dev], when: delivery.approval() });
new delivery.Stacks("prod", {
    stage: prod,
    stacks: { app: { stack: "shop-app/prod", source: repo, directory: "app" } },
});

Each part of the program maps to a concept on this page:

  • The GitHubSource is a source. Its trigger starts a run when a commit to main changes app/ or delivery/.
  • The Pipeline resource declares the pipeline. The pipeline stack's config says where the pipeline program itself lives: the delivery directory of the same repository.
  • The two Stage resources are the pipeline's stages. prod lists dev in from, so a release reaches prod only after dev succeeds, and its when gate holds the release until someone approves it.
  • Each Stacks resource updates the stacks for its stage, and the Job runs the app's tests in dev, as a job.

Each push that matches the trigger starts a run, which takes the pushed code (the release) through dev and then prod.

Pipeline program ​

The pipeline lives in a repository as a Pulumi project, and it declares exactly one Pipeline resource. You work with it in two ways:

  • Register it with pulumi delivery register. Pulumi Cloud stores the pipeline and listens for changes. Once registered, its triggers start runs in Pulumi Cloud.
  • Run it locally with pulumi up. This is how you can iterate on your pipeline program from your local branch without needing to push your changes.

Register the pipeline ​

To register the pipeline, run pulumi delivery register in the pipeline's project directory.

Registering doesn't start a run. The command writes the pipeline's location in your repository to the stack's delivery:source config. Commit the updated config file so that Pulumi Cloud can find the program. Once registered, a push to the repository's default branch updates the pipeline.

You can specify what service principal or team the pipeline runs as on registration. See Pipeline identity.

Registration checks that Pulumi Cloud can read the pipeline's repository through your organization's version control integration, and that the branch exists. If either check fails, the registration fails.

Run locally ​

Run pulumi up on the pipeline stack to start a run from your checked out branch. The pipeline program runs on your machine, and the stack updates and jobs run in Pulumi Cloud at the latest pushed commit of their sources. The command waits for the run to end and prints a link to it in the Pulumi Cloud console, where the run is marked Local. A stack update or job that hasn't changed since your last pulumi up doesn't run again.

The stack updates and jobs of a local run use your identity, not the pipeline's identity.

A local run differs from a run in Pulumi Cloud:

  • It never changes the registered pipeline. To change the pipeline that runs in Pulumi Cloud, register it or push to its branch.
  • Its release can't be redeployed, rolled back, or force-promoted, and downstream pipelines never read it.
  • It can't be retried, or canceled from the console.

Stages ​

A stage is a phase of the pipeline, for example an environment like dev. A stage runs once its upstream stages have succeeded and its gate, if it has one, has passed. A gate is a rule in the stage's when property, such as a required approval. See Gates.

Stacks ​

A Stacks resource updates one or more existing stacks in a stage. Each entry runs pulumi up on one target stack at the commit the run pinned for its source. The entries in one Stacks resource start together, and stack references between them decide the order, so stacks that depend on each other belong in the same one. See Stacks.

Jobs ​

A Job runs a shell command in a stage, such as a test suite or a script. A job can publish outputs for resources in the same stage or a later stage to read. See Jobs.

Agents ​

An Agent runs one of your custom agents in a stage and returns a structured response that later steps can use. Separately, a decision gate uses TypeSafe's Jev model to evaluate a stage's stack preview and decide whether a release can enter the stage, based on the risk tolerance you define. See Agents and Decision gates.

Runs ​

A run takes one release through the stages. Each run gets its own run stack where Pulumi Cloud executes the pipeline program. A run moves forward in passes. A pass is one execution of the pipeline program on the run stack, and each pass makes as much progress as the stages and gates allow.

Sources and releases ​

A source is a repository and branch. When a run is created, the pipeline fetches the code from each source and pins the run to one commit from each, so that every stage of the run works from the same code. A release is what a run deploys: one commit for each repository source, and one upstream release for each pipeline source. Releases are numbered in order.

A trigger on a source controls whether a change starts a run. See Sources and triggers.

Artifacts ​

An artifact is a named value that a stage publishes for a release once the release reaches it, such as a cluster endpoint or an image tag. Other pipelines read a stage's artifacts with a PipelineSource, which is how one pipeline hands values to the next. See Artifacts.

Next steps ​

Content from the official Pulumi documentation (github.com/pulumi/docs).