WorkflowPatcherConfig

class WorkflowPatcherConfig(*, workflows: list[Workflow])[source]

Bases: BaseModel

The WorkflowPatcherConfig is used to validate the expected format for the .workflow-patcher.yml, which is used to modify the workflow templates provided by the PTB.

workflows: list[Workflow]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class Workflow(*, name: ~typing.Annotated[str, ~pydantic.functional_validators.AfterValidator(func=~exasol.toolbox.util.workflows.patch_workflow.validate_workflow_name)], remove_jobs: list[str] = <factory>, step_customizations: list[~exasol.toolbox.util.workflows.patch_workflow.StepCustomization] = <factory>)[source]

Bases: BaseModel

The Workflow is used to specify which workflow should be modified. This is determined by the workflow name. A workflow can be modified by specifying:

  • remove_jobs - job names in this list will be removed from the workflow.

  • step_customization - items in this list indicate which job’s step should be modified.

name: Annotated[str, AfterValidator(func=validate_workflow_name)]
remove_jobs: list[str]
step_customizations: list[StepCustomization]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class StepCustomization(*, action: ActionType, job: str, step_id: str, content: list[StepContent])[source]

Bases: BaseModel

The StepCustomization is used to specify the desired modification. An action of ActionType:

  • REPLACE - means that the contents of the specified step_id should be replaced with whatever content is provided.

  • INSERT_AFTER - means that the specified content should be inserted after the specified step_id.

action: ActionType
job: str
step_id: str
content: list[StepContent]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class StepContent(*, name: str, id: str, uses: str | None = None, run: str | None = None, with_: dict[str, Any] | None = None, env: dict[str, str] | None = None, **extra_data: Any)[source]

Bases: BaseModel

The StepContent is used to lightly validate the content which would be used to REPLACE or INSERT_AFTER the specified step in the GitHub workflow.

With the value ConfigDict(extra="allow"), this model allows for further fields (e.g. dummy) to be specified without any validation. This design choice was intentional, as GitHub already allows additional fields and may specify more fields than what has been specified in this model.

As the validation here is light, it is left to GitHub to validate the content. For further information on what is allowed & expected for the fields, refer to GitHub’s documentation on jobs.<job_id>.steps.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
id: str
uses: str | None
run: str | None
with_: dict[str, Any] | None
env: dict[str, str] | None
validate_workflow_name(workflow_name: str) str[source]

Validates that the given workflow_name is a valid workflow name provided by the PTB.