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 59 forks source link

Resolved a regression of `template_methods` working when overloaded by library steps #293

Closed steven-terrana closed 2 years ago

steven-terrana commented 2 years ago

PR Details

fixes #291

a bug was introduced by #283 that caused a regression in template methods working as expected.

Description

PR #283 introduced a bug where the TemplatePrimitiveCollector was not being persisted after each TemplatePrimitiveInjector.

This resulted in TemplateMethodInjector not being able to access the TemplatePrimitives that had been created by LibraryStepInjector.

The fix was to update the TemplatePrimitiveInjector.invoke$ method so that the updated TemplatePrimitiveCollector is persisted on the WorkflowRun after each injector is invoked.

How Has This Been Tested

reproduced the bug both manually and in unit tests. confirmed that the change fixes both.

Types of Changes

Checklist