Skip to content

Commit

Permalink
feat(tekton): Add fork events option
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Gleeson <brian.gleeson@ie.ibm.com>
  • Loading branch information
briangleeson committed Sep 27, 2024
1 parent 0547ec8 commit b6e8a0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ibm_continuous_delivery/cd_tekton_pipeline_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6126,6 +6126,8 @@ class TriggerScmTrigger(Trigger):
disabled for this trigger.
:attr bool enabled: Flag to check if the trigger is enabled.
:attr bool favorite: (optional) Mark the trigger as a favorite.
:attr bool enable_events_from_forks: (optional) When enabled, pull request
events from forks of the selected repository will trigger a pipeline run.
:attr TriggerSource source: (optional) Source repository for a Git trigger. Only
required for Git triggers. The referenced repository URL must match the URL of a
repository tool integration in the parent toolchain. Obtain the list of
Expand Down Expand Up @@ -6155,6 +6157,7 @@ def __init__(
worker: "Worker" = None,
max_concurrent_runs: int = None,
favorite: bool = None,
enable_events_from_forks: bool = None,
source: "TriggerSource" = None,
events: List[str] = None,
filter: str = None,
Expand All @@ -6181,6 +6184,8 @@ def __init__(
concurrent runs for this trigger. If omitted then the concurrency limit is
disabled for this trigger.
:param bool favorite: (optional) Mark the trigger as a favorite.
:param bool enable_events_from_forks: (optional) When enabled, pull request
events from forks of the selected repository will trigger a pipeline run.
:param TriggerSource source: (optional) Source repository for a Git
trigger. Only required for Git triggers. The referenced repository URL must
match the URL of a repository tool integration in the parent toolchain.
Expand All @@ -6207,6 +6212,7 @@ def __init__(
self.max_concurrent_runs = max_concurrent_runs
self.enabled = enabled
self.favorite = favorite
self.enable_events_from_forks = enable_events_from_forks
self.source = source
self.events = events
self.filter = filter
Expand Down Expand Up @@ -6247,6 +6253,8 @@ def from_dict(cls, _dict: Dict) -> "TriggerScmTrigger":
raise ValueError("Required property 'enabled' not present in TriggerScmTrigger JSON")
if "favorite" in _dict:
args["favorite"] = _dict.get("favorite")
if "enable_events_from_forks" in _dict:
args["enable_events_from_forks"] = _dict.get("enable_events_from_forks")
if "source" in _dict:
args["source"] = TriggerSource.from_dict(_dict.get("source"))
if "events" in _dict:
Expand Down Expand Up @@ -6294,6 +6302,8 @@ def to_dict(self) -> Dict:
_dict["enabled"] = self.enabled
if hasattr(self, "favorite") and self.favorite is not None:
_dict["favorite"] = self.favorite
if hasattr(self, "enable_events_from_forks") and self.enable_events_from_forks is not None:
_dict["enable_events_from_forks"] = self.enable_events_from_forks
if hasattr(self, "source") and self.source is not None:
if isinstance(self.source, dict):
_dict["source"] = self.source
Expand Down
1 change: 1 addition & 0 deletions test/unit/test_cd_tekton_pipeline_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5783,6 +5783,7 @@ def test_trigger_scm_trigger_serialization(self):
trigger_scm_trigger_model_json["max_concurrent_runs"] = 4
trigger_scm_trigger_model_json["enabled"] = True
trigger_scm_trigger_model_json["favorite"] = False
trigger_scm_trigger_model_json["enable_events_from_forks"] = False
trigger_scm_trigger_model_json["source"] = trigger_source_model
trigger_scm_trigger_model_json["events"] = ["push", "pull_request"]
trigger_scm_trigger_model_json["filter"] = "header['x-github-event'] == 'push' && body.ref == 'refs/heads/main'"
Expand Down

0 comments on commit b6e8a0c

Please sign in to comment.