This message was deleted.
# community-support
s
This message was deleted.
d
One other thing to note is that, in this particular case,
theTask
is a lifecycle task and is actually supposed to be invoked by user (be it a human or CI server), but I am actually looking for general recommendations.
v
I would think that you always register the task, but in a
doFirst{}
you can check if the conditions to actually execute the task are fulfilled. If not, throw an exception to fail the build before the task is executed.
e
there's also
enabled = false
(eagerly configured) and
onlyIf { false }
(lazily evaluated) to ensure that the task is not executed
2
I would also always register the task, and use one of those to limit when it will run if needed
1
👍 1