diff --git a/.changelog/41.added.srt b/.changelog/41.added.srt new file mode 100644 index 0000000..cb81414 --- /dev/null +++ b/.changelog/41.added.srt @@ -0,0 +1 @@ +Added pre checkout steps to the git feature \ No newline at end of file diff --git a/src/generator/features/git.py b/src/generator/features/git.py index f9b5db5..885c9e8 100644 --- a/src/generator/features/git.py +++ b/src/generator/features/git.py @@ -1,7 +1,7 @@ """This module defines the Git-related features and configurations for Jenkins pipelines.""" from abc import ABC -from typing import Any, Dict, Optional, Type +from typing import Any, Dict, List, Optional, Type from pydantic import BaseModel, Field, field_validator @@ -102,6 +102,10 @@ class GitConfig(FeatureConfig): default=None, description="The checkout configuration. If use_simple_checkout is true, this will be ignored.", ) + pre_checkout_tasks: Optional[List[str]] = Field( + default=[], + description="List of tasks to run before running the checkout.", + ) retry_count: Optional[int] = Field( default=1, description=( diff --git a/src/generator/templates/git.mako b/src/generator/templates/git.mako index 329b117..3f02a94 100644 --- a/src/generator/templates/git.mako +++ b/src/generator/templates/git.mako @@ -2,6 +2,10 @@ <%def name="additional_functions()"> def projectCheckout() { +% for pre_task in feature_config.pre_checkout_tasks: + ${pre_task} +% endfor + % if feature_config.retry_count > 1: retry(count: ${feature_config.retry_count}) { % endif