#Pipeline -> With()? (how to support sequencing?)

1 messages ยท Page 1 of 1 (latest)

mystic yew
#

I was just thinking about this problem today actually, would love to solve it. It makes it impossible to do something like "build the container image" and then "run tests using container image". For example this pipeline group is totally confusing because the test steps end up nested beneath the import ... pipeline.

I don't remember what exactly the With() proposal was though. ๐Ÿ˜…

mystic yew
#

Pipeline -> With()? (how to support sequencing?)

cold cobalt
#

I wish I could find the text I wrote summarizing the proposal and why it's the perfect proposal

#

I think it was a spin-off of another DX discussion

cold cobalt
#

The short version is that .Pipeline conflates chaining with nesting

#
  • Chaining: do foo, then do bar, then do baz
  • Nesting (option 1): do foo (by doing bar), then do baz
  • Nesting (option 2): do foo (by doing bar, then doing baz)
#

.Pipeline cannot tell those apart, which is bad

#

My proposal is to add a description argument to With

#
  • Before: foo.Pipeline("bar").bar
  • After: foo.With("bar", bar)
#

Basically With already gives us nesting. All that we're missing is a label to go with it

#

(I also think we could rename With while we're at it - but leaving that out for simplicity)

cold cobalt
#

I wonder if the With() proposal couldn't be the solution? If you rename it to Step() and add a mandatory name and description, then it starts looking like a different grouping method, with cleaner delineation between nesting (the contents of the callback) and sequencing (chaining).

dag.
Step("build", func(_ dagger.Client) error {
// Build step goes here
}).
Step("test", func(_ dagger.CLient) error {
// Test step goes here
})

Is this a dumb idea?

cold cobalt
#

I'm going to open an issue for this, to facilitate future conversations

cold cobalt