jenkinsci / templating-engine-plugin

create tool-agnostic, templated pipelines to be shared by multiple teams
https://jenkinsci.github.io/templating-engine-plugin/latest/
Apache License 2.0
171 stars 58 forks source link

Add `hookContext.methodName` to filter Lifecycle Hooks for multi-method steps #275

Closed steven-terrana closed 2 years ago

steven-terrana commented 2 years ago

PR Details

fixes #223

Description

Adds a hookContext.methodName to filter Lifecycle Hooks for multi-method steps.

for example, a step:

void call(){ println "call method" }
void notCall(){ println "not call method" }

if a user wants to only trigger a hook after the notCall method, you could do:

@AfterStep({ hookContext.step == "whatever" && hookContext.methodName == "notCall" })

How Has This Been Tested

unit tests for dayz

Types of Changes

Checklist