Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
May 26, 2022
Merged

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

merged 3 commits into from
May 26, 2022

Conversation

steven-terrana
Copy link

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

  • Added Unit Testing
  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have added the appropriate label for this PR
  • If necessary, I have updated the documentation accordingly.
  • All new and existing tests passed.

@steven-terrana steven-terrana merged commit 93dfc06 into jenkinsci:main May 26, 2022
@steven-terrana steven-terrana deleted the fix-223 branch May 26, 2022 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Steps with lifecycle hook annotation gets executed after any method of conditional step
1 participant