I'm answering my own question here. It looks like this is indeed possible.
I added some method definitions at the end of my Jenkinsfile following the
pipeline definition. I was able to call the methods from a script {}
embedded in stages and post sections.
On Wednesday, August 16, 2017 at 11:19:40 AM UTC-5, Dallas Clement wrote:
>
> I would like to be able to define some groovy methods in my declarative
> Jenkinsfile and call as needed from a script {} section. For example I
> would like to define some methods that extract git commit information from
> the jenkins API and use when notifying concerning build status from one of
> the pipeline post conditions. Is it possible to define methods in a
> declarative pipeline?
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" 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-users/75dbde18-e546-47a2-84f6-66e75ef3d991%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.