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
50 changes: 49 additions & 1 deletion src/usethis/_integrations/ci/bitbucket/schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: schema.json
# timestamp: 2025-10-26T23:11:28+00:00
# timestamp: 2025-11-12T19:13:24+00:00
# using the command:
# datamodel-codegen --input tests\usethis\_integrations\ci\bitbucket\schema.json --input-file-type jsonschema --output src\usethis\_integrations\ci\bitbucket\schema.py --enum-field-as-literal all --field-constraints --use-double-quotes --use-union-operator --use-standard-collections --use-default-kwarg --extra-fields=allow --output-model-type pydantic_v2.BaseModel --target-python-version 3.10
# ruff: noqa: ERA001
Expand Down Expand Up @@ -160,6 +160,24 @@ class ImportPipeline(BaseModel):
)


class TriggerConfiguration(BaseModel):
model_config = ConfigDict(
extra="allow",
)
condition: str = Field(
...,
description="Boolean expression that determines whether the trigger should execute.",
examples=['BITBUCKET_BRANCH == "main"'],
title="Trigger Condition",
)
pipelines: list[str] = Field(
...,
description="List of pipeline names to trigger when the condition is met. Can reference pipelines from the custom section.",
min_length=1,
title="Pipeline Names",
)


class ImageBase(BaseModel):
model_config = ConfigDict(
extra="allow",
Expand Down Expand Up @@ -308,6 +326,15 @@ class Runtime(BaseModel):
cloud: Cloud | None = None


class TriggerConfigurationList(RootModel[list[TriggerConfiguration]]):
root: list[TriggerConfiguration] = Field(
...,
description="List of trigger configurations for a specific trigger type.",
min_length=1,
title="Trigger Configuration List",
)


class CacheExpanded(BaseModel):
model_config = ConfigDict(
extra="allow",
Expand Down Expand Up @@ -738,6 +765,27 @@ class PipelinesConfiguration(BaseModel):
title="Global Options",
)
pipelines: Pipelines | None = Field(default=None, title="Pipelines")
triggers: dict[str, TriggerConfigurationList] | None = Field(
default=None,
description="Event-based triggers that automatically run pipelines when specific events occur. The property names represent trigger types (e.g., repository-push, pullrequest-push).",
examples=[
{
"pullrequest-push": [
{
"condition": 'BITBUCKET_PR_DESTINATION_BRANCH == "main"',
"pipelines": ["pipeline2"],
}
],
"repository-push": [
{
"condition": 'BITBUCKET_BRANCH == "main"',
"pipelines": ["pipeline1"],
}
],
}
],
title="Pipeline Triggers",
)


class Model(RootModel[PipelinesConfiguration]):
Expand Down
Loading