Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/41.added.srt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added pre checkout steps to the git feature
6 changes: 5 additions & 1 deletion src/generator/features/git.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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=(
Expand Down
4 changes: 4 additions & 0 deletions src/generator/templates/git.mako
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading