Before we dive in

We will be using Go for the example pipeline definition.

There are currently two ways to define a Dagger pipeline:

  1. Dagger functions, e.g. a function for each stage (build, test, deploy etc.).
  2. A single Dagger pipeline function that contains all the stages.

Because Dagger functions are still under development as of this writing, we will use the single Dagger pipeline function for the exercises.












Typical Dagger pipeline structure

  1. A pipeline in Go in its simplest form is a single file, e.g. pipeline.go.
  2. The pipeline starts through the entry point function main().
  3. A Dagger client and background context is created. This is what orchestates Docker under the hood and is responsible for building the execution graph.
  4. Pipeline stages are defined. These consist of the code you want to run, e.g. shell commands.











Show me more












How it works

Dagger how it works with OCI


  1. Your Go program imports the Dagger Go library.
  2. Using the Go library, your program opens a new session to a Dagger Engine: either by connecting to an existing engine, or by provisioning one on-the-fly.
  3. Using the Go library, your program prepares API requests describing pipelines to run, then sends them to the engine. The wire protocol used to communicate with the engine is private and not yet documented, but this will change in the future. For now, the Go library is the only documented API available to your program.
  4. When the engine receives an API request, it computes a Directed Acyclic Graph (DAG) of low-level operations required to compute the result, and starts processing operations concurrently.
  5. When all operations in the pipeline have been resolved, the engine sends the pipeline result back to your program.
  6. Your program may use the pipeline's result as input to new pipelines.

Source: https://archive.docs.dagger.io/0.9/sdk/go/



Ok.. Let's continue and start building a pipeline!