Skip to content

docs: Added chainable callbacks guide - #5653

Merged
vikram-dagger merged 3 commits into
dagger:mainfrom
vikram-dagger:docs-50-chain-guide
Aug 22, 2023
Merged

vikram-dagger merged 3 commits into
dagger:mainfrom
vikram-dagger:docs-50-chain-guide

Conversation

@vikram-dagger

Copy link
Copy Markdown
Contributor

This commit adds a new guide on creating and chaining callbacks in a Dagger pipeline. It uses code examples previously shown in #5236 and #3885. It also reuses an existing cookbook example. It also moves the filesystem location of the cookbook code snippets from cookbook/snippets to guides/snippets and adjusts internal references to match.

Signed-off-by: Vikram Vaswani <[email protected]>
@vikram-dagger vikram-dagger self-assigned this Aug 17, 2023
Signed-off-by: Vikram Vaswani <[email protected]>

@TomChv TomChv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Very clear 🚀

@vikram-dagger
vikram-dagger merged commit 5346c90 into dagger:main Aug 22, 2023

## Example

All Dagger SDKs support adding a callback via the `With()` API method. The callback must return a function that receives a `Container` from the chain, and returns a `Container` back to it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it's not an "API" method. It's not in GraphQL, it's added by each SDK in codegen.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone's curious, the method is added to every type that has at least one field that returns the same type (i.e., allows chaining).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants