Hi all,
I have written a custom step (let's call it "foo") that allows pipeline
authors
to configure aspects of their build. The step can be used with our without a
body:
# applies the config to the executed block
foo(config: ...) {
}
# applies the config to the current block
stage("s") {
def config = foo()
config.setting = 1
# or
foo().setting = 1
}
This works very nicely.
The configuration is expected to be called many times in a pipeline
definition
and for this reason I would like to increase the ergonomics of the syntax
(even more).
# desired syntax
stage("s") {
foo.setting = 1
}
The logic in the "foo" step needs access to the current StepContext, so I
can't
implement it completely as a global variable, as those don't have access to
the
context.
Ideas:
a) implement it with a global variable, that directly call the step via the
CpsScript.
However the CPS engine always resolves symbol look-ups by looking at
global
variables, so my global variable calls itself.
(I have a PoC that allows GlobalVariables to be exempt from method
look-ups)
b) Allow steps to declare that they also want to be exposed as a global
variable, which when accessed will call the Step without arguments?
Do you think this functionality would be in scope of Jenkins?
Thanks,
Thomas
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/ab64b91e-262d-4b25-9408-9e90493bd271%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.