If I'm working on a plugin and want to switch from using a step like so:
step([$class: 'Gradle',
switches: "-PenableInstallerDistribution=true",
tasks: 'build install',
gradleName: '(Default)',
useWrapper: true,
makeExecutable: true,
fromRootBuildScriptDir: true,
useWorkspaceAsHome: true])
to a nice dsl element like so:
gradle switches: "-PenableInstallerDistribution=true",
tasks: 'build install',
gradleName: '(Default)',
useWrapper: true,
makeExecutable: true,
fromRootBuildScriptDir: true,
useWorkspaceAsHome: true
and perhaps most importantly, show up in the snippet generator, what do I do? I've looked through what docs I could find, but still can't locate any advice on extending the dsl.
First of all, if you are not really customizing the step configuration beyond omitting
step
, then this is probably a waste of time since a future revision of Workflow core is likely to include syntactic sugar for “metasteps” likestep
,checkout
, and (now)wrap
. (And anySimpleBuildStep
already shows up in the Snippet Generator understep
.)That said, if you do need to create a first-class step, you would need to add a plugin dependency on
workflow-step-api
, and typically extendAbstractStepImpl
,AbstractStepDescriptorImpl
, andAbstractStepExecutionImpl
.If you are attempting to implement JENKINS-27393 then I would say that a useful implementation needs to wait for the infrastructural JENKINS-26055, as merely wrapping the existing
Gradle
builder will not allow the flow to survive a Jenkins restart (or slave disconnection) in the middle of this step.