| So without actually having read this comment, I ended up getting fairly far along in something similar today. heh. I am currently putting the CPS-transformed code in separate classes a la Docker.groovy and friends, but that may make sense to change towards what you laid out in the future. No big deal either way. Right now, the problem I'm having is a UX problem rather than an implementation problem - well, not that level of implementation, at least. How can I tell that agent label:'foo', docker:'bar' means "Use the Docker Pipeline agent implementation and not the label agent implementation"? Ok, that particular one is simple enough on the face of it - there's a docker key, so therefore... - but when we allow extensions to have any arbitrary key, how do we know that docker here means "Docker Pipeline" and not "Some other Docker implementation"? I can think of at least one way to handle this, but it breaks existing syntax and has a couple different ways we could actually format the syntax:
agent docker: [label:'foo', image:'bar']
// or docker:'bar' instead of image if we want to keep that consistent from the current syntax)
// or
agent docker {
label 'foo'
image 'bar'
}
// or
agent {
docker {
label 'foo'
image 'bar'
}
}
In all cases, the top-level key docker corresponds to a Symbol on the descriptor for the Docker Pipeline implementation. Michael Neale, Stephen Connolly, Patrick Wolf, James Dumay, rsandell - thoughts on compatibility-breaking like this? |