buildkite_sdk.schema
1from typing import Optional, Any, List, Union, Dict, TypeVar, Callable, Type, cast 2from enum import Enum 3 4 5T = TypeVar("T") 6EnumT = TypeVar("EnumT", bound=Enum) 7 8 9def from_str(x: Any) -> str: 10 assert isinstance(x, str) 11 return x 12 13 14def from_none(x: Any) -> Any: 15 assert x is None 16 return x 17 18 19def from_union(fs, x): 20 for f in fs: 21 try: 22 return f(x) 23 except: 24 pass 25 assert False 26 27 28def from_list(f: Callable[[Any], T], x: Any) -> List[T]: 29 assert isinstance(x, list) 30 return [f(y) for y in x] 31 32 33def from_dict(f: Callable[[Any], T], x: Any) -> Dict[str, T]: 34 assert isinstance(x, dict) 35 return {k: f(v) for (k, v) in x.items()} 36 37 38def to_class(c: Type[T], x: Any) -> dict: 39 assert isinstance(x, c) 40 return cast(Any, x).to_dict() 41 42 43def from_bool(x: Any) -> bool: 44 assert isinstance(x, bool) 45 return x 46 47 48def to_enum(c: Type[EnumT], x: Any) -> EnumT: 49 assert isinstance(x, c) 50 return x.value 51 52 53def from_int(x: Any) -> int: 54 assert isinstance(x, int) and not isinstance(x, bool) 55 return x 56 57 58class PurpleGithubCommitStatus: 59 context: Optional[str] 60 """GitHub commit status name""" 61 62 def __init__(self, context: Optional[str]) -> None: 63 self.context = context 64 65 @staticmethod 66 def from_dict(obj: Any) -> "PurpleGithubCommitStatus": 67 assert isinstance(obj, dict) 68 context = from_union([from_str, from_none], obj.get("context")) 69 return PurpleGithubCommitStatus(context) 70 71 def to_dict(self) -> dict: 72 result: dict = {} 73 if self.context is not None: 74 result["context"] = from_union([from_str, from_none], self.context) 75 return result 76 77 78class PurpleSlack: 79 channels: Optional[List[str]] 80 message: Optional[str] 81 82 def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None: 83 self.channels = channels 84 self.message = message 85 86 @staticmethod 87 def from_dict(obj: Any) -> "PurpleSlack": 88 assert isinstance(obj, dict) 89 channels = from_union( 90 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 91 ) 92 message = from_union([from_str, from_none], obj.get("message")) 93 return PurpleSlack(channels, message) 94 95 def to_dict(self) -> dict: 96 result: dict = {} 97 if self.channels is not None: 98 result["channels"] = from_union( 99 [lambda x: from_list(from_str, x), from_none], self.channels 100 ) 101 if self.message is not None: 102 result["message"] = from_union([from_str, from_none], self.message) 103 return result 104 105 106class PurpleBuildNotify: 107 email: Optional[str] 108 build_notify_if: Optional[str] 109 basecamp_campfire: Optional[str] 110 slack: Optional[Union[PurpleSlack, str]] 111 webhook: Optional[str] 112 pagerduty_change_event: Optional[str] 113 github_commit_status: Optional[PurpleGithubCommitStatus] 114 github_check: Optional[Dict[str, Any]] 115 116 def __init__( 117 self, 118 email: Optional[str], 119 build_notify_if: Optional[str], 120 basecamp_campfire: Optional[str], 121 slack: Optional[Union[PurpleSlack, str]], 122 webhook: Optional[str], 123 pagerduty_change_event: Optional[str], 124 github_commit_status: Optional[PurpleGithubCommitStatus], 125 github_check: Optional[Dict[str, Any]], 126 ) -> None: 127 self.email = email 128 self.build_notify_if = build_notify_if 129 self.basecamp_campfire = basecamp_campfire 130 self.slack = slack 131 self.webhook = webhook 132 self.pagerduty_change_event = pagerduty_change_event 133 self.github_commit_status = github_commit_status 134 self.github_check = github_check 135 136 @staticmethod 137 def from_dict(obj: Any) -> "PurpleBuildNotify": 138 assert isinstance(obj, dict) 139 email = from_union([from_str, from_none], obj.get("email")) 140 build_notify_if = from_union([from_str, from_none], obj.get("if")) 141 basecamp_campfire = from_union( 142 [from_str, from_none], obj.get("basecamp_campfire") 143 ) 144 slack = from_union( 145 [PurpleSlack.from_dict, from_str, from_none], obj.get("slack") 146 ) 147 webhook = from_union([from_str, from_none], obj.get("webhook")) 148 pagerduty_change_event = from_union( 149 [from_str, from_none], obj.get("pagerduty_change_event") 150 ) 151 github_commit_status = from_union( 152 [PurpleGithubCommitStatus.from_dict, from_none], 153 obj.get("github_commit_status"), 154 ) 155 github_check = from_union( 156 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 157 ) 158 return PurpleBuildNotify( 159 email, 160 build_notify_if, 161 basecamp_campfire, 162 slack, 163 webhook, 164 pagerduty_change_event, 165 github_commit_status, 166 github_check, 167 ) 168 169 def to_dict(self) -> dict: 170 result: dict = {} 171 if self.email is not None: 172 result["email"] = from_union([from_str, from_none], self.email) 173 if self.build_notify_if is not None: 174 result["if"] = from_union([from_str, from_none], self.build_notify_if) 175 if self.basecamp_campfire is not None: 176 result["basecamp_campfire"] = from_union( 177 [from_str, from_none], self.basecamp_campfire 178 ) 179 if self.slack is not None: 180 result["slack"] = from_union( 181 [lambda x: to_class(PurpleSlack, x), from_str, from_none], self.slack 182 ) 183 if self.webhook is not None: 184 result["webhook"] = from_union([from_str, from_none], self.webhook) 185 if self.pagerduty_change_event is not None: 186 result["pagerduty_change_event"] = from_union( 187 [from_str, from_none], self.pagerduty_change_event 188 ) 189 if self.github_commit_status is not None: 190 result["github_commit_status"] = from_union( 191 [lambda x: to_class(PurpleGithubCommitStatus, x), from_none], 192 self.github_commit_status, 193 ) 194 if self.github_check is not None: 195 result["github_check"] = from_union( 196 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 197 ) 198 return result 199 200 201class NotifyEnum(Enum): 202 GITHUB_CHECK = "github_check" 203 GITHUB_COMMIT_STATUS = "github_commit_status" 204 205 206class AllowDependencyFailureEnum(Enum): 207 FALSE = "false" 208 TRUE = "true" 209 210 211class BlockedState(Enum): 212 """The state that the build is set to when the build is blocked by this block step""" 213 214 FAILED = "failed" 215 PASSED = "passed" 216 RUNNING = "running" 217 218 219class DependsOnClass: 220 allow_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 221 step: Optional[str] 222 223 def __init__( 224 self, 225 allow_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 226 step: Optional[str], 227 ) -> None: 228 self.allow_failure = allow_failure 229 self.step = step 230 231 @staticmethod 232 def from_dict(obj: Any) -> "DependsOnClass": 233 assert isinstance(obj, dict) 234 allow_failure = from_union( 235 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("allow_failure") 236 ) 237 step = from_union([from_str, from_none], obj.get("step")) 238 return DependsOnClass(allow_failure, step) 239 240 def to_dict(self) -> dict: 241 result: dict = {} 242 if self.allow_failure is not None: 243 result["allow_failure"] = from_union( 244 [ 245 from_bool, 246 lambda x: to_enum(AllowDependencyFailureEnum, x), 247 from_none, 248 ], 249 self.allow_failure, 250 ) 251 if self.step is not None: 252 result["step"] = from_union([from_str, from_none], self.step) 253 return result 254 255 256class Option: 257 hint: Optional[str] 258 """The text displayed directly under the select field’s label""" 259 260 label: str 261 """The text displayed on the select list item""" 262 263 required: Optional[Union[bool, AllowDependencyFailureEnum]] 264 """Whether the field is required for form submission""" 265 266 value: str 267 """The value to be stored as meta-data""" 268 269 def __init__( 270 self, 271 hint: Optional[str], 272 label: str, 273 required: Optional[Union[bool, AllowDependencyFailureEnum]], 274 value: str, 275 ) -> None: 276 self.hint = hint 277 self.label = label 278 self.required = required 279 self.value = value 280 281 @staticmethod 282 def from_dict(obj: Any) -> "Option": 283 assert isinstance(obj, dict) 284 hint = from_union([from_str, from_none], obj.get("hint")) 285 label = from_str(obj.get("label")) 286 required = from_union( 287 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("required") 288 ) 289 value = from_str(obj.get("value")) 290 return Option(hint, label, required, value) 291 292 def to_dict(self) -> dict: 293 result: dict = {} 294 if self.hint is not None: 295 result["hint"] = from_union([from_str, from_none], self.hint) 296 result["label"] = from_str(self.label) 297 if self.required is not None: 298 result["required"] = from_union( 299 [ 300 from_bool, 301 lambda x: to_enum(AllowDependencyFailureEnum, x), 302 from_none, 303 ], 304 self.required, 305 ) 306 result["value"] = from_str(self.value) 307 return result 308 309 310class Field: 311 """A list of input fields required to be filled out before unblocking the step""" 312 313 default: Optional[Union[List[str], str]] 314 """The value that is pre-filled in the text field 315 316 The value of the option(s) that will be pre-selected in the dropdown 317 """ 318 format: Optional[str] 319 """The format must be a regular expression implicitly anchored to the beginning and end of 320 the input and is functionally equivalent to the HTML5 pattern attribute. 321 """ 322 hint: Optional[str] 323 """The explanatory text that is shown after the label""" 324 325 key: str 326 """The meta-data key that stores the field's input""" 327 328 required: Optional[Union[bool, AllowDependencyFailureEnum]] 329 """Whether the field is required for form submission""" 330 331 text: Optional[str] 332 """The text input name""" 333 334 multiple: Optional[Union[bool, AllowDependencyFailureEnum]] 335 """Whether more than one option may be selected""" 336 337 options: Optional[List[Option]] 338 select: Optional[str] 339 """The text input name""" 340 341 def __init__( 342 self, 343 default: Optional[Union[List[str], str]], 344 format: Optional[str], 345 hint: Optional[str], 346 key: str, 347 required: Optional[Union[bool, AllowDependencyFailureEnum]], 348 text: Optional[str], 349 multiple: Optional[Union[bool, AllowDependencyFailureEnum]], 350 options: Optional[List[Option]], 351 select: Optional[str], 352 ) -> None: 353 self.default = default 354 self.format = format 355 self.hint = hint 356 self.key = key 357 self.required = required 358 self.text = text 359 self.multiple = multiple 360 self.options = options 361 self.select = select 362 363 @staticmethod 364 def from_dict(obj: Any) -> "Field": 365 assert isinstance(obj, dict) 366 default = from_union( 367 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("default") 368 ) 369 format = from_union([from_str, from_none], obj.get("format")) 370 hint = from_union([from_str, from_none], obj.get("hint")) 371 key = from_str(obj.get("key")) 372 required = from_union( 373 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("required") 374 ) 375 text = from_union([from_str, from_none], obj.get("text")) 376 multiple = from_union( 377 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("multiple") 378 ) 379 options = from_union( 380 [lambda x: from_list(Option.from_dict, x), from_none], obj.get("options") 381 ) 382 select = from_union([from_str, from_none], obj.get("select")) 383 return Field( 384 default, format, hint, key, required, text, multiple, options, select 385 ) 386 387 def to_dict(self) -> dict: 388 result: dict = {} 389 if self.default is not None: 390 result["default"] = from_union( 391 [lambda x: from_list(from_str, x), from_str, from_none], self.default 392 ) 393 if self.format is not None: 394 result["format"] = from_union([from_str, from_none], self.format) 395 if self.hint is not None: 396 result["hint"] = from_union([from_str, from_none], self.hint) 397 result["key"] = from_str(self.key) 398 if self.required is not None: 399 result["required"] = from_union( 400 [ 401 from_bool, 402 lambda x: to_enum(AllowDependencyFailureEnum, x), 403 from_none, 404 ], 405 self.required, 406 ) 407 if self.text is not None: 408 result["text"] = from_union([from_str, from_none], self.text) 409 if self.multiple is not None: 410 result["multiple"] = from_union( 411 [ 412 from_bool, 413 lambda x: to_enum(AllowDependencyFailureEnum, x), 414 from_none, 415 ], 416 self.multiple, 417 ) 418 if self.options is not None: 419 result["options"] = from_union( 420 [lambda x: from_list(lambda x: to_class(Option, x), x), from_none], 421 self.options, 422 ) 423 if self.select is not None: 424 result["select"] = from_union([from_str, from_none], self.select) 425 return result 426 427 428class BlockType(Enum): 429 BLOCK = "block" 430 431 432class BlockStep: 433 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 434 block: Optional[str] 435 """The label of the block step""" 436 437 blocked_state: Optional[BlockedState] 438 """The state that the build is set to when the build is blocked by this block step""" 439 440 branches: Optional[Union[List[str], str]] 441 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 442 fields: Optional[List[Field]] 443 id: Optional[str] 444 identifier: Optional[str] 445 block_step_if: Optional[str] 446 key: Optional[str] 447 label: Optional[str] 448 name: Optional[str] 449 prompt: Optional[str] 450 type: Optional[BlockType] 451 452 def __init__( 453 self, 454 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 455 block: Optional[str], 456 blocked_state: Optional[BlockedState], 457 branches: Optional[Union[List[str], str]], 458 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 459 fields: Optional[List[Field]], 460 id: Optional[str], 461 identifier: Optional[str], 462 block_step_if: Optional[str], 463 key: Optional[str], 464 label: Optional[str], 465 name: Optional[str], 466 prompt: Optional[str], 467 type: Optional[BlockType], 468 ) -> None: 469 self.allow_dependency_failure = allow_dependency_failure 470 self.block = block 471 self.blocked_state = blocked_state 472 self.branches = branches 473 self.depends_on = depends_on 474 self.fields = fields 475 self.id = id 476 self.identifier = identifier 477 self.block_step_if = block_step_if 478 self.key = key 479 self.label = label 480 self.name = name 481 self.prompt = prompt 482 self.type = type 483 484 @staticmethod 485 def from_dict(obj: Any) -> "BlockStep": 486 assert isinstance(obj, dict) 487 allow_dependency_failure = from_union( 488 [from_bool, AllowDependencyFailureEnum, from_none], 489 obj.get("allow_dependency_failure"), 490 ) 491 block = from_union([from_str, from_none], obj.get("block")) 492 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 493 branches = from_union( 494 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 495 ) 496 depends_on = from_union( 497 [ 498 from_none, 499 lambda x: from_list( 500 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 501 ), 502 from_str, 503 ], 504 obj.get("depends_on"), 505 ) 506 fields = from_union( 507 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 508 ) 509 id = from_union([from_str, from_none], obj.get("id")) 510 identifier = from_union([from_str, from_none], obj.get("identifier")) 511 block_step_if = from_union([from_str, from_none], obj.get("if")) 512 key = from_union([from_str, from_none], obj.get("key")) 513 label = from_union([from_str, from_none], obj.get("label")) 514 name = from_union([from_str, from_none], obj.get("name")) 515 prompt = from_union([from_str, from_none], obj.get("prompt")) 516 type = from_union([BlockType, from_none], obj.get("type")) 517 return BlockStep( 518 allow_dependency_failure, 519 block, 520 blocked_state, 521 branches, 522 depends_on, 523 fields, 524 id, 525 identifier, 526 block_step_if, 527 key, 528 label, 529 name, 530 prompt, 531 type, 532 ) 533 534 def to_dict(self) -> dict: 535 result: dict = {} 536 if self.allow_dependency_failure is not None: 537 result["allow_dependency_failure"] = from_union( 538 [ 539 from_bool, 540 lambda x: to_enum(AllowDependencyFailureEnum, x), 541 from_none, 542 ], 543 self.allow_dependency_failure, 544 ) 545 if self.block is not None: 546 result["block"] = from_union([from_str, from_none], self.block) 547 if self.blocked_state is not None: 548 result["blocked_state"] = from_union( 549 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 550 ) 551 if self.branches is not None: 552 result["branches"] = from_union( 553 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 554 ) 555 if self.depends_on is not None: 556 result["depends_on"] = from_union( 557 [ 558 from_none, 559 lambda x: from_list( 560 lambda x: from_union( 561 [lambda x: to_class(DependsOnClass, x), from_str], x 562 ), 563 x, 564 ), 565 from_str, 566 ], 567 self.depends_on, 568 ) 569 if self.fields is not None: 570 result["fields"] = from_union( 571 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 572 self.fields, 573 ) 574 if self.id is not None: 575 result["id"] = from_union([from_str, from_none], self.id) 576 if self.identifier is not None: 577 result["identifier"] = from_union([from_str, from_none], self.identifier) 578 if self.block_step_if is not None: 579 result["if"] = from_union([from_str, from_none], self.block_step_if) 580 if self.key is not None: 581 result["key"] = from_union([from_str, from_none], self.key) 582 if self.label is not None: 583 result["label"] = from_union([from_str, from_none], self.label) 584 if self.name is not None: 585 result["name"] = from_union([from_str, from_none], self.name) 586 if self.prompt is not None: 587 result["prompt"] = from_union([from_str, from_none], self.prompt) 588 if self.type is not None: 589 result["type"] = from_union( 590 [lambda x: to_enum(BlockType, x), from_none], self.type 591 ) 592 return result 593 594 595class Build: 596 """Properties of the build that will be created when the step is triggered""" 597 598 branch: Optional[str] 599 """The branch for the build""" 600 601 commit: Optional[str] 602 """The commit hash for the build""" 603 604 env: Optional[Dict[str, Any]] 605 message: Optional[str] 606 """The message for the build (supports emoji)""" 607 608 meta_data: Optional[Dict[str, Any]] 609 """Meta-data for the build""" 610 611 def __init__( 612 self, 613 branch: Optional[str], 614 commit: Optional[str], 615 env: Optional[Dict[str, Any]], 616 message: Optional[str], 617 meta_data: Optional[Dict[str, Any]], 618 ) -> None: 619 self.branch = branch 620 self.commit = commit 621 self.env = env 622 self.message = message 623 self.meta_data = meta_data 624 625 @staticmethod 626 def from_dict(obj: Any) -> "Build": 627 assert isinstance(obj, dict) 628 branch = from_union([from_str, from_none], obj.get("branch")) 629 commit = from_union([from_str, from_none], obj.get("commit")) 630 env = from_union( 631 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 632 ) 633 message = from_union([from_str, from_none], obj.get("message")) 634 meta_data = from_union( 635 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("meta_data") 636 ) 637 return Build(branch, commit, env, message, meta_data) 638 639 def to_dict(self) -> dict: 640 result: dict = {} 641 if self.branch is not None: 642 result["branch"] = from_union([from_str, from_none], self.branch) 643 if self.commit is not None: 644 result["commit"] = from_union([from_str, from_none], self.commit) 645 if self.env is not None: 646 result["env"] = from_union( 647 [lambda x: from_dict(lambda x: x, x), from_none], self.env 648 ) 649 if self.message is not None: 650 result["message"] = from_union([from_str, from_none], self.message) 651 if self.meta_data is not None: 652 result["meta_data"] = from_union( 653 [lambda x: from_dict(lambda x: x, x), from_none], self.meta_data 654 ) 655 return result 656 657 658class CacheClass: 659 name: Optional[str] 660 paths: List[str] 661 size: Optional[str] 662 663 def __init__( 664 self, name: Optional[str], paths: List[str], size: Optional[str] 665 ) -> None: 666 self.name = name 667 self.paths = paths 668 self.size = size 669 670 @staticmethod 671 def from_dict(obj: Any) -> "CacheClass": 672 assert isinstance(obj, dict) 673 name = from_union([from_str, from_none], obj.get("name")) 674 paths = from_list(from_str, obj.get("paths")) 675 size = from_union([from_str, from_none], obj.get("size")) 676 return CacheClass(name, paths, size) 677 678 def to_dict(self) -> dict: 679 result: dict = {} 680 if self.name is not None: 681 result["name"] = from_union([from_str, from_none], self.name) 682 result["paths"] = from_list(from_str, self.paths) 683 if self.size is not None: 684 result["size"] = from_union([from_str, from_none], self.size) 685 return result 686 687 688class ConcurrencyMethod(Enum): 689 """Control command order, allowed values are 'ordered' (default) and 'eager'. If you use 690 this attribute, you must also define concurrency_group and concurrency. 691 """ 692 693 EAGER = "eager" 694 ORDERED = "ordered" 695 696 697class ExitStatusEnum(Enum): 698 EMPTY = "*" 699 700 701class SoftFailElement: 702 exit_status: Optional[Union[int, ExitStatusEnum]] 703 """The exit status number that will cause this job to soft-fail""" 704 705 def __init__(self, exit_status: Optional[Union[int, ExitStatusEnum]]) -> None: 706 self.exit_status = exit_status 707 708 @staticmethod 709 def from_dict(obj: Any) -> "SoftFailElement": 710 assert isinstance(obj, dict) 711 exit_status = from_union( 712 [from_int, ExitStatusEnum, from_none], obj.get("exit_status") 713 ) 714 return SoftFailElement(exit_status) 715 716 def to_dict(self) -> dict: 717 result: dict = {} 718 if self.exit_status is not None: 719 result["exit_status"] = from_union( 720 [from_int, lambda x: to_enum(ExitStatusEnum, x), from_none], 721 self.exit_status, 722 ) 723 return result 724 725 726class Adjustment: 727 """An adjustment to a Build Matrix""" 728 729 skip: Optional[Union[bool, str]] 730 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 731 adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]] 732 733 def __init__( 734 self, 735 skip: Optional[Union[bool, str]], 736 soft_fail: Optional[ 737 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 738 ], 739 adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]], 740 ) -> None: 741 self.skip = skip 742 self.soft_fail = soft_fail 743 self.adjustment_with = adjustment_with 744 745 @staticmethod 746 def from_dict(obj: Any) -> "Adjustment": 747 assert isinstance(obj, dict) 748 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 749 soft_fail = from_union( 750 [ 751 from_bool, 752 lambda x: from_list(SoftFailElement.from_dict, x), 753 AllowDependencyFailureEnum, 754 from_none, 755 ], 756 obj.get("soft_fail"), 757 ) 758 adjustment_with = from_union( 759 [ 760 lambda x: from_list( 761 lambda x: from_union([from_int, from_bool, from_str], x), x 762 ), 763 lambda x: from_dict(from_str, x), 764 ], 765 obj.get("with"), 766 ) 767 return Adjustment(skip, soft_fail, adjustment_with) 768 769 def to_dict(self) -> dict: 770 result: dict = {} 771 if self.skip is not None: 772 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 773 if self.soft_fail is not None: 774 result["soft_fail"] = from_union( 775 [ 776 from_bool, 777 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 778 lambda x: to_enum(AllowDependencyFailureEnum, x), 779 from_none, 780 ], 781 self.soft_fail, 782 ) 783 result["with"] = from_union( 784 [ 785 lambda x: from_list( 786 lambda x: from_union([from_int, from_bool, from_str], x), x 787 ), 788 lambda x: from_dict(from_str, x), 789 ], 790 self.adjustment_with, 791 ) 792 return result 793 794 795class MatrixClass: 796 """Configuration for multi-dimension Build Matrix""" 797 798 adjustments: Optional[List[Adjustment]] 799 """List of Build Matrix adjustments""" 800 801 setup: Union[List[Union[int, bool, str]], Dict[str, List[Union[int, bool, str]]]] 802 803 def __init__( 804 self, 805 adjustments: Optional[List[Adjustment]], 806 setup: Union[ 807 List[Union[int, bool, str]], Dict[str, List[Union[int, bool, str]]] 808 ], 809 ) -> None: 810 self.adjustments = adjustments 811 self.setup = setup 812 813 @staticmethod 814 def from_dict(obj: Any) -> "MatrixClass": 815 assert isinstance(obj, dict) 816 adjustments = from_union( 817 [lambda x: from_list(Adjustment.from_dict, x), from_none], 818 obj.get("adjustments"), 819 ) 820 setup = from_union( 821 [ 822 lambda x: from_list( 823 lambda x: from_union([from_int, from_bool, from_str], x), x 824 ), 825 lambda x: from_dict( 826 lambda x: from_list( 827 lambda x: from_union([from_int, from_bool, from_str], x), x 828 ), 829 x, 830 ), 831 ], 832 obj.get("setup"), 833 ) 834 return MatrixClass(adjustments, setup) 835 836 def to_dict(self) -> dict: 837 result: dict = {} 838 if self.adjustments is not None: 839 result["adjustments"] = from_union( 840 [lambda x: from_list(lambda x: to_class(Adjustment, x), x), from_none], 841 self.adjustments, 842 ) 843 result["setup"] = from_union( 844 [ 845 lambda x: from_list( 846 lambda x: from_union([from_int, from_bool, from_str], x), x 847 ), 848 lambda x: from_dict( 849 lambda x: from_list( 850 lambda x: from_union([from_int, from_bool, from_str], x), x 851 ), 852 x, 853 ), 854 ], 855 self.setup, 856 ) 857 return result 858 859 860class FluffyGithubCommitStatus: 861 context: Optional[str] 862 """GitHub commit status name""" 863 864 def __init__(self, context: Optional[str]) -> None: 865 self.context = context 866 867 @staticmethod 868 def from_dict(obj: Any) -> "FluffyGithubCommitStatus": 869 assert isinstance(obj, dict) 870 context = from_union([from_str, from_none], obj.get("context")) 871 return FluffyGithubCommitStatus(context) 872 873 def to_dict(self) -> dict: 874 result: dict = {} 875 if self.context is not None: 876 result["context"] = from_union([from_str, from_none], self.context) 877 return result 878 879 880class FluffySlack: 881 channels: Optional[List[str]] 882 message: Optional[str] 883 884 def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None: 885 self.channels = channels 886 self.message = message 887 888 @staticmethod 889 def from_dict(obj: Any) -> "FluffySlack": 890 assert isinstance(obj, dict) 891 channels = from_union( 892 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 893 ) 894 message = from_union([from_str, from_none], obj.get("message")) 895 return FluffySlack(channels, message) 896 897 def to_dict(self) -> dict: 898 result: dict = {} 899 if self.channels is not None: 900 result["channels"] = from_union( 901 [lambda x: from_list(from_str, x), from_none], self.channels 902 ) 903 if self.message is not None: 904 result["message"] = from_union([from_str, from_none], self.message) 905 return result 906 907 908class NotifyClass: 909 basecamp_campfire: Optional[str] 910 notify_if: Optional[str] 911 slack: Optional[Union[FluffySlack, str]] 912 github_commit_status: Optional[FluffyGithubCommitStatus] 913 github_check: Optional[Dict[str, Any]] 914 915 def __init__( 916 self, 917 basecamp_campfire: Optional[str], 918 notify_if: Optional[str], 919 slack: Optional[Union[FluffySlack, str]], 920 github_commit_status: Optional[FluffyGithubCommitStatus], 921 github_check: Optional[Dict[str, Any]], 922 ) -> None: 923 self.basecamp_campfire = basecamp_campfire 924 self.notify_if = notify_if 925 self.slack = slack 926 self.github_commit_status = github_commit_status 927 self.github_check = github_check 928 929 @staticmethod 930 def from_dict(obj: Any) -> "NotifyClass": 931 assert isinstance(obj, dict) 932 basecamp_campfire = from_union( 933 [from_str, from_none], obj.get("basecamp_campfire") 934 ) 935 notify_if = from_union([from_str, from_none], obj.get("if")) 936 slack = from_union( 937 [FluffySlack.from_dict, from_str, from_none], obj.get("slack") 938 ) 939 github_commit_status = from_union( 940 [FluffyGithubCommitStatus.from_dict, from_none], 941 obj.get("github_commit_status"), 942 ) 943 github_check = from_union( 944 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 945 ) 946 return NotifyClass( 947 basecamp_campfire, notify_if, slack, github_commit_status, github_check 948 ) 949 950 def to_dict(self) -> dict: 951 result: dict = {} 952 if self.basecamp_campfire is not None: 953 result["basecamp_campfire"] = from_union( 954 [from_str, from_none], self.basecamp_campfire 955 ) 956 if self.notify_if is not None: 957 result["if"] = from_union([from_str, from_none], self.notify_if) 958 if self.slack is not None: 959 result["slack"] = from_union( 960 [lambda x: to_class(FluffySlack, x), from_str, from_none], self.slack 961 ) 962 if self.github_commit_status is not None: 963 result["github_commit_status"] = from_union( 964 [lambda x: to_class(FluffyGithubCommitStatus, x), from_none], 965 self.github_commit_status, 966 ) 967 if self.github_check is not None: 968 result["github_check"] = from_union( 969 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 970 ) 971 return result 972 973 974class SignalReason(Enum): 975 """The exit signal reason, if any, that may be retried""" 976 977 AGENT_REFUSED = "agent_refused" 978 AGENT_STOP = "agent_stop" 979 CANCEL = "cancel" 980 EMPTY = "*" 981 NONE = "none" 982 PROCESS_RUN_ERROR = "process_run_error" 983 SIGNATURE_REJECTED = "signature_rejected" 984 985 986class AutomaticRetry: 987 exit_status: Optional[Union[int, List[int], ExitStatusEnum]] 988 """The exit status number that will cause this job to retry""" 989 990 limit: Optional[int] 991 """The number of times this job can be retried""" 992 993 signal: Optional[str] 994 """The exit signal, if any, that may be retried""" 995 996 signal_reason: Optional[SignalReason] 997 """The exit signal reason, if any, that may be retried""" 998 999 def __init__( 1000 self, 1001 exit_status: Optional[Union[int, List[int], ExitStatusEnum]], 1002 limit: Optional[int], 1003 signal: Optional[str], 1004 signal_reason: Optional[SignalReason], 1005 ) -> None: 1006 self.exit_status = exit_status 1007 self.limit = limit 1008 self.signal = signal 1009 self.signal_reason = signal_reason 1010 1011 @staticmethod 1012 def from_dict(obj: Any) -> "AutomaticRetry": 1013 assert isinstance(obj, dict) 1014 exit_status = from_union( 1015 [from_int, lambda x: from_list(from_int, x), ExitStatusEnum, from_none], 1016 obj.get("exit_status"), 1017 ) 1018 limit = from_union([from_int, from_none], obj.get("limit")) 1019 signal = from_union([from_str, from_none], obj.get("signal")) 1020 signal_reason = from_union([SignalReason, from_none], obj.get("signal_reason")) 1021 return AutomaticRetry(exit_status, limit, signal, signal_reason) 1022 1023 def to_dict(self) -> dict: 1024 result: dict = {} 1025 if self.exit_status is not None: 1026 result["exit_status"] = from_union( 1027 [ 1028 from_int, 1029 lambda x: from_list(from_int, x), 1030 lambda x: to_enum(ExitStatusEnum, x), 1031 from_none, 1032 ], 1033 self.exit_status, 1034 ) 1035 if self.limit is not None: 1036 result["limit"] = from_union([from_int, from_none], self.limit) 1037 if self.signal is not None: 1038 result["signal"] = from_union([from_str, from_none], self.signal) 1039 if self.signal_reason is not None: 1040 result["signal_reason"] = from_union( 1041 [lambda x: to_enum(SignalReason, x), from_none], self.signal_reason 1042 ) 1043 return result 1044 1045 1046class ManualClass: 1047 allowed: Optional[Union[bool, AllowDependencyFailureEnum]] 1048 """Whether or not this job can be retried manually""" 1049 1050 permit_on_passed: Optional[Union[bool, AllowDependencyFailureEnum]] 1051 """Whether or not this job can be retried after it has passed""" 1052 1053 reason: Optional[str] 1054 """A string that will be displayed in a tooltip on the Retry button in Buildkite. This will 1055 only be displayed if the allowed attribute is set to false. 1056 """ 1057 1058 def __init__( 1059 self, 1060 allowed: Optional[Union[bool, AllowDependencyFailureEnum]], 1061 permit_on_passed: Optional[Union[bool, AllowDependencyFailureEnum]], 1062 reason: Optional[str], 1063 ) -> None: 1064 self.allowed = allowed 1065 self.permit_on_passed = permit_on_passed 1066 self.reason = reason 1067 1068 @staticmethod 1069 def from_dict(obj: Any) -> "ManualClass": 1070 assert isinstance(obj, dict) 1071 allowed = from_union( 1072 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("allowed") 1073 ) 1074 permit_on_passed = from_union( 1075 [from_bool, AllowDependencyFailureEnum, from_none], 1076 obj.get("permit_on_passed"), 1077 ) 1078 reason = from_union([from_str, from_none], obj.get("reason")) 1079 return ManualClass(allowed, permit_on_passed, reason) 1080 1081 def to_dict(self) -> dict: 1082 result: dict = {} 1083 if self.allowed is not None: 1084 result["allowed"] = from_union( 1085 [ 1086 from_bool, 1087 lambda x: to_enum(AllowDependencyFailureEnum, x), 1088 from_none, 1089 ], 1090 self.allowed, 1091 ) 1092 if self.permit_on_passed is not None: 1093 result["permit_on_passed"] = from_union( 1094 [ 1095 from_bool, 1096 lambda x: to_enum(AllowDependencyFailureEnum, x), 1097 from_none, 1098 ], 1099 self.permit_on_passed, 1100 ) 1101 if self.reason is not None: 1102 result["reason"] = from_union([from_str, from_none], self.reason) 1103 return result 1104 1105 1106class Retry: 1107 """The conditions for retrying this step.""" 1108 1109 automatic: Optional[ 1110 Union[bool, AutomaticRetry, List[AutomaticRetry], AllowDependencyFailureEnum] 1111 ] 1112 """Whether to allow a job to retry automatically. If set to true, the retry conditions are 1113 set to the default value. 1114 """ 1115 manual: Optional[Union[bool, ManualClass, AllowDependencyFailureEnum]] 1116 """Whether to allow a job to be retried manually""" 1117 1118 def __init__( 1119 self, 1120 automatic: Optional[ 1121 Union[ 1122 bool, AutomaticRetry, List[AutomaticRetry], AllowDependencyFailureEnum 1123 ] 1124 ], 1125 manual: Optional[Union[bool, ManualClass, AllowDependencyFailureEnum]], 1126 ) -> None: 1127 self.automatic = automatic 1128 self.manual = manual 1129 1130 @staticmethod 1131 def from_dict(obj: Any) -> "Retry": 1132 assert isinstance(obj, dict) 1133 automatic = from_union( 1134 [ 1135 from_bool, 1136 AutomaticRetry.from_dict, 1137 lambda x: from_list(AutomaticRetry.from_dict, x), 1138 AllowDependencyFailureEnum, 1139 from_none, 1140 ], 1141 obj.get("automatic"), 1142 ) 1143 manual = from_union( 1144 [from_bool, ManualClass.from_dict, AllowDependencyFailureEnum, from_none], 1145 obj.get("manual"), 1146 ) 1147 return Retry(automatic, manual) 1148 1149 def to_dict(self) -> dict: 1150 result: dict = {} 1151 if self.automatic is not None: 1152 result["automatic"] = from_union( 1153 [ 1154 from_bool, 1155 lambda x: to_class(AutomaticRetry, x), 1156 lambda x: from_list(lambda x: to_class(AutomaticRetry, x), x), 1157 lambda x: to_enum(AllowDependencyFailureEnum, x), 1158 from_none, 1159 ], 1160 self.automatic, 1161 ) 1162 if self.manual is not None: 1163 result["manual"] = from_union( 1164 [ 1165 from_bool, 1166 lambda x: to_class(ManualClass, x), 1167 lambda x: to_enum(AllowDependencyFailureEnum, x), 1168 from_none, 1169 ], 1170 self.manual, 1171 ) 1172 return result 1173 1174 1175class Signature: 1176 """The signature of the command step, generally injected by agents at pipeline upload""" 1177 1178 algorithm: Optional[str] 1179 """The algorithm used to generate the signature""" 1180 1181 signed_fields: Optional[List[str]] 1182 """The fields that were signed to form the signature value""" 1183 1184 value: Optional[str] 1185 """The signature value, a JWS compact signature with a detached body""" 1186 1187 def __init__( 1188 self, 1189 algorithm: Optional[str], 1190 signed_fields: Optional[List[str]], 1191 value: Optional[str], 1192 ) -> None: 1193 self.algorithm = algorithm 1194 self.signed_fields = signed_fields 1195 self.value = value 1196 1197 @staticmethod 1198 def from_dict(obj: Any) -> "Signature": 1199 assert isinstance(obj, dict) 1200 algorithm = from_union([from_str, from_none], obj.get("algorithm")) 1201 signed_fields = from_union( 1202 [lambda x: from_list(from_str, x), from_none], obj.get("signed_fields") 1203 ) 1204 value = from_union([from_str, from_none], obj.get("value")) 1205 return Signature(algorithm, signed_fields, value) 1206 1207 def to_dict(self) -> dict: 1208 result: dict = {} 1209 if self.algorithm is not None: 1210 result["algorithm"] = from_union([from_str, from_none], self.algorithm) 1211 if self.signed_fields is not None: 1212 result["signed_fields"] = from_union( 1213 [lambda x: from_list(from_str, x), from_none], self.signed_fields 1214 ) 1215 if self.value is not None: 1216 result["value"] = from_union([from_str, from_none], self.value) 1217 return result 1218 1219 1220class CommandType(Enum): 1221 COMMAND = "command" 1222 COMMANDS = "commands" 1223 SCRIPT = "script" 1224 1225 1226class CommandStep: 1227 agents: Optional[Union[Dict[str, Any], List[str]]] 1228 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 1229 artifact_paths: Optional[Union[List[str], str]] 1230 """The glob path/s of artifacts to upload once this step has finished running""" 1231 1232 branches: Optional[Union[List[str], str]] 1233 cache: Optional[Union[List[str], CacheClass, str]] 1234 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]] 1235 command: Optional[Union[List[str], str]] 1236 """The commands to run on the agent""" 1237 1238 commands: Optional[Union[List[str], str]] 1239 """The commands to run on the agent""" 1240 1241 concurrency: Optional[int] 1242 """The maximum number of jobs created from this step that are allowed to run at the same 1243 time. If you use this attribute, you must also define concurrency_group. 1244 """ 1245 concurrency_group: Optional[str] 1246 """A unique name for the concurrency group that you are creating with the concurrency 1247 attribute 1248 """ 1249 concurrency_method: Optional[ConcurrencyMethod] 1250 """Control command order, allowed values are 'ordered' (default) and 'eager'. If you use 1251 this attribute, you must also define concurrency_group and concurrency. 1252 """ 1253 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 1254 env: Optional[Dict[str, Any]] 1255 id: Optional[str] 1256 identifier: Optional[str] 1257 command_step_if: Optional[str] 1258 key: Optional[str] 1259 label: Optional[str] 1260 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]] 1261 name: Optional[str] 1262 notify: Optional[List[Union[NotifyClass, NotifyEnum]]] 1263 """Array of notification options for this step""" 1264 1265 parallelism: Optional[int] 1266 """The number of parallel jobs that will be created based on this step""" 1267 1268 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]] 1269 priority: Optional[int] 1270 """Priority of the job, higher priorities are assigned to agents""" 1271 1272 retry: Optional[Retry] 1273 """The conditions for retrying this step.""" 1274 1275 signature: Optional[Signature] 1276 """The signature of the command step, generally injected by agents at pipeline upload""" 1277 1278 skip: Optional[Union[bool, str]] 1279 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 1280 timeout_in_minutes: Optional[int] 1281 """The number of minutes to time out a job""" 1282 1283 type: Optional[CommandType] 1284 1285 def __init__( 1286 self, 1287 agents: Optional[Union[Dict[str, Any], List[str]]], 1288 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 1289 artifact_paths: Optional[Union[List[str], str]], 1290 branches: Optional[Union[List[str], str]], 1291 cache: Optional[Union[List[str], CacheClass, str]], 1292 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 1293 command: Optional[Union[List[str], str]], 1294 commands: Optional[Union[List[str], str]], 1295 concurrency: Optional[int], 1296 concurrency_group: Optional[str], 1297 concurrency_method: Optional[ConcurrencyMethod], 1298 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 1299 env: Optional[Dict[str, Any]], 1300 id: Optional[str], 1301 identifier: Optional[str], 1302 command_step_if: Optional[str], 1303 key: Optional[str], 1304 label: Optional[str], 1305 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 1306 name: Optional[str], 1307 notify: Optional[List[Union[NotifyClass, NotifyEnum]]], 1308 parallelism: Optional[int], 1309 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 1310 priority: Optional[int], 1311 retry: Optional[Retry], 1312 signature: Optional[Signature], 1313 skip: Optional[Union[bool, str]], 1314 soft_fail: Optional[ 1315 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 1316 ], 1317 timeout_in_minutes: Optional[int], 1318 type: Optional[CommandType], 1319 ) -> None: 1320 self.agents = agents 1321 self.allow_dependency_failure = allow_dependency_failure 1322 self.artifact_paths = artifact_paths 1323 self.branches = branches 1324 self.cache = cache 1325 self.cancel_on_build_failing = cancel_on_build_failing 1326 self.command = command 1327 self.commands = commands 1328 self.concurrency = concurrency 1329 self.concurrency_group = concurrency_group 1330 self.concurrency_method = concurrency_method 1331 self.depends_on = depends_on 1332 self.env = env 1333 self.id = id 1334 self.identifier = identifier 1335 self.command_step_if = command_step_if 1336 self.key = key 1337 self.label = label 1338 self.matrix = matrix 1339 self.name = name 1340 self.notify = notify 1341 self.parallelism = parallelism 1342 self.plugins = plugins 1343 self.priority = priority 1344 self.retry = retry 1345 self.signature = signature 1346 self.skip = skip 1347 self.soft_fail = soft_fail 1348 self.timeout_in_minutes = timeout_in_minutes 1349 self.type = type 1350 1351 @staticmethod 1352 def from_dict(obj: Any) -> "CommandStep": 1353 assert isinstance(obj, dict) 1354 agents = from_union( 1355 [ 1356 lambda x: from_dict(lambda x: x, x), 1357 lambda x: from_list(from_str, x), 1358 from_none, 1359 ], 1360 obj.get("agents"), 1361 ) 1362 allow_dependency_failure = from_union( 1363 [from_bool, AllowDependencyFailureEnum, from_none], 1364 obj.get("allow_dependency_failure"), 1365 ) 1366 artifact_paths = from_union( 1367 [lambda x: from_list(from_str, x), from_str, from_none], 1368 obj.get("artifact_paths"), 1369 ) 1370 branches = from_union( 1371 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 1372 ) 1373 cache = from_union( 1374 [ 1375 lambda x: from_list(from_str, x), 1376 CacheClass.from_dict, 1377 from_str, 1378 from_none, 1379 ], 1380 obj.get("cache"), 1381 ) 1382 cancel_on_build_failing = from_union( 1383 [from_bool, AllowDependencyFailureEnum, from_none], 1384 obj.get("cancel_on_build_failing"), 1385 ) 1386 command = from_union( 1387 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("command") 1388 ) 1389 commands = from_union( 1390 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("commands") 1391 ) 1392 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 1393 concurrency_group = from_union( 1394 [from_str, from_none], obj.get("concurrency_group") 1395 ) 1396 concurrency_method = from_union( 1397 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 1398 ) 1399 depends_on = from_union( 1400 [ 1401 from_none, 1402 lambda x: from_list( 1403 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 1404 ), 1405 from_str, 1406 ], 1407 obj.get("depends_on"), 1408 ) 1409 env = from_union( 1410 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 1411 ) 1412 id = from_union([from_str, from_none], obj.get("id")) 1413 identifier = from_union([from_str, from_none], obj.get("identifier")) 1414 command_step_if = from_union([from_str, from_none], obj.get("if")) 1415 key = from_union([from_str, from_none], obj.get("key")) 1416 label = from_union([from_str, from_none], obj.get("label")) 1417 matrix = from_union( 1418 [ 1419 lambda x: from_list( 1420 lambda x: from_union([from_int, from_bool, from_str], x), x 1421 ), 1422 MatrixClass.from_dict, 1423 from_none, 1424 ], 1425 obj.get("matrix"), 1426 ) 1427 name = from_union([from_str, from_none], obj.get("name")) 1428 notify = from_union( 1429 [ 1430 lambda x: from_list( 1431 lambda x: from_union([NotifyClass.from_dict, NotifyEnum], x), x 1432 ), 1433 from_none, 1434 ], 1435 obj.get("notify"), 1436 ) 1437 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 1438 plugins = from_union( 1439 [ 1440 lambda x: from_list( 1441 lambda x: from_union( 1442 [lambda x: from_dict(lambda x: x, x), from_str], x 1443 ), 1444 x, 1445 ), 1446 lambda x: from_dict(lambda x: x, x), 1447 from_none, 1448 ], 1449 obj.get("plugins"), 1450 ) 1451 priority = from_union([from_int, from_none], obj.get("priority")) 1452 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 1453 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 1454 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 1455 soft_fail = from_union( 1456 [ 1457 from_bool, 1458 lambda x: from_list(SoftFailElement.from_dict, x), 1459 AllowDependencyFailureEnum, 1460 from_none, 1461 ], 1462 obj.get("soft_fail"), 1463 ) 1464 timeout_in_minutes = from_union( 1465 [from_int, from_none], obj.get("timeout_in_minutes") 1466 ) 1467 type = from_union([CommandType, from_none], obj.get("type")) 1468 return CommandStep( 1469 agents, 1470 allow_dependency_failure, 1471 artifact_paths, 1472 branches, 1473 cache, 1474 cancel_on_build_failing, 1475 command, 1476 commands, 1477 concurrency, 1478 concurrency_group, 1479 concurrency_method, 1480 depends_on, 1481 env, 1482 id, 1483 identifier, 1484 command_step_if, 1485 key, 1486 label, 1487 matrix, 1488 name, 1489 notify, 1490 parallelism, 1491 plugins, 1492 priority, 1493 retry, 1494 signature, 1495 skip, 1496 soft_fail, 1497 timeout_in_minutes, 1498 type, 1499 ) 1500 1501 def to_dict(self) -> dict: 1502 result: dict = {} 1503 if self.agents is not None: 1504 result["agents"] = from_union( 1505 [ 1506 lambda x: from_dict(lambda x: x, x), 1507 lambda x: from_list(from_str, x), 1508 from_none, 1509 ], 1510 self.agents, 1511 ) 1512 if self.allow_dependency_failure is not None: 1513 result["allow_dependency_failure"] = from_union( 1514 [ 1515 from_bool, 1516 lambda x: to_enum(AllowDependencyFailureEnum, x), 1517 from_none, 1518 ], 1519 self.allow_dependency_failure, 1520 ) 1521 if self.artifact_paths is not None: 1522 result["artifact_paths"] = from_union( 1523 [lambda x: from_list(from_str, x), from_str, from_none], 1524 self.artifact_paths, 1525 ) 1526 if self.branches is not None: 1527 result["branches"] = from_union( 1528 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 1529 ) 1530 if self.cache is not None: 1531 result["cache"] = from_union( 1532 [ 1533 lambda x: from_list(from_str, x), 1534 lambda x: to_class(CacheClass, x), 1535 from_str, 1536 from_none, 1537 ], 1538 self.cache, 1539 ) 1540 if self.cancel_on_build_failing is not None: 1541 result["cancel_on_build_failing"] = from_union( 1542 [ 1543 from_bool, 1544 lambda x: to_enum(AllowDependencyFailureEnum, x), 1545 from_none, 1546 ], 1547 self.cancel_on_build_failing, 1548 ) 1549 if self.command is not None: 1550 result["command"] = from_union( 1551 [lambda x: from_list(from_str, x), from_str, from_none], self.command 1552 ) 1553 if self.commands is not None: 1554 result["commands"] = from_union( 1555 [lambda x: from_list(from_str, x), from_str, from_none], self.commands 1556 ) 1557 if self.concurrency is not None: 1558 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 1559 if self.concurrency_group is not None: 1560 result["concurrency_group"] = from_union( 1561 [from_str, from_none], self.concurrency_group 1562 ) 1563 if self.concurrency_method is not None: 1564 result["concurrency_method"] = from_union( 1565 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 1566 self.concurrency_method, 1567 ) 1568 if self.depends_on is not None: 1569 result["depends_on"] = from_union( 1570 [ 1571 from_none, 1572 lambda x: from_list( 1573 lambda x: from_union( 1574 [lambda x: to_class(DependsOnClass, x), from_str], x 1575 ), 1576 x, 1577 ), 1578 from_str, 1579 ], 1580 self.depends_on, 1581 ) 1582 if self.env is not None: 1583 result["env"] = from_union( 1584 [lambda x: from_dict(lambda x: x, x), from_none], self.env 1585 ) 1586 if self.id is not None: 1587 result["id"] = from_union([from_str, from_none], self.id) 1588 if self.identifier is not None: 1589 result["identifier"] = from_union([from_str, from_none], self.identifier) 1590 if self.command_step_if is not None: 1591 result["if"] = from_union([from_str, from_none], self.command_step_if) 1592 if self.key is not None: 1593 result["key"] = from_union([from_str, from_none], self.key) 1594 if self.label is not None: 1595 result["label"] = from_union([from_str, from_none], self.label) 1596 if self.matrix is not None: 1597 result["matrix"] = from_union( 1598 [ 1599 lambda x: from_list( 1600 lambda x: from_union([from_int, from_bool, from_str], x), x 1601 ), 1602 lambda x: to_class(MatrixClass, x), 1603 from_none, 1604 ], 1605 self.matrix, 1606 ) 1607 if self.name is not None: 1608 result["name"] = from_union([from_str, from_none], self.name) 1609 if self.notify is not None: 1610 result["notify"] = from_union( 1611 [ 1612 lambda x: from_list( 1613 lambda x: from_union( 1614 [ 1615 lambda x: to_class(NotifyClass, x), 1616 lambda x: to_enum(NotifyEnum, x), 1617 ], 1618 x, 1619 ), 1620 x, 1621 ), 1622 from_none, 1623 ], 1624 self.notify, 1625 ) 1626 if self.parallelism is not None: 1627 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 1628 if self.plugins is not None: 1629 result["plugins"] = from_union( 1630 [ 1631 lambda x: from_list( 1632 lambda x: from_union( 1633 [lambda x: from_dict(lambda x: x, x), from_str], x 1634 ), 1635 x, 1636 ), 1637 lambda x: from_dict(lambda x: x, x), 1638 from_none, 1639 ], 1640 self.plugins, 1641 ) 1642 if self.priority is not None: 1643 result["priority"] = from_union([from_int, from_none], self.priority) 1644 if self.retry is not None: 1645 result["retry"] = from_union( 1646 [lambda x: to_class(Retry, x), from_none], self.retry 1647 ) 1648 if self.signature is not None: 1649 result["signature"] = from_union( 1650 [lambda x: to_class(Signature, x), from_none], self.signature 1651 ) 1652 if self.skip is not None: 1653 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 1654 if self.soft_fail is not None: 1655 result["soft_fail"] = from_union( 1656 [ 1657 from_bool, 1658 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 1659 lambda x: to_enum(AllowDependencyFailureEnum, x), 1660 from_none, 1661 ], 1662 self.soft_fail, 1663 ) 1664 if self.timeout_in_minutes is not None: 1665 result["timeout_in_minutes"] = from_union( 1666 [from_int, from_none], self.timeout_in_minutes 1667 ) 1668 if self.type is not None: 1669 result["type"] = from_union( 1670 [lambda x: to_enum(CommandType, x), from_none], self.type 1671 ) 1672 return result 1673 1674 1675class InputType(Enum): 1676 INPUT = "input" 1677 1678 1679class InputStep: 1680 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 1681 branches: Optional[Union[List[str], str]] 1682 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 1683 fields: Optional[List[Field]] 1684 id: Optional[str] 1685 identifier: Optional[str] 1686 input_step_if: Optional[str] 1687 input: Optional[str] 1688 """The label of the input step""" 1689 1690 key: Optional[str] 1691 label: Optional[str] 1692 name: Optional[str] 1693 prompt: Optional[str] 1694 type: Optional[InputType] 1695 1696 def __init__( 1697 self, 1698 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 1699 branches: Optional[Union[List[str], str]], 1700 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 1701 fields: Optional[List[Field]], 1702 id: Optional[str], 1703 identifier: Optional[str], 1704 input_step_if: Optional[str], 1705 input: Optional[str], 1706 key: Optional[str], 1707 label: Optional[str], 1708 name: Optional[str], 1709 prompt: Optional[str], 1710 type: Optional[InputType], 1711 ) -> None: 1712 self.allow_dependency_failure = allow_dependency_failure 1713 self.branches = branches 1714 self.depends_on = depends_on 1715 self.fields = fields 1716 self.id = id 1717 self.identifier = identifier 1718 self.input_step_if = input_step_if 1719 self.input = input 1720 self.key = key 1721 self.label = label 1722 self.name = name 1723 self.prompt = prompt 1724 self.type = type 1725 1726 @staticmethod 1727 def from_dict(obj: Any) -> "InputStep": 1728 assert isinstance(obj, dict) 1729 allow_dependency_failure = from_union( 1730 [from_bool, AllowDependencyFailureEnum, from_none], 1731 obj.get("allow_dependency_failure"), 1732 ) 1733 branches = from_union( 1734 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 1735 ) 1736 depends_on = from_union( 1737 [ 1738 from_none, 1739 lambda x: from_list( 1740 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 1741 ), 1742 from_str, 1743 ], 1744 obj.get("depends_on"), 1745 ) 1746 fields = from_union( 1747 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 1748 ) 1749 id = from_union([from_str, from_none], obj.get("id")) 1750 identifier = from_union([from_str, from_none], obj.get("identifier")) 1751 input_step_if = from_union([from_str, from_none], obj.get("if")) 1752 input = from_union([from_str, from_none], obj.get("input")) 1753 key = from_union([from_str, from_none], obj.get("key")) 1754 label = from_union([from_str, from_none], obj.get("label")) 1755 name = from_union([from_str, from_none], obj.get("name")) 1756 prompt = from_union([from_str, from_none], obj.get("prompt")) 1757 type = from_union([InputType, from_none], obj.get("type")) 1758 return InputStep( 1759 allow_dependency_failure, 1760 branches, 1761 depends_on, 1762 fields, 1763 id, 1764 identifier, 1765 input_step_if, 1766 input, 1767 key, 1768 label, 1769 name, 1770 prompt, 1771 type, 1772 ) 1773 1774 def to_dict(self) -> dict: 1775 result: dict = {} 1776 if self.allow_dependency_failure is not None: 1777 result["allow_dependency_failure"] = from_union( 1778 [ 1779 from_bool, 1780 lambda x: to_enum(AllowDependencyFailureEnum, x), 1781 from_none, 1782 ], 1783 self.allow_dependency_failure, 1784 ) 1785 if self.branches is not None: 1786 result["branches"] = from_union( 1787 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 1788 ) 1789 if self.depends_on is not None: 1790 result["depends_on"] = from_union( 1791 [ 1792 from_none, 1793 lambda x: from_list( 1794 lambda x: from_union( 1795 [lambda x: to_class(DependsOnClass, x), from_str], x 1796 ), 1797 x, 1798 ), 1799 from_str, 1800 ], 1801 self.depends_on, 1802 ) 1803 if self.fields is not None: 1804 result["fields"] = from_union( 1805 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 1806 self.fields, 1807 ) 1808 if self.id is not None: 1809 result["id"] = from_union([from_str, from_none], self.id) 1810 if self.identifier is not None: 1811 result["identifier"] = from_union([from_str, from_none], self.identifier) 1812 if self.input_step_if is not None: 1813 result["if"] = from_union([from_str, from_none], self.input_step_if) 1814 if self.input is not None: 1815 result["input"] = from_union([from_str, from_none], self.input) 1816 if self.key is not None: 1817 result["key"] = from_union([from_str, from_none], self.key) 1818 if self.label is not None: 1819 result["label"] = from_union([from_str, from_none], self.label) 1820 if self.name is not None: 1821 result["name"] = from_union([from_str, from_none], self.name) 1822 if self.prompt is not None: 1823 result["prompt"] = from_union([from_str, from_none], self.prompt) 1824 if self.type is not None: 1825 result["type"] = from_union( 1826 [lambda x: to_enum(InputType, x), from_none], self.type 1827 ) 1828 return result 1829 1830 1831class TentacledGithubCommitStatus: 1832 context: Optional[str] 1833 """GitHub commit status name""" 1834 1835 def __init__(self, context: Optional[str]) -> None: 1836 self.context = context 1837 1838 @staticmethod 1839 def from_dict(obj: Any) -> "TentacledGithubCommitStatus": 1840 assert isinstance(obj, dict) 1841 context = from_union([from_str, from_none], obj.get("context")) 1842 return TentacledGithubCommitStatus(context) 1843 1844 def to_dict(self) -> dict: 1845 result: dict = {} 1846 if self.context is not None: 1847 result["context"] = from_union([from_str, from_none], self.context) 1848 return result 1849 1850 1851class TentacledSlack: 1852 channels: Optional[List[str]] 1853 message: Optional[str] 1854 1855 def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None: 1856 self.channels = channels 1857 self.message = message 1858 1859 @staticmethod 1860 def from_dict(obj: Any) -> "TentacledSlack": 1861 assert isinstance(obj, dict) 1862 channels = from_union( 1863 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 1864 ) 1865 message = from_union([from_str, from_none], obj.get("message")) 1866 return TentacledSlack(channels, message) 1867 1868 def to_dict(self) -> dict: 1869 result: dict = {} 1870 if self.channels is not None: 1871 result["channels"] = from_union( 1872 [lambda x: from_list(from_str, x), from_none], self.channels 1873 ) 1874 if self.message is not None: 1875 result["message"] = from_union([from_str, from_none], self.message) 1876 return result 1877 1878 1879class FluffyBuildNotify: 1880 basecamp_campfire: Optional[str] 1881 build_notify_if: Optional[str] 1882 slack: Optional[Union[TentacledSlack, str]] 1883 github_commit_status: Optional[TentacledGithubCommitStatus] 1884 github_check: Optional[Dict[str, Any]] 1885 email: Optional[str] 1886 webhook: Optional[str] 1887 pagerduty_change_event: Optional[str] 1888 1889 def __init__( 1890 self, 1891 basecamp_campfire: Optional[str], 1892 build_notify_if: Optional[str], 1893 slack: Optional[Union[TentacledSlack, str]], 1894 github_commit_status: Optional[TentacledGithubCommitStatus], 1895 github_check: Optional[Dict[str, Any]], 1896 email: Optional[str], 1897 webhook: Optional[str], 1898 pagerduty_change_event: Optional[str], 1899 ) -> None: 1900 self.basecamp_campfire = basecamp_campfire 1901 self.build_notify_if = build_notify_if 1902 self.slack = slack 1903 self.github_commit_status = github_commit_status 1904 self.github_check = github_check 1905 self.email = email 1906 self.webhook = webhook 1907 self.pagerduty_change_event = pagerduty_change_event 1908 1909 @staticmethod 1910 def from_dict(obj: Any) -> "FluffyBuildNotify": 1911 assert isinstance(obj, dict) 1912 basecamp_campfire = from_union( 1913 [from_str, from_none], obj.get("basecamp_campfire") 1914 ) 1915 build_notify_if = from_union([from_str, from_none], obj.get("if")) 1916 slack = from_union( 1917 [TentacledSlack.from_dict, from_str, from_none], obj.get("slack") 1918 ) 1919 github_commit_status = from_union( 1920 [TentacledGithubCommitStatus.from_dict, from_none], 1921 obj.get("github_commit_status"), 1922 ) 1923 github_check = from_union( 1924 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 1925 ) 1926 email = from_union([from_str, from_none], obj.get("email")) 1927 webhook = from_union([from_str, from_none], obj.get("webhook")) 1928 pagerduty_change_event = from_union( 1929 [from_str, from_none], obj.get("pagerduty_change_event") 1930 ) 1931 return FluffyBuildNotify( 1932 basecamp_campfire, 1933 build_notify_if, 1934 slack, 1935 github_commit_status, 1936 github_check, 1937 email, 1938 webhook, 1939 pagerduty_change_event, 1940 ) 1941 1942 def to_dict(self) -> dict: 1943 result: dict = {} 1944 if self.basecamp_campfire is not None: 1945 result["basecamp_campfire"] = from_union( 1946 [from_str, from_none], self.basecamp_campfire 1947 ) 1948 if self.build_notify_if is not None: 1949 result["if"] = from_union([from_str, from_none], self.build_notify_if) 1950 if self.slack is not None: 1951 result["slack"] = from_union( 1952 [lambda x: to_class(TentacledSlack, x), from_str, from_none], self.slack 1953 ) 1954 if self.github_commit_status is not None: 1955 result["github_commit_status"] = from_union( 1956 [lambda x: to_class(TentacledGithubCommitStatus, x), from_none], 1957 self.github_commit_status, 1958 ) 1959 if self.github_check is not None: 1960 result["github_check"] = from_union( 1961 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 1962 ) 1963 if self.email is not None: 1964 result["email"] = from_union([from_str, from_none], self.email) 1965 if self.webhook is not None: 1966 result["webhook"] = from_union([from_str, from_none], self.webhook) 1967 if self.pagerduty_change_event is not None: 1968 result["pagerduty_change_event"] = from_union( 1969 [from_str, from_none], self.pagerduty_change_event 1970 ) 1971 return result 1972 1973 1974class TriggerType(Enum): 1975 TRIGGER = "trigger" 1976 1977 1978class TriggerStep: 1979 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 1980 trigger_step_async: Optional[Union[bool, AllowDependencyFailureEnum]] 1981 """Whether to continue the build without waiting for the triggered step to complete""" 1982 1983 branches: Optional[Union[List[str], str]] 1984 build: Optional[Build] 1985 """Properties of the build that will be created when the step is triggered""" 1986 1987 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 1988 id: Optional[str] 1989 identifier: Optional[str] 1990 trigger_step_if: Optional[str] 1991 key: Optional[str] 1992 label: Optional[str] 1993 name: Optional[str] 1994 skip: Optional[Union[bool, str]] 1995 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 1996 trigger: str 1997 """The slug of the pipeline to create a build""" 1998 1999 type: Optional[TriggerType] 2000 2001 def __init__( 2002 self, 2003 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2004 trigger_step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 2005 branches: Optional[Union[List[str], str]], 2006 build: Optional[Build], 2007 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2008 id: Optional[str], 2009 identifier: Optional[str], 2010 trigger_step_if: Optional[str], 2011 key: Optional[str], 2012 label: Optional[str], 2013 name: Optional[str], 2014 skip: Optional[Union[bool, str]], 2015 soft_fail: Optional[ 2016 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 2017 ], 2018 trigger: str, 2019 type: Optional[TriggerType], 2020 ) -> None: 2021 self.allow_dependency_failure = allow_dependency_failure 2022 self.trigger_step_async = trigger_step_async 2023 self.branches = branches 2024 self.build = build 2025 self.depends_on = depends_on 2026 self.id = id 2027 self.identifier = identifier 2028 self.trigger_step_if = trigger_step_if 2029 self.key = key 2030 self.label = label 2031 self.name = name 2032 self.skip = skip 2033 self.soft_fail = soft_fail 2034 self.trigger = trigger 2035 self.type = type 2036 2037 @staticmethod 2038 def from_dict(obj: Any) -> "TriggerStep": 2039 assert isinstance(obj, dict) 2040 allow_dependency_failure = from_union( 2041 [from_bool, AllowDependencyFailureEnum, from_none], 2042 obj.get("allow_dependency_failure"), 2043 ) 2044 trigger_step_async = from_union( 2045 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 2046 ) 2047 branches = from_union( 2048 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2049 ) 2050 build = from_union([Build.from_dict, from_none], obj.get("build")) 2051 depends_on = from_union( 2052 [ 2053 from_none, 2054 lambda x: from_list( 2055 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2056 ), 2057 from_str, 2058 ], 2059 obj.get("depends_on"), 2060 ) 2061 id = from_union([from_str, from_none], obj.get("id")) 2062 identifier = from_union([from_str, from_none], obj.get("identifier")) 2063 trigger_step_if = from_union([from_str, from_none], obj.get("if")) 2064 key = from_union([from_str, from_none], obj.get("key")) 2065 label = from_union([from_str, from_none], obj.get("label")) 2066 name = from_union([from_str, from_none], obj.get("name")) 2067 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 2068 soft_fail = from_union( 2069 [ 2070 from_bool, 2071 lambda x: from_list(SoftFailElement.from_dict, x), 2072 AllowDependencyFailureEnum, 2073 from_none, 2074 ], 2075 obj.get("soft_fail"), 2076 ) 2077 trigger = from_str(obj.get("trigger")) 2078 type = from_union([TriggerType, from_none], obj.get("type")) 2079 return TriggerStep( 2080 allow_dependency_failure, 2081 trigger_step_async, 2082 branches, 2083 build, 2084 depends_on, 2085 id, 2086 identifier, 2087 trigger_step_if, 2088 key, 2089 label, 2090 name, 2091 skip, 2092 soft_fail, 2093 trigger, 2094 type, 2095 ) 2096 2097 def to_dict(self) -> dict: 2098 result: dict = {} 2099 if self.allow_dependency_failure is not None: 2100 result["allow_dependency_failure"] = from_union( 2101 [ 2102 from_bool, 2103 lambda x: to_enum(AllowDependencyFailureEnum, x), 2104 from_none, 2105 ], 2106 self.allow_dependency_failure, 2107 ) 2108 if self.trigger_step_async is not None: 2109 result["async"] = from_union( 2110 [ 2111 from_bool, 2112 lambda x: to_enum(AllowDependencyFailureEnum, x), 2113 from_none, 2114 ], 2115 self.trigger_step_async, 2116 ) 2117 if self.branches is not None: 2118 result["branches"] = from_union( 2119 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2120 ) 2121 if self.build is not None: 2122 result["build"] = from_union( 2123 [lambda x: to_class(Build, x), from_none], self.build 2124 ) 2125 if self.depends_on is not None: 2126 result["depends_on"] = from_union( 2127 [ 2128 from_none, 2129 lambda x: from_list( 2130 lambda x: from_union( 2131 [lambda x: to_class(DependsOnClass, x), from_str], x 2132 ), 2133 x, 2134 ), 2135 from_str, 2136 ], 2137 self.depends_on, 2138 ) 2139 if self.id is not None: 2140 result["id"] = from_union([from_str, from_none], self.id) 2141 if self.identifier is not None: 2142 result["identifier"] = from_union([from_str, from_none], self.identifier) 2143 if self.trigger_step_if is not None: 2144 result["if"] = from_union([from_str, from_none], self.trigger_step_if) 2145 if self.key is not None: 2146 result["key"] = from_union([from_str, from_none], self.key) 2147 if self.label is not None: 2148 result["label"] = from_union([from_str, from_none], self.label) 2149 if self.name is not None: 2150 result["name"] = from_union([from_str, from_none], self.name) 2151 if self.skip is not None: 2152 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 2153 if self.soft_fail is not None: 2154 result["soft_fail"] = from_union( 2155 [ 2156 from_bool, 2157 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 2158 lambda x: to_enum(AllowDependencyFailureEnum, x), 2159 from_none, 2160 ], 2161 self.soft_fail, 2162 ) 2163 result["trigger"] = from_str(self.trigger) 2164 if self.type is not None: 2165 result["type"] = from_union( 2166 [lambda x: to_enum(TriggerType, x), from_none], self.type 2167 ) 2168 return result 2169 2170 2171class BlockStepType(Enum): 2172 BLOCK = "block" 2173 COMMAND = "command" 2174 COMMANDS = "commands" 2175 INPUT = "input" 2176 SCRIPT = "script" 2177 TRIGGER = "trigger" 2178 WAIT = "wait" 2179 WAITER = "waiter" 2180 2181 2182class WaitType(Enum): 2183 WAIT = "wait" 2184 WAITER = "waiter" 2185 2186 2187class WaitStep: 2188 """Waits for previous steps to pass before continuing""" 2189 2190 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2191 branches: Optional[Union[List[str], str]] 2192 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2193 """Continue to the next steps, even if the previous group of steps fail""" 2194 2195 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 2196 id: Optional[str] 2197 identifier: Optional[str] 2198 wait_step_if: Optional[str] 2199 key: Optional[str] 2200 label: Optional[str] 2201 name: Optional[str] 2202 type: Optional[WaitType] 2203 wait: Optional[str] 2204 """Waits for previous steps to pass before continuing""" 2205 2206 def __init__( 2207 self, 2208 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2209 branches: Optional[Union[List[str], str]], 2210 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2211 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2212 id: Optional[str], 2213 identifier: Optional[str], 2214 wait_step_if: Optional[str], 2215 key: Optional[str], 2216 label: Optional[str], 2217 name: Optional[str], 2218 type: Optional[WaitType], 2219 wait: Optional[str], 2220 ) -> None: 2221 self.allow_dependency_failure = allow_dependency_failure 2222 self.branches = branches 2223 self.continue_on_failure = continue_on_failure 2224 self.depends_on = depends_on 2225 self.id = id 2226 self.identifier = identifier 2227 self.wait_step_if = wait_step_if 2228 self.key = key 2229 self.label = label 2230 self.name = name 2231 self.type = type 2232 self.wait = wait 2233 2234 @staticmethod 2235 def from_dict(obj: Any) -> "WaitStep": 2236 assert isinstance(obj, dict) 2237 allow_dependency_failure = from_union( 2238 [from_bool, AllowDependencyFailureEnum, from_none], 2239 obj.get("allow_dependency_failure"), 2240 ) 2241 branches = from_union( 2242 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2243 ) 2244 continue_on_failure = from_union( 2245 [from_bool, AllowDependencyFailureEnum, from_none], 2246 obj.get("continue_on_failure"), 2247 ) 2248 depends_on = from_union( 2249 [ 2250 from_none, 2251 lambda x: from_list( 2252 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2253 ), 2254 from_str, 2255 ], 2256 obj.get("depends_on"), 2257 ) 2258 id = from_union([from_str, from_none], obj.get("id")) 2259 identifier = from_union([from_str, from_none], obj.get("identifier")) 2260 wait_step_if = from_union([from_str, from_none], obj.get("if")) 2261 key = from_union([from_str, from_none], obj.get("key")) 2262 label = from_union([from_none, from_str], obj.get("label")) 2263 name = from_union([from_none, from_str], obj.get("name")) 2264 type = from_union([WaitType, from_none], obj.get("type")) 2265 wait = from_union([from_none, from_str], obj.get("wait")) 2266 return WaitStep( 2267 allow_dependency_failure, 2268 branches, 2269 continue_on_failure, 2270 depends_on, 2271 id, 2272 identifier, 2273 wait_step_if, 2274 key, 2275 label, 2276 name, 2277 type, 2278 wait, 2279 ) 2280 2281 def to_dict(self) -> dict: 2282 result: dict = {} 2283 if self.allow_dependency_failure is not None: 2284 result["allow_dependency_failure"] = from_union( 2285 [ 2286 from_bool, 2287 lambda x: to_enum(AllowDependencyFailureEnum, x), 2288 from_none, 2289 ], 2290 self.allow_dependency_failure, 2291 ) 2292 if self.branches is not None: 2293 result["branches"] = from_union( 2294 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2295 ) 2296 if self.continue_on_failure is not None: 2297 result["continue_on_failure"] = from_union( 2298 [ 2299 from_bool, 2300 lambda x: to_enum(AllowDependencyFailureEnum, x), 2301 from_none, 2302 ], 2303 self.continue_on_failure, 2304 ) 2305 if self.depends_on is not None: 2306 result["depends_on"] = from_union( 2307 [ 2308 from_none, 2309 lambda x: from_list( 2310 lambda x: from_union( 2311 [lambda x: to_class(DependsOnClass, x), from_str], x 2312 ), 2313 x, 2314 ), 2315 from_str, 2316 ], 2317 self.depends_on, 2318 ) 2319 if self.id is not None: 2320 result["id"] = from_union([from_str, from_none], self.id) 2321 if self.identifier is not None: 2322 result["identifier"] = from_union([from_str, from_none], self.identifier) 2323 if self.wait_step_if is not None: 2324 result["if"] = from_union([from_str, from_none], self.wait_step_if) 2325 if self.key is not None: 2326 result["key"] = from_union([from_str, from_none], self.key) 2327 if self.label is not None: 2328 result["label"] = from_union([from_none, from_str], self.label) 2329 if self.name is not None: 2330 result["name"] = from_union([from_none, from_str], self.name) 2331 if self.type is not None: 2332 result["type"] = from_union( 2333 [lambda x: to_enum(WaitType, x), from_none], self.type 2334 ) 2335 if self.wait is not None: 2336 result["wait"] = from_union([from_none, from_str], self.wait) 2337 return result 2338 2339 2340class PurpleStep: 2341 """Waits for previous steps to pass before continuing""" 2342 2343 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2344 block: Optional[Union[str, BlockStep]] 2345 """The label of the block step""" 2346 2347 blocked_state: Optional[BlockedState] 2348 """The state that the build is set to when the build is blocked by this block step""" 2349 2350 branches: Optional[Union[List[str], str]] 2351 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 2352 fields: Optional[List[Field]] 2353 id: Optional[str] 2354 identifier: Optional[str] 2355 step_if: Optional[str] 2356 key: Optional[str] 2357 label: Optional[str] 2358 name: Optional[str] 2359 prompt: Optional[str] 2360 type: Optional[BlockStepType] 2361 input: Optional[Union[str, InputStep]] 2362 """The label of the input step""" 2363 2364 agents: Optional[Union[Dict[str, Any], List[str]]] 2365 artifact_paths: Optional[Union[List[str], str]] 2366 """The glob path/s of artifacts to upload once this step has finished running""" 2367 2368 cache: Optional[Union[List[str], CacheClass, str]] 2369 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]] 2370 command: Optional[Union[List[str], CommandStep, str]] 2371 """The commands to run on the agent""" 2372 2373 commands: Optional[Union[List[str], CommandStep, str]] 2374 """The commands to run on the agent""" 2375 2376 concurrency: Optional[int] 2377 """The maximum number of jobs created from this step that are allowed to run at the same 2378 time. If you use this attribute, you must also define concurrency_group. 2379 """ 2380 concurrency_group: Optional[str] 2381 """A unique name for the concurrency group that you are creating with the concurrency 2382 attribute 2383 """ 2384 concurrency_method: Optional[ConcurrencyMethod] 2385 """Control command order, allowed values are 'ordered' (default) and 'eager'. If you use 2386 this attribute, you must also define concurrency_group and concurrency. 2387 """ 2388 env: Optional[Dict[str, Any]] 2389 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]] 2390 notify: Optional[List[Union[NotifyClass, NotifyEnum]]] 2391 """Array of notification options for this step""" 2392 2393 parallelism: Optional[int] 2394 """The number of parallel jobs that will be created based on this step""" 2395 2396 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]] 2397 priority: Optional[int] 2398 """Priority of the job, higher priorities are assigned to agents""" 2399 2400 retry: Optional[Retry] 2401 """The conditions for retrying this step.""" 2402 2403 signature: Optional[Signature] 2404 """The signature of the command step, generally injected by agents at pipeline upload""" 2405 2406 skip: Optional[Union[bool, str]] 2407 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 2408 timeout_in_minutes: Optional[int] 2409 """The number of minutes to time out a job""" 2410 2411 script: Optional[CommandStep] 2412 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2413 """Continue to the next steps, even if the previous group of steps fail""" 2414 2415 wait: Optional[Union[WaitStep, str]] 2416 """Waits for previous steps to pass before continuing""" 2417 2418 waiter: Optional[WaitStep] 2419 step_async: Optional[Union[bool, AllowDependencyFailureEnum]] 2420 """Whether to continue the build without waiting for the triggered step to complete""" 2421 2422 build: Optional[Build] 2423 """Properties of the build that will be created when the step is triggered""" 2424 2425 trigger: Optional[Union[str, TriggerStep]] 2426 """The slug of the pipeline to create a build""" 2427 2428 def __init__( 2429 self, 2430 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2431 block: Optional[Union[str, BlockStep]], 2432 blocked_state: Optional[BlockedState], 2433 branches: Optional[Union[List[str], str]], 2434 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2435 fields: Optional[List[Field]], 2436 id: Optional[str], 2437 identifier: Optional[str], 2438 step_if: Optional[str], 2439 key: Optional[str], 2440 label: Optional[str], 2441 name: Optional[str], 2442 prompt: Optional[str], 2443 type: Optional[BlockStepType], 2444 input: Optional[Union[str, InputStep]], 2445 agents: Optional[Union[Dict[str, Any], List[str]]], 2446 artifact_paths: Optional[Union[List[str], str]], 2447 cache: Optional[Union[List[str], CacheClass, str]], 2448 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 2449 command: Optional[Union[List[str], CommandStep, str]], 2450 commands: Optional[Union[List[str], CommandStep, str]], 2451 concurrency: Optional[int], 2452 concurrency_group: Optional[str], 2453 concurrency_method: Optional[ConcurrencyMethod], 2454 env: Optional[Dict[str, Any]], 2455 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 2456 notify: Optional[List[Union[NotifyClass, NotifyEnum]]], 2457 parallelism: Optional[int], 2458 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 2459 priority: Optional[int], 2460 retry: Optional[Retry], 2461 signature: Optional[Signature], 2462 skip: Optional[Union[bool, str]], 2463 soft_fail: Optional[ 2464 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 2465 ], 2466 timeout_in_minutes: Optional[int], 2467 script: Optional[CommandStep], 2468 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2469 wait: Optional[Union[WaitStep, str]], 2470 waiter: Optional[WaitStep], 2471 step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 2472 build: Optional[Build], 2473 trigger: Optional[Union[str, TriggerStep]], 2474 ) -> None: 2475 self.allow_dependency_failure = allow_dependency_failure 2476 self.block = block 2477 self.blocked_state = blocked_state 2478 self.branches = branches 2479 self.depends_on = depends_on 2480 self.fields = fields 2481 self.id = id 2482 self.identifier = identifier 2483 self.step_if = step_if 2484 self.key = key 2485 self.label = label 2486 self.name = name 2487 self.prompt = prompt 2488 self.type = type 2489 self.input = input 2490 self.agents = agents 2491 self.artifact_paths = artifact_paths 2492 self.cache = cache 2493 self.cancel_on_build_failing = cancel_on_build_failing 2494 self.command = command 2495 self.commands = commands 2496 self.concurrency = concurrency 2497 self.concurrency_group = concurrency_group 2498 self.concurrency_method = concurrency_method 2499 self.env = env 2500 self.matrix = matrix 2501 self.notify = notify 2502 self.parallelism = parallelism 2503 self.plugins = plugins 2504 self.priority = priority 2505 self.retry = retry 2506 self.signature = signature 2507 self.skip = skip 2508 self.soft_fail = soft_fail 2509 self.timeout_in_minutes = timeout_in_minutes 2510 self.script = script 2511 self.continue_on_failure = continue_on_failure 2512 self.wait = wait 2513 self.waiter = waiter 2514 self.step_async = step_async 2515 self.build = build 2516 self.trigger = trigger 2517 2518 @staticmethod 2519 def from_dict(obj: Any) -> "PurpleStep": 2520 assert isinstance(obj, dict) 2521 allow_dependency_failure = from_union( 2522 [from_bool, AllowDependencyFailureEnum, from_none], 2523 obj.get("allow_dependency_failure"), 2524 ) 2525 block = from_union([from_str, BlockStep.from_dict, from_none], obj.get("block")) 2526 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 2527 branches = from_union( 2528 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2529 ) 2530 depends_on = from_union( 2531 [ 2532 from_none, 2533 lambda x: from_list( 2534 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2535 ), 2536 from_str, 2537 ], 2538 obj.get("depends_on"), 2539 ) 2540 fields = from_union( 2541 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 2542 ) 2543 id = from_union([from_str, from_none], obj.get("id")) 2544 identifier = from_union([from_str, from_none], obj.get("identifier")) 2545 step_if = from_union([from_str, from_none], obj.get("if")) 2546 key = from_union([from_str, from_none], obj.get("key")) 2547 label = from_union([from_none, from_str], obj.get("label")) 2548 name = from_union([from_none, from_str], obj.get("name")) 2549 prompt = from_union([from_str, from_none], obj.get("prompt")) 2550 type = from_union([BlockStepType, from_none], obj.get("type")) 2551 input = from_union([from_str, InputStep.from_dict, from_none], obj.get("input")) 2552 agents = from_union( 2553 [ 2554 lambda x: from_dict(lambda x: x, x), 2555 lambda x: from_list(from_str, x), 2556 from_none, 2557 ], 2558 obj.get("agents"), 2559 ) 2560 artifact_paths = from_union( 2561 [lambda x: from_list(from_str, x), from_str, from_none], 2562 obj.get("artifact_paths"), 2563 ) 2564 cache = from_union( 2565 [ 2566 lambda x: from_list(from_str, x), 2567 CacheClass.from_dict, 2568 from_str, 2569 from_none, 2570 ], 2571 obj.get("cache"), 2572 ) 2573 cancel_on_build_failing = from_union( 2574 [from_bool, AllowDependencyFailureEnum, from_none], 2575 obj.get("cancel_on_build_failing"), 2576 ) 2577 command = from_union( 2578 [ 2579 lambda x: from_list(from_str, x), 2580 CommandStep.from_dict, 2581 from_str, 2582 from_none, 2583 ], 2584 obj.get("command"), 2585 ) 2586 commands = from_union( 2587 [ 2588 lambda x: from_list(from_str, x), 2589 CommandStep.from_dict, 2590 from_str, 2591 from_none, 2592 ], 2593 obj.get("commands"), 2594 ) 2595 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 2596 concurrency_group = from_union( 2597 [from_str, from_none], obj.get("concurrency_group") 2598 ) 2599 concurrency_method = from_union( 2600 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 2601 ) 2602 env = from_union( 2603 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 2604 ) 2605 matrix = from_union( 2606 [ 2607 lambda x: from_list( 2608 lambda x: from_union([from_int, from_bool, from_str], x), x 2609 ), 2610 MatrixClass.from_dict, 2611 from_none, 2612 ], 2613 obj.get("matrix"), 2614 ) 2615 notify = from_union( 2616 [ 2617 lambda x: from_list( 2618 lambda x: from_union([NotifyClass.from_dict, NotifyEnum], x), x 2619 ), 2620 from_none, 2621 ], 2622 obj.get("notify"), 2623 ) 2624 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 2625 plugins = from_union( 2626 [ 2627 lambda x: from_list( 2628 lambda x: from_union( 2629 [lambda x: from_dict(lambda x: x, x), from_str], x 2630 ), 2631 x, 2632 ), 2633 lambda x: from_dict(lambda x: x, x), 2634 from_none, 2635 ], 2636 obj.get("plugins"), 2637 ) 2638 priority = from_union([from_int, from_none], obj.get("priority")) 2639 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 2640 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 2641 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 2642 soft_fail = from_union( 2643 [ 2644 from_bool, 2645 lambda x: from_list(SoftFailElement.from_dict, x), 2646 AllowDependencyFailureEnum, 2647 from_none, 2648 ], 2649 obj.get("soft_fail"), 2650 ) 2651 timeout_in_minutes = from_union( 2652 [from_int, from_none], obj.get("timeout_in_minutes") 2653 ) 2654 script = from_union([CommandStep.from_dict, from_none], obj.get("script")) 2655 continue_on_failure = from_union( 2656 [from_bool, AllowDependencyFailureEnum, from_none], 2657 obj.get("continue_on_failure"), 2658 ) 2659 wait = from_union([from_none, WaitStep.from_dict, from_str], obj.get("wait")) 2660 waiter = from_union([WaitStep.from_dict, from_none], obj.get("waiter")) 2661 step_async = from_union( 2662 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 2663 ) 2664 build = from_union([Build.from_dict, from_none], obj.get("build")) 2665 trigger = from_union( 2666 [from_str, TriggerStep.from_dict, from_none], obj.get("trigger") 2667 ) 2668 return PurpleStep( 2669 allow_dependency_failure, 2670 block, 2671 blocked_state, 2672 branches, 2673 depends_on, 2674 fields, 2675 id, 2676 identifier, 2677 step_if, 2678 key, 2679 label, 2680 name, 2681 prompt, 2682 type, 2683 input, 2684 agents, 2685 artifact_paths, 2686 cache, 2687 cancel_on_build_failing, 2688 command, 2689 commands, 2690 concurrency, 2691 concurrency_group, 2692 concurrency_method, 2693 env, 2694 matrix, 2695 notify, 2696 parallelism, 2697 plugins, 2698 priority, 2699 retry, 2700 signature, 2701 skip, 2702 soft_fail, 2703 timeout_in_minutes, 2704 script, 2705 continue_on_failure, 2706 wait, 2707 waiter, 2708 step_async, 2709 build, 2710 trigger, 2711 ) 2712 2713 def to_dict(self) -> dict: 2714 result: dict = {} 2715 if self.allow_dependency_failure is not None: 2716 result["allow_dependency_failure"] = from_union( 2717 [ 2718 from_bool, 2719 lambda x: to_enum(AllowDependencyFailureEnum, x), 2720 from_none, 2721 ], 2722 self.allow_dependency_failure, 2723 ) 2724 if self.block is not None: 2725 result["block"] = from_union( 2726 [from_str, lambda x: to_class(BlockStep, x), from_none], self.block 2727 ) 2728 if self.blocked_state is not None: 2729 result["blocked_state"] = from_union( 2730 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 2731 ) 2732 if self.branches is not None: 2733 result["branches"] = from_union( 2734 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2735 ) 2736 if self.depends_on is not None: 2737 result["depends_on"] = from_union( 2738 [ 2739 from_none, 2740 lambda x: from_list( 2741 lambda x: from_union( 2742 [lambda x: to_class(DependsOnClass, x), from_str], x 2743 ), 2744 x, 2745 ), 2746 from_str, 2747 ], 2748 self.depends_on, 2749 ) 2750 if self.fields is not None: 2751 result["fields"] = from_union( 2752 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 2753 self.fields, 2754 ) 2755 if self.id is not None: 2756 result["id"] = from_union([from_str, from_none], self.id) 2757 if self.identifier is not None: 2758 result["identifier"] = from_union([from_str, from_none], self.identifier) 2759 if self.step_if is not None: 2760 result["if"] = from_union([from_str, from_none], self.step_if) 2761 if self.key is not None: 2762 result["key"] = from_union([from_str, from_none], self.key) 2763 if self.label is not None: 2764 result["label"] = from_union([from_none, from_str], self.label) 2765 if self.name is not None: 2766 result["name"] = from_union([from_none, from_str], self.name) 2767 if self.prompt is not None: 2768 result["prompt"] = from_union([from_str, from_none], self.prompt) 2769 if self.type is not None: 2770 result["type"] = from_union( 2771 [lambda x: to_enum(BlockStepType, x), from_none], self.type 2772 ) 2773 if self.input is not None: 2774 result["input"] = from_union( 2775 [from_str, lambda x: to_class(InputStep, x), from_none], self.input 2776 ) 2777 if self.agents is not None: 2778 result["agents"] = from_union( 2779 [ 2780 lambda x: from_dict(lambda x: x, x), 2781 lambda x: from_list(from_str, x), 2782 from_none, 2783 ], 2784 self.agents, 2785 ) 2786 if self.artifact_paths is not None: 2787 result["artifact_paths"] = from_union( 2788 [lambda x: from_list(from_str, x), from_str, from_none], 2789 self.artifact_paths, 2790 ) 2791 if self.cache is not None: 2792 result["cache"] = from_union( 2793 [ 2794 lambda x: from_list(from_str, x), 2795 lambda x: to_class(CacheClass, x), 2796 from_str, 2797 from_none, 2798 ], 2799 self.cache, 2800 ) 2801 if self.cancel_on_build_failing is not None: 2802 result["cancel_on_build_failing"] = from_union( 2803 [ 2804 from_bool, 2805 lambda x: to_enum(AllowDependencyFailureEnum, x), 2806 from_none, 2807 ], 2808 self.cancel_on_build_failing, 2809 ) 2810 if self.command is not None: 2811 result["command"] = from_union( 2812 [ 2813 lambda x: from_list(from_str, x), 2814 lambda x: to_class(CommandStep, x), 2815 from_str, 2816 from_none, 2817 ], 2818 self.command, 2819 ) 2820 if self.commands is not None: 2821 result["commands"] = from_union( 2822 [ 2823 lambda x: from_list(from_str, x), 2824 lambda x: to_class(CommandStep, x), 2825 from_str, 2826 from_none, 2827 ], 2828 self.commands, 2829 ) 2830 if self.concurrency is not None: 2831 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 2832 if self.concurrency_group is not None: 2833 result["concurrency_group"] = from_union( 2834 [from_str, from_none], self.concurrency_group 2835 ) 2836 if self.concurrency_method is not None: 2837 result["concurrency_method"] = from_union( 2838 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 2839 self.concurrency_method, 2840 ) 2841 if self.env is not None: 2842 result["env"] = from_union( 2843 [lambda x: from_dict(lambda x: x, x), from_none], self.env 2844 ) 2845 if self.matrix is not None: 2846 result["matrix"] = from_union( 2847 [ 2848 lambda x: from_list( 2849 lambda x: from_union([from_int, from_bool, from_str], x), x 2850 ), 2851 lambda x: to_class(MatrixClass, x), 2852 from_none, 2853 ], 2854 self.matrix, 2855 ) 2856 if self.notify is not None: 2857 result["notify"] = from_union( 2858 [ 2859 lambda x: from_list( 2860 lambda x: from_union( 2861 [ 2862 lambda x: to_class(NotifyClass, x), 2863 lambda x: to_enum(NotifyEnum, x), 2864 ], 2865 x, 2866 ), 2867 x, 2868 ), 2869 from_none, 2870 ], 2871 self.notify, 2872 ) 2873 if self.parallelism is not None: 2874 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 2875 if self.plugins is not None: 2876 result["plugins"] = from_union( 2877 [ 2878 lambda x: from_list( 2879 lambda x: from_union( 2880 [lambda x: from_dict(lambda x: x, x), from_str], x 2881 ), 2882 x, 2883 ), 2884 lambda x: from_dict(lambda x: x, x), 2885 from_none, 2886 ], 2887 self.plugins, 2888 ) 2889 if self.priority is not None: 2890 result["priority"] = from_union([from_int, from_none], self.priority) 2891 if self.retry is not None: 2892 result["retry"] = from_union( 2893 [lambda x: to_class(Retry, x), from_none], self.retry 2894 ) 2895 if self.signature is not None: 2896 result["signature"] = from_union( 2897 [lambda x: to_class(Signature, x), from_none], self.signature 2898 ) 2899 if self.skip is not None: 2900 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 2901 if self.soft_fail is not None: 2902 result["soft_fail"] = from_union( 2903 [ 2904 from_bool, 2905 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 2906 lambda x: to_enum(AllowDependencyFailureEnum, x), 2907 from_none, 2908 ], 2909 self.soft_fail, 2910 ) 2911 if self.timeout_in_minutes is not None: 2912 result["timeout_in_minutes"] = from_union( 2913 [from_int, from_none], self.timeout_in_minutes 2914 ) 2915 if self.script is not None: 2916 result["script"] = from_union( 2917 [lambda x: to_class(CommandStep, x), from_none], self.script 2918 ) 2919 if self.continue_on_failure is not None: 2920 result["continue_on_failure"] = from_union( 2921 [ 2922 from_bool, 2923 lambda x: to_enum(AllowDependencyFailureEnum, x), 2924 from_none, 2925 ], 2926 self.continue_on_failure, 2927 ) 2928 if self.wait is not None: 2929 result["wait"] = from_union( 2930 [from_none, lambda x: to_class(WaitStep, x), from_str], self.wait 2931 ) 2932 if self.waiter is not None: 2933 result["waiter"] = from_union( 2934 [lambda x: to_class(WaitStep, x), from_none], self.waiter 2935 ) 2936 if self.step_async is not None: 2937 result["async"] = from_union( 2938 [ 2939 from_bool, 2940 lambda x: to_enum(AllowDependencyFailureEnum, x), 2941 from_none, 2942 ], 2943 self.step_async, 2944 ) 2945 if self.build is not None: 2946 result["build"] = from_union( 2947 [lambda x: to_class(Build, x), from_none], self.build 2948 ) 2949 if self.trigger is not None: 2950 result["trigger"] = from_union( 2951 [from_str, lambda x: to_class(TriggerStep, x), from_none], self.trigger 2952 ) 2953 return result 2954 2955 2956class StringStep(Enum): 2957 """Pauses the execution of a build and waits on a user to unblock it 2958 2959 Waits for previous steps to pass before continuing 2960 """ 2961 2962 BLOCK = "block" 2963 INPUT = "input" 2964 WAIT = "wait" 2965 WAITER = "waiter" 2966 2967 2968class GroupStepClass: 2969 """Waits for previous steps to pass before continuing""" 2970 2971 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2972 block: Optional[Union[str, BlockStep]] 2973 """The label of the block step""" 2974 2975 blocked_state: Optional[BlockedState] 2976 """The state that the build is set to when the build is blocked by this block step""" 2977 2978 branches: Optional[Union[List[str], str]] 2979 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 2980 fields: Optional[List[Field]] 2981 id: Optional[str] 2982 identifier: Optional[str] 2983 step_if: Optional[str] 2984 key: Optional[str] 2985 label: Optional[str] 2986 name: Optional[str] 2987 prompt: Optional[str] 2988 type: Optional[BlockStepType] 2989 input: Optional[Union[str, InputStep]] 2990 """The label of the input step""" 2991 2992 agents: Optional[Union[Dict[str, Any], List[str]]] 2993 artifact_paths: Optional[Union[List[str], str]] 2994 """The glob path/s of artifacts to upload once this step has finished running""" 2995 2996 cache: Optional[Union[List[str], CacheClass, str]] 2997 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]] 2998 command: Optional[Union[List[str], CommandStep, str]] 2999 """The commands to run on the agent""" 3000 3001 commands: Optional[Union[List[str], CommandStep, str]] 3002 """The commands to run on the agent""" 3003 3004 concurrency: Optional[int] 3005 """The maximum number of jobs created from this step that are allowed to run at the same 3006 time. If you use this attribute, you must also define concurrency_group. 3007 """ 3008 concurrency_group: Optional[str] 3009 """A unique name for the concurrency group that you are creating with the concurrency 3010 attribute 3011 """ 3012 concurrency_method: Optional[ConcurrencyMethod] 3013 """Control command order, allowed values are 'ordered' (default) and 'eager'. If you use 3014 this attribute, you must also define concurrency_group and concurrency. 3015 """ 3016 env: Optional[Dict[str, Any]] 3017 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]] 3018 notify: Optional[List[Union[FluffyBuildNotify, NotifyEnum]]] 3019 """Array of notification options for this step""" 3020 3021 parallelism: Optional[int] 3022 """The number of parallel jobs that will be created based on this step""" 3023 3024 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]] 3025 priority: Optional[int] 3026 """Priority of the job, higher priorities are assigned to agents""" 3027 3028 retry: Optional[Retry] 3029 """The conditions for retrying this step.""" 3030 3031 signature: Optional[Signature] 3032 """The signature of the command step, generally injected by agents at pipeline upload""" 3033 3034 skip: Optional[Union[bool, str]] 3035 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 3036 timeout_in_minutes: Optional[int] 3037 """The number of minutes to time out a job""" 3038 3039 script: Optional[CommandStep] 3040 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 3041 """Continue to the next steps, even if the previous group of steps fail""" 3042 3043 wait: Optional[Union[WaitStep, str]] 3044 """Waits for previous steps to pass before continuing""" 3045 3046 waiter: Optional[WaitStep] 3047 step_async: Optional[Union[bool, AllowDependencyFailureEnum]] 3048 """Whether to continue the build without waiting for the triggered step to complete""" 3049 3050 build: Optional[Build] 3051 """Properties of the build that will be created when the step is triggered""" 3052 3053 trigger: Optional[Union[str, TriggerStep]] 3054 """The slug of the pipeline to create a build""" 3055 3056 group: Optional[str] 3057 """The name to give to this group of steps""" 3058 3059 steps: Optional[List[Union[PurpleStep, StringStep]]] 3060 """A list of steps""" 3061 3062 def __init__( 3063 self, 3064 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 3065 block: Optional[Union[str, BlockStep]], 3066 blocked_state: Optional[BlockedState], 3067 branches: Optional[Union[List[str], str]], 3068 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 3069 fields: Optional[List[Field]], 3070 id: Optional[str], 3071 identifier: Optional[str], 3072 step_if: Optional[str], 3073 key: Optional[str], 3074 label: Optional[str], 3075 name: Optional[str], 3076 prompt: Optional[str], 3077 type: Optional[BlockStepType], 3078 input: Optional[Union[str, InputStep]], 3079 agents: Optional[Union[Dict[str, Any], List[str]]], 3080 artifact_paths: Optional[Union[List[str], str]], 3081 cache: Optional[Union[List[str], CacheClass, str]], 3082 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 3083 command: Optional[Union[List[str], CommandStep, str]], 3084 commands: Optional[Union[List[str], CommandStep, str]], 3085 concurrency: Optional[int], 3086 concurrency_group: Optional[str], 3087 concurrency_method: Optional[ConcurrencyMethod], 3088 env: Optional[Dict[str, Any]], 3089 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 3090 notify: Optional[List[Union[FluffyBuildNotify, NotifyEnum]]], 3091 parallelism: Optional[int], 3092 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 3093 priority: Optional[int], 3094 retry: Optional[Retry], 3095 signature: Optional[Signature], 3096 skip: Optional[Union[bool, str]], 3097 soft_fail: Optional[ 3098 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 3099 ], 3100 timeout_in_minutes: Optional[int], 3101 script: Optional[CommandStep], 3102 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 3103 wait: Optional[Union[WaitStep, str]], 3104 waiter: Optional[WaitStep], 3105 step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 3106 build: Optional[Build], 3107 trigger: Optional[Union[str, TriggerStep]], 3108 group: Optional[str], 3109 steps: Optional[List[Union[PurpleStep, StringStep]]], 3110 ) -> None: 3111 self.allow_dependency_failure = allow_dependency_failure 3112 self.block = block 3113 self.blocked_state = blocked_state 3114 self.branches = branches 3115 self.depends_on = depends_on 3116 self.fields = fields 3117 self.id = id 3118 self.identifier = identifier 3119 self.step_if = step_if 3120 self.key = key 3121 self.label = label 3122 self.name = name 3123 self.prompt = prompt 3124 self.type = type 3125 self.input = input 3126 self.agents = agents 3127 self.artifact_paths = artifact_paths 3128 self.cache = cache 3129 self.cancel_on_build_failing = cancel_on_build_failing 3130 self.command = command 3131 self.commands = commands 3132 self.concurrency = concurrency 3133 self.concurrency_group = concurrency_group 3134 self.concurrency_method = concurrency_method 3135 self.env = env 3136 self.matrix = matrix 3137 self.notify = notify 3138 self.parallelism = parallelism 3139 self.plugins = plugins 3140 self.priority = priority 3141 self.retry = retry 3142 self.signature = signature 3143 self.skip = skip 3144 self.soft_fail = soft_fail 3145 self.timeout_in_minutes = timeout_in_minutes 3146 self.script = script 3147 self.continue_on_failure = continue_on_failure 3148 self.wait = wait 3149 self.waiter = waiter 3150 self.step_async = step_async 3151 self.build = build 3152 self.trigger = trigger 3153 self.group = group 3154 self.steps = steps 3155 3156 @staticmethod 3157 def from_dict(obj: Any) -> "GroupStepClass": 3158 assert isinstance(obj, dict) 3159 allow_dependency_failure = from_union( 3160 [from_bool, AllowDependencyFailureEnum, from_none], 3161 obj.get("allow_dependency_failure"), 3162 ) 3163 block = from_union([from_str, BlockStep.from_dict, from_none], obj.get("block")) 3164 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 3165 branches = from_union( 3166 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 3167 ) 3168 depends_on = from_union( 3169 [ 3170 from_none, 3171 lambda x: from_list( 3172 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 3173 ), 3174 from_str, 3175 ], 3176 obj.get("depends_on"), 3177 ) 3178 fields = from_union( 3179 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 3180 ) 3181 id = from_union([from_str, from_none], obj.get("id")) 3182 identifier = from_union([from_str, from_none], obj.get("identifier")) 3183 step_if = from_union([from_str, from_none], obj.get("if")) 3184 key = from_union([from_str, from_none], obj.get("key")) 3185 label = from_union([from_none, from_str], obj.get("label")) 3186 name = from_union([from_none, from_str], obj.get("name")) 3187 prompt = from_union([from_str, from_none], obj.get("prompt")) 3188 type = from_union([BlockStepType, from_none], obj.get("type")) 3189 input = from_union([from_str, InputStep.from_dict, from_none], obj.get("input")) 3190 agents = from_union( 3191 [ 3192 lambda x: from_dict(lambda x: x, x), 3193 lambda x: from_list(from_str, x), 3194 from_none, 3195 ], 3196 obj.get("agents"), 3197 ) 3198 artifact_paths = from_union( 3199 [lambda x: from_list(from_str, x), from_str, from_none], 3200 obj.get("artifact_paths"), 3201 ) 3202 cache = from_union( 3203 [ 3204 lambda x: from_list(from_str, x), 3205 CacheClass.from_dict, 3206 from_str, 3207 from_none, 3208 ], 3209 obj.get("cache"), 3210 ) 3211 cancel_on_build_failing = from_union( 3212 [from_bool, AllowDependencyFailureEnum, from_none], 3213 obj.get("cancel_on_build_failing"), 3214 ) 3215 command = from_union( 3216 [ 3217 lambda x: from_list(from_str, x), 3218 CommandStep.from_dict, 3219 from_str, 3220 from_none, 3221 ], 3222 obj.get("command"), 3223 ) 3224 commands = from_union( 3225 [ 3226 lambda x: from_list(from_str, x), 3227 CommandStep.from_dict, 3228 from_str, 3229 from_none, 3230 ], 3231 obj.get("commands"), 3232 ) 3233 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 3234 concurrency_group = from_union( 3235 [from_str, from_none], obj.get("concurrency_group") 3236 ) 3237 concurrency_method = from_union( 3238 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 3239 ) 3240 env = from_union( 3241 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 3242 ) 3243 matrix = from_union( 3244 [ 3245 lambda x: from_list( 3246 lambda x: from_union([from_int, from_bool, from_str], x), x 3247 ), 3248 MatrixClass.from_dict, 3249 from_none, 3250 ], 3251 obj.get("matrix"), 3252 ) 3253 notify = from_union( 3254 [ 3255 lambda x: from_list( 3256 lambda x: from_union([FluffyBuildNotify.from_dict, NotifyEnum], x), 3257 x, 3258 ), 3259 from_none, 3260 ], 3261 obj.get("notify"), 3262 ) 3263 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 3264 plugins = from_union( 3265 [ 3266 lambda x: from_list( 3267 lambda x: from_union( 3268 [lambda x: from_dict(lambda x: x, x), from_str], x 3269 ), 3270 x, 3271 ), 3272 lambda x: from_dict(lambda x: x, x), 3273 from_none, 3274 ], 3275 obj.get("plugins"), 3276 ) 3277 priority = from_union([from_int, from_none], obj.get("priority")) 3278 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 3279 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 3280 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 3281 soft_fail = from_union( 3282 [ 3283 from_bool, 3284 lambda x: from_list(SoftFailElement.from_dict, x), 3285 AllowDependencyFailureEnum, 3286 from_none, 3287 ], 3288 obj.get("soft_fail"), 3289 ) 3290 timeout_in_minutes = from_union( 3291 [from_int, from_none], obj.get("timeout_in_minutes") 3292 ) 3293 script = from_union([CommandStep.from_dict, from_none], obj.get("script")) 3294 continue_on_failure = from_union( 3295 [from_bool, AllowDependencyFailureEnum, from_none], 3296 obj.get("continue_on_failure"), 3297 ) 3298 wait = from_union([from_none, WaitStep.from_dict, from_str], obj.get("wait")) 3299 waiter = from_union([WaitStep.from_dict, from_none], obj.get("waiter")) 3300 step_async = from_union( 3301 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 3302 ) 3303 build = from_union([Build.from_dict, from_none], obj.get("build")) 3304 trigger = from_union( 3305 [from_str, TriggerStep.from_dict, from_none], obj.get("trigger") 3306 ) 3307 group = from_union([from_none, from_str], obj.get("group")) 3308 steps = from_union( 3309 [ 3310 lambda x: from_list( 3311 lambda x: from_union([PurpleStep.from_dict, StringStep], x), x 3312 ), 3313 from_none, 3314 ], 3315 obj.get("steps"), 3316 ) 3317 return GroupStepClass( 3318 allow_dependency_failure, 3319 block, 3320 blocked_state, 3321 branches, 3322 depends_on, 3323 fields, 3324 id, 3325 identifier, 3326 step_if, 3327 key, 3328 label, 3329 name, 3330 prompt, 3331 type, 3332 input, 3333 agents, 3334 artifact_paths, 3335 cache, 3336 cancel_on_build_failing, 3337 command, 3338 commands, 3339 concurrency, 3340 concurrency_group, 3341 concurrency_method, 3342 env, 3343 matrix, 3344 notify, 3345 parallelism, 3346 plugins, 3347 priority, 3348 retry, 3349 signature, 3350 skip, 3351 soft_fail, 3352 timeout_in_minutes, 3353 script, 3354 continue_on_failure, 3355 wait, 3356 waiter, 3357 step_async, 3358 build, 3359 trigger, 3360 group, 3361 steps, 3362 ) 3363 3364 def to_dict(self) -> dict: 3365 result: dict = {} 3366 if self.allow_dependency_failure is not None: 3367 result["allow_dependency_failure"] = from_union( 3368 [ 3369 from_bool, 3370 lambda x: to_enum(AllowDependencyFailureEnum, x), 3371 from_none, 3372 ], 3373 self.allow_dependency_failure, 3374 ) 3375 if self.block is not None: 3376 result["block"] = from_union( 3377 [from_str, lambda x: to_class(BlockStep, x), from_none], self.block 3378 ) 3379 if self.blocked_state is not None: 3380 result["blocked_state"] = from_union( 3381 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 3382 ) 3383 if self.branches is not None: 3384 result["branches"] = from_union( 3385 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 3386 ) 3387 if self.depends_on is not None: 3388 result["depends_on"] = from_union( 3389 [ 3390 from_none, 3391 lambda x: from_list( 3392 lambda x: from_union( 3393 [lambda x: to_class(DependsOnClass, x), from_str], x 3394 ), 3395 x, 3396 ), 3397 from_str, 3398 ], 3399 self.depends_on, 3400 ) 3401 if self.fields is not None: 3402 result["fields"] = from_union( 3403 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 3404 self.fields, 3405 ) 3406 if self.id is not None: 3407 result["id"] = from_union([from_str, from_none], self.id) 3408 if self.identifier is not None: 3409 result["identifier"] = from_union([from_str, from_none], self.identifier) 3410 if self.step_if is not None: 3411 result["if"] = from_union([from_str, from_none], self.step_if) 3412 if self.key is not None: 3413 result["key"] = from_union([from_str, from_none], self.key) 3414 if self.label is not None: 3415 result["label"] = from_union([from_none, from_str], self.label) 3416 if self.name is not None: 3417 result["name"] = from_union([from_none, from_str], self.name) 3418 if self.prompt is not None: 3419 result["prompt"] = from_union([from_str, from_none], self.prompt) 3420 if self.type is not None: 3421 result["type"] = from_union( 3422 [lambda x: to_enum(BlockStepType, x), from_none], self.type 3423 ) 3424 if self.input is not None: 3425 result["input"] = from_union( 3426 [from_str, lambda x: to_class(InputStep, x), from_none], self.input 3427 ) 3428 if self.agents is not None: 3429 result["agents"] = from_union( 3430 [ 3431 lambda x: from_dict(lambda x: x, x), 3432 lambda x: from_list(from_str, x), 3433 from_none, 3434 ], 3435 self.agents, 3436 ) 3437 if self.artifact_paths is not None: 3438 result["artifact_paths"] = from_union( 3439 [lambda x: from_list(from_str, x), from_str, from_none], 3440 self.artifact_paths, 3441 ) 3442 if self.cache is not None: 3443 result["cache"] = from_union( 3444 [ 3445 lambda x: from_list(from_str, x), 3446 lambda x: to_class(CacheClass, x), 3447 from_str, 3448 from_none, 3449 ], 3450 self.cache, 3451 ) 3452 if self.cancel_on_build_failing is not None: 3453 result["cancel_on_build_failing"] = from_union( 3454 [ 3455 from_bool, 3456 lambda x: to_enum(AllowDependencyFailureEnum, x), 3457 from_none, 3458 ], 3459 self.cancel_on_build_failing, 3460 ) 3461 if self.command is not None: 3462 result["command"] = from_union( 3463 [ 3464 lambda x: from_list(from_str, x), 3465 lambda x: to_class(CommandStep, x), 3466 from_str, 3467 from_none, 3468 ], 3469 self.command, 3470 ) 3471 if self.commands is not None: 3472 result["commands"] = from_union( 3473 [ 3474 lambda x: from_list(from_str, x), 3475 lambda x: to_class(CommandStep, x), 3476 from_str, 3477 from_none, 3478 ], 3479 self.commands, 3480 ) 3481 if self.concurrency is not None: 3482 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 3483 if self.concurrency_group is not None: 3484 result["concurrency_group"] = from_union( 3485 [from_str, from_none], self.concurrency_group 3486 ) 3487 if self.concurrency_method is not None: 3488 result["concurrency_method"] = from_union( 3489 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 3490 self.concurrency_method, 3491 ) 3492 if self.env is not None: 3493 result["env"] = from_union( 3494 [lambda x: from_dict(lambda x: x, x), from_none], self.env 3495 ) 3496 if self.matrix is not None: 3497 result["matrix"] = from_union( 3498 [ 3499 lambda x: from_list( 3500 lambda x: from_union([from_int, from_bool, from_str], x), x 3501 ), 3502 lambda x: to_class(MatrixClass, x), 3503 from_none, 3504 ], 3505 self.matrix, 3506 ) 3507 if self.notify is not None: 3508 result["notify"] = from_union( 3509 [ 3510 lambda x: from_list( 3511 lambda x: from_union( 3512 [ 3513 lambda x: to_class(FluffyBuildNotify, x), 3514 lambda x: to_enum(NotifyEnum, x), 3515 ], 3516 x, 3517 ), 3518 x, 3519 ), 3520 from_none, 3521 ], 3522 self.notify, 3523 ) 3524 if self.parallelism is not None: 3525 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 3526 if self.plugins is not None: 3527 result["plugins"] = from_union( 3528 [ 3529 lambda x: from_list( 3530 lambda x: from_union( 3531 [lambda x: from_dict(lambda x: x, x), from_str], x 3532 ), 3533 x, 3534 ), 3535 lambda x: from_dict(lambda x: x, x), 3536 from_none, 3537 ], 3538 self.plugins, 3539 ) 3540 if self.priority is not None: 3541 result["priority"] = from_union([from_int, from_none], self.priority) 3542 if self.retry is not None: 3543 result["retry"] = from_union( 3544 [lambda x: to_class(Retry, x), from_none], self.retry 3545 ) 3546 if self.signature is not None: 3547 result["signature"] = from_union( 3548 [lambda x: to_class(Signature, x), from_none], self.signature 3549 ) 3550 if self.skip is not None: 3551 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 3552 if self.soft_fail is not None: 3553 result["soft_fail"] = from_union( 3554 [ 3555 from_bool, 3556 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 3557 lambda x: to_enum(AllowDependencyFailureEnum, x), 3558 from_none, 3559 ], 3560 self.soft_fail, 3561 ) 3562 if self.timeout_in_minutes is not None: 3563 result["timeout_in_minutes"] = from_union( 3564 [from_int, from_none], self.timeout_in_minutes 3565 ) 3566 if self.script is not None: 3567 result["script"] = from_union( 3568 [lambda x: to_class(CommandStep, x), from_none], self.script 3569 ) 3570 if self.continue_on_failure is not None: 3571 result["continue_on_failure"] = from_union( 3572 [ 3573 from_bool, 3574 lambda x: to_enum(AllowDependencyFailureEnum, x), 3575 from_none, 3576 ], 3577 self.continue_on_failure, 3578 ) 3579 if self.wait is not None: 3580 result["wait"] = from_union( 3581 [from_none, lambda x: to_class(WaitStep, x), from_str], self.wait 3582 ) 3583 if self.waiter is not None: 3584 result["waiter"] = from_union( 3585 [lambda x: to_class(WaitStep, x), from_none], self.waiter 3586 ) 3587 if self.step_async is not None: 3588 result["async"] = from_union( 3589 [ 3590 from_bool, 3591 lambda x: to_enum(AllowDependencyFailureEnum, x), 3592 from_none, 3593 ], 3594 self.step_async, 3595 ) 3596 if self.build is not None: 3597 result["build"] = from_union( 3598 [lambda x: to_class(Build, x), from_none], self.build 3599 ) 3600 if self.trigger is not None: 3601 result["trigger"] = from_union( 3602 [from_str, lambda x: to_class(TriggerStep, x), from_none], self.trigger 3603 ) 3604 if self.group is not None: 3605 result["group"] = from_union([from_none, from_str], self.group) 3606 if self.steps is not None: 3607 result["steps"] = from_union( 3608 [ 3609 lambda x: from_list( 3610 lambda x: from_union( 3611 [ 3612 lambda x: to_class(PurpleStep, x), 3613 lambda x: to_enum(StringStep, x), 3614 ], 3615 x, 3616 ), 3617 x, 3618 ), 3619 from_none, 3620 ], 3621 self.steps, 3622 ) 3623 return result 3624 3625 3626class Schema: 3627 agents: Optional[Union[Dict[str, Any], List[str]]] 3628 env: Optional[Dict[str, Any]] 3629 notify: Optional[List[Union[PurpleBuildNotify, NotifyEnum]]] 3630 steps: List[Union[GroupStepClass, StringStep]] 3631 """A list of steps""" 3632 3633 def __init__( 3634 self, 3635 agents: Optional[Union[Dict[str, Any], List[str]]], 3636 env: Optional[Dict[str, Any]], 3637 notify: Optional[List[Union[PurpleBuildNotify, NotifyEnum]]], 3638 steps: List[Union[GroupStepClass, StringStep]], 3639 ) -> None: 3640 self.agents = agents 3641 self.env = env 3642 self.notify = notify 3643 self.steps = steps 3644 3645 @staticmethod 3646 def from_dict(obj: Any) -> "Schema": 3647 assert isinstance(obj, dict) 3648 agents = from_union( 3649 [ 3650 lambda x: from_dict(lambda x: x, x), 3651 lambda x: from_list(from_str, x), 3652 from_none, 3653 ], 3654 obj.get("agents"), 3655 ) 3656 env = from_union( 3657 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 3658 ) 3659 notify = from_union( 3660 [ 3661 lambda x: from_list( 3662 lambda x: from_union([PurpleBuildNotify.from_dict, NotifyEnum], x), 3663 x, 3664 ), 3665 from_none, 3666 ], 3667 obj.get("notify"), 3668 ) 3669 steps = from_list( 3670 lambda x: from_union([GroupStepClass.from_dict, StringStep], x), 3671 obj.get("steps"), 3672 ) 3673 return Schema(agents, env, notify, steps) 3674 3675 def to_dict(self) -> dict: 3676 result: dict = {} 3677 if self.agents is not None: 3678 result["agents"] = from_union( 3679 [ 3680 lambda x: from_dict(lambda x: x, x), 3681 lambda x: from_list(from_str, x), 3682 from_none, 3683 ], 3684 self.agents, 3685 ) 3686 if self.env is not None: 3687 result["env"] = from_union( 3688 [lambda x: from_dict(lambda x: x, x), from_none], self.env 3689 ) 3690 if self.notify is not None: 3691 result["notify"] = from_union( 3692 [ 3693 lambda x: from_list( 3694 lambda x: from_union( 3695 [ 3696 lambda x: to_class(PurpleBuildNotify, x), 3697 lambda x: to_enum(NotifyEnum, x), 3698 ], 3699 x, 3700 ), 3701 x, 3702 ), 3703 from_none, 3704 ], 3705 self.notify, 3706 ) 3707 result["steps"] = from_list( 3708 lambda x: from_union( 3709 [ 3710 lambda x: to_class(GroupStepClass, x), 3711 lambda x: to_enum(StringStep, x), 3712 ], 3713 x, 3714 ), 3715 self.steps, 3716 ) 3717 return result 3718 3719 3720def schema_from_dict(s: Any) -> Schema: 3721 return Schema.from_dict(s) 3722 3723 3724def schema_to_dict(x: Schema) -> Any: 3725 return to_class(Schema, x)
59class PurpleGithubCommitStatus: 60 context: Optional[str] 61 """GitHub commit status name""" 62 63 def __init__(self, context: Optional[str]) -> None: 64 self.context = context 65 66 @staticmethod 67 def from_dict(obj: Any) -> "PurpleGithubCommitStatus": 68 assert isinstance(obj, dict) 69 context = from_union([from_str, from_none], obj.get("context")) 70 return PurpleGithubCommitStatus(context) 71 72 def to_dict(self) -> dict: 73 result: dict = {} 74 if self.context is not None: 75 result["context"] = from_union([from_str, from_none], self.context) 76 return result
79class PurpleSlack: 80 channels: Optional[List[str]] 81 message: Optional[str] 82 83 def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None: 84 self.channels = channels 85 self.message = message 86 87 @staticmethod 88 def from_dict(obj: Any) -> "PurpleSlack": 89 assert isinstance(obj, dict) 90 channels = from_union( 91 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 92 ) 93 message = from_union([from_str, from_none], obj.get("message")) 94 return PurpleSlack(channels, message) 95 96 def to_dict(self) -> dict: 97 result: dict = {} 98 if self.channels is not None: 99 result["channels"] = from_union( 100 [lambda x: from_list(from_str, x), from_none], self.channels 101 ) 102 if self.message is not None: 103 result["message"] = from_union([from_str, from_none], self.message) 104 return result
87 @staticmethod 88 def from_dict(obj: Any) -> "PurpleSlack": 89 assert isinstance(obj, dict) 90 channels = from_union( 91 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 92 ) 93 message = from_union([from_str, from_none], obj.get("message")) 94 return PurpleSlack(channels, message)
96 def to_dict(self) -> dict: 97 result: dict = {} 98 if self.channels is not None: 99 result["channels"] = from_union( 100 [lambda x: from_list(from_str, x), from_none], self.channels 101 ) 102 if self.message is not None: 103 result["message"] = from_union([from_str, from_none], self.message) 104 return result
107class PurpleBuildNotify: 108 email: Optional[str] 109 build_notify_if: Optional[str] 110 basecamp_campfire: Optional[str] 111 slack: Optional[Union[PurpleSlack, str]] 112 webhook: Optional[str] 113 pagerduty_change_event: Optional[str] 114 github_commit_status: Optional[PurpleGithubCommitStatus] 115 github_check: Optional[Dict[str, Any]] 116 117 def __init__( 118 self, 119 email: Optional[str], 120 build_notify_if: Optional[str], 121 basecamp_campfire: Optional[str], 122 slack: Optional[Union[PurpleSlack, str]], 123 webhook: Optional[str], 124 pagerduty_change_event: Optional[str], 125 github_commit_status: Optional[PurpleGithubCommitStatus], 126 github_check: Optional[Dict[str, Any]], 127 ) -> None: 128 self.email = email 129 self.build_notify_if = build_notify_if 130 self.basecamp_campfire = basecamp_campfire 131 self.slack = slack 132 self.webhook = webhook 133 self.pagerduty_change_event = pagerduty_change_event 134 self.github_commit_status = github_commit_status 135 self.github_check = github_check 136 137 @staticmethod 138 def from_dict(obj: Any) -> "PurpleBuildNotify": 139 assert isinstance(obj, dict) 140 email = from_union([from_str, from_none], obj.get("email")) 141 build_notify_if = from_union([from_str, from_none], obj.get("if")) 142 basecamp_campfire = from_union( 143 [from_str, from_none], obj.get("basecamp_campfire") 144 ) 145 slack = from_union( 146 [PurpleSlack.from_dict, from_str, from_none], obj.get("slack") 147 ) 148 webhook = from_union([from_str, from_none], obj.get("webhook")) 149 pagerduty_change_event = from_union( 150 [from_str, from_none], obj.get("pagerduty_change_event") 151 ) 152 github_commit_status = from_union( 153 [PurpleGithubCommitStatus.from_dict, from_none], 154 obj.get("github_commit_status"), 155 ) 156 github_check = from_union( 157 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 158 ) 159 return PurpleBuildNotify( 160 email, 161 build_notify_if, 162 basecamp_campfire, 163 slack, 164 webhook, 165 pagerduty_change_event, 166 github_commit_status, 167 github_check, 168 ) 169 170 def to_dict(self) -> dict: 171 result: dict = {} 172 if self.email is not None: 173 result["email"] = from_union([from_str, from_none], self.email) 174 if self.build_notify_if is not None: 175 result["if"] = from_union([from_str, from_none], self.build_notify_if) 176 if self.basecamp_campfire is not None: 177 result["basecamp_campfire"] = from_union( 178 [from_str, from_none], self.basecamp_campfire 179 ) 180 if self.slack is not None: 181 result["slack"] = from_union( 182 [lambda x: to_class(PurpleSlack, x), from_str, from_none], self.slack 183 ) 184 if self.webhook is not None: 185 result["webhook"] = from_union([from_str, from_none], self.webhook) 186 if self.pagerduty_change_event is not None: 187 result["pagerduty_change_event"] = from_union( 188 [from_str, from_none], self.pagerduty_change_event 189 ) 190 if self.github_commit_status is not None: 191 result["github_commit_status"] = from_union( 192 [lambda x: to_class(PurpleGithubCommitStatus, x), from_none], 193 self.github_commit_status, 194 ) 195 if self.github_check is not None: 196 result["github_check"] = from_union( 197 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 198 ) 199 return result
117 def __init__( 118 self, 119 email: Optional[str], 120 build_notify_if: Optional[str], 121 basecamp_campfire: Optional[str], 122 slack: Optional[Union[PurpleSlack, str]], 123 webhook: Optional[str], 124 pagerduty_change_event: Optional[str], 125 github_commit_status: Optional[PurpleGithubCommitStatus], 126 github_check: Optional[Dict[str, Any]], 127 ) -> None: 128 self.email = email 129 self.build_notify_if = build_notify_if 130 self.basecamp_campfire = basecamp_campfire 131 self.slack = slack 132 self.webhook = webhook 133 self.pagerduty_change_event = pagerduty_change_event 134 self.github_commit_status = github_commit_status 135 self.github_check = github_check
137 @staticmethod 138 def from_dict(obj: Any) -> "PurpleBuildNotify": 139 assert isinstance(obj, dict) 140 email = from_union([from_str, from_none], obj.get("email")) 141 build_notify_if = from_union([from_str, from_none], obj.get("if")) 142 basecamp_campfire = from_union( 143 [from_str, from_none], obj.get("basecamp_campfire") 144 ) 145 slack = from_union( 146 [PurpleSlack.from_dict, from_str, from_none], obj.get("slack") 147 ) 148 webhook = from_union([from_str, from_none], obj.get("webhook")) 149 pagerduty_change_event = from_union( 150 [from_str, from_none], obj.get("pagerduty_change_event") 151 ) 152 github_commit_status = from_union( 153 [PurpleGithubCommitStatus.from_dict, from_none], 154 obj.get("github_commit_status"), 155 ) 156 github_check = from_union( 157 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 158 ) 159 return PurpleBuildNotify( 160 email, 161 build_notify_if, 162 basecamp_campfire, 163 slack, 164 webhook, 165 pagerduty_change_event, 166 github_commit_status, 167 github_check, 168 )
170 def to_dict(self) -> dict: 171 result: dict = {} 172 if self.email is not None: 173 result["email"] = from_union([from_str, from_none], self.email) 174 if self.build_notify_if is not None: 175 result["if"] = from_union([from_str, from_none], self.build_notify_if) 176 if self.basecamp_campfire is not None: 177 result["basecamp_campfire"] = from_union( 178 [from_str, from_none], self.basecamp_campfire 179 ) 180 if self.slack is not None: 181 result["slack"] = from_union( 182 [lambda x: to_class(PurpleSlack, x), from_str, from_none], self.slack 183 ) 184 if self.webhook is not None: 185 result["webhook"] = from_union([from_str, from_none], self.webhook) 186 if self.pagerduty_change_event is not None: 187 result["pagerduty_change_event"] = from_union( 188 [from_str, from_none], self.pagerduty_change_event 189 ) 190 if self.github_commit_status is not None: 191 result["github_commit_status"] = from_union( 192 [lambda x: to_class(PurpleGithubCommitStatus, x), from_none], 193 self.github_commit_status, 194 ) 195 if self.github_check is not None: 196 result["github_check"] = from_union( 197 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 198 ) 199 return result
202class NotifyEnum(Enum): 203 GITHUB_CHECK = "github_check" 204 GITHUB_COMMIT_STATUS = "github_commit_status"
212class BlockedState(Enum): 213 """The state that the build is set to when the build is blocked by this block step""" 214 215 FAILED = "failed" 216 PASSED = "passed" 217 RUNNING = "running"
The state that the build is set to when the build is blocked by this block step
220class DependsOnClass: 221 allow_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 222 step: Optional[str] 223 224 def __init__( 225 self, 226 allow_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 227 step: Optional[str], 228 ) -> None: 229 self.allow_failure = allow_failure 230 self.step = step 231 232 @staticmethod 233 def from_dict(obj: Any) -> "DependsOnClass": 234 assert isinstance(obj, dict) 235 allow_failure = from_union( 236 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("allow_failure") 237 ) 238 step = from_union([from_str, from_none], obj.get("step")) 239 return DependsOnClass(allow_failure, step) 240 241 def to_dict(self) -> dict: 242 result: dict = {} 243 if self.allow_failure is not None: 244 result["allow_failure"] = from_union( 245 [ 246 from_bool, 247 lambda x: to_enum(AllowDependencyFailureEnum, x), 248 from_none, 249 ], 250 self.allow_failure, 251 ) 252 if self.step is not None: 253 result["step"] = from_union([from_str, from_none], self.step) 254 return result
232 @staticmethod 233 def from_dict(obj: Any) -> "DependsOnClass": 234 assert isinstance(obj, dict) 235 allow_failure = from_union( 236 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("allow_failure") 237 ) 238 step = from_union([from_str, from_none], obj.get("step")) 239 return DependsOnClass(allow_failure, step)
241 def to_dict(self) -> dict: 242 result: dict = {} 243 if self.allow_failure is not None: 244 result["allow_failure"] = from_union( 245 [ 246 from_bool, 247 lambda x: to_enum(AllowDependencyFailureEnum, x), 248 from_none, 249 ], 250 self.allow_failure, 251 ) 252 if self.step is not None: 253 result["step"] = from_union([from_str, from_none], self.step) 254 return result
257class Option: 258 hint: Optional[str] 259 """The text displayed directly under the select field’s label""" 260 261 label: str 262 """The text displayed on the select list item""" 263 264 required: Optional[Union[bool, AllowDependencyFailureEnum]] 265 """Whether the field is required for form submission""" 266 267 value: str 268 """The value to be stored as meta-data""" 269 270 def __init__( 271 self, 272 hint: Optional[str], 273 label: str, 274 required: Optional[Union[bool, AllowDependencyFailureEnum]], 275 value: str, 276 ) -> None: 277 self.hint = hint 278 self.label = label 279 self.required = required 280 self.value = value 281 282 @staticmethod 283 def from_dict(obj: Any) -> "Option": 284 assert isinstance(obj, dict) 285 hint = from_union([from_str, from_none], obj.get("hint")) 286 label = from_str(obj.get("label")) 287 required = from_union( 288 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("required") 289 ) 290 value = from_str(obj.get("value")) 291 return Option(hint, label, required, value) 292 293 def to_dict(self) -> dict: 294 result: dict = {} 295 if self.hint is not None: 296 result["hint"] = from_union([from_str, from_none], self.hint) 297 result["label"] = from_str(self.label) 298 if self.required is not None: 299 result["required"] = from_union( 300 [ 301 from_bool, 302 lambda x: to_enum(AllowDependencyFailureEnum, x), 303 from_none, 304 ], 305 self.required, 306 ) 307 result["value"] = from_str(self.value) 308 return result
Whether the field is required for form submission
282 @staticmethod 283 def from_dict(obj: Any) -> "Option": 284 assert isinstance(obj, dict) 285 hint = from_union([from_str, from_none], obj.get("hint")) 286 label = from_str(obj.get("label")) 287 required = from_union( 288 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("required") 289 ) 290 value = from_str(obj.get("value")) 291 return Option(hint, label, required, value)
293 def to_dict(self) -> dict: 294 result: dict = {} 295 if self.hint is not None: 296 result["hint"] = from_union([from_str, from_none], self.hint) 297 result["label"] = from_str(self.label) 298 if self.required is not None: 299 result["required"] = from_union( 300 [ 301 from_bool, 302 lambda x: to_enum(AllowDependencyFailureEnum, x), 303 from_none, 304 ], 305 self.required, 306 ) 307 result["value"] = from_str(self.value) 308 return result
311class Field: 312 """A list of input fields required to be filled out before unblocking the step""" 313 314 default: Optional[Union[List[str], str]] 315 """The value that is pre-filled in the text field 316 317 The value of the option(s) that will be pre-selected in the dropdown 318 """ 319 format: Optional[str] 320 """The format must be a regular expression implicitly anchored to the beginning and end of 321 the input and is functionally equivalent to the HTML5 pattern attribute. 322 """ 323 hint: Optional[str] 324 """The explanatory text that is shown after the label""" 325 326 key: str 327 """The meta-data key that stores the field's input""" 328 329 required: Optional[Union[bool, AllowDependencyFailureEnum]] 330 """Whether the field is required for form submission""" 331 332 text: Optional[str] 333 """The text input name""" 334 335 multiple: Optional[Union[bool, AllowDependencyFailureEnum]] 336 """Whether more than one option may be selected""" 337 338 options: Optional[List[Option]] 339 select: Optional[str] 340 """The text input name""" 341 342 def __init__( 343 self, 344 default: Optional[Union[List[str], str]], 345 format: Optional[str], 346 hint: Optional[str], 347 key: str, 348 required: Optional[Union[bool, AllowDependencyFailureEnum]], 349 text: Optional[str], 350 multiple: Optional[Union[bool, AllowDependencyFailureEnum]], 351 options: Optional[List[Option]], 352 select: Optional[str], 353 ) -> None: 354 self.default = default 355 self.format = format 356 self.hint = hint 357 self.key = key 358 self.required = required 359 self.text = text 360 self.multiple = multiple 361 self.options = options 362 self.select = select 363 364 @staticmethod 365 def from_dict(obj: Any) -> "Field": 366 assert isinstance(obj, dict) 367 default = from_union( 368 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("default") 369 ) 370 format = from_union([from_str, from_none], obj.get("format")) 371 hint = from_union([from_str, from_none], obj.get("hint")) 372 key = from_str(obj.get("key")) 373 required = from_union( 374 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("required") 375 ) 376 text = from_union([from_str, from_none], obj.get("text")) 377 multiple = from_union( 378 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("multiple") 379 ) 380 options = from_union( 381 [lambda x: from_list(Option.from_dict, x), from_none], obj.get("options") 382 ) 383 select = from_union([from_str, from_none], obj.get("select")) 384 return Field( 385 default, format, hint, key, required, text, multiple, options, select 386 ) 387 388 def to_dict(self) -> dict: 389 result: dict = {} 390 if self.default is not None: 391 result["default"] = from_union( 392 [lambda x: from_list(from_str, x), from_str, from_none], self.default 393 ) 394 if self.format is not None: 395 result["format"] = from_union([from_str, from_none], self.format) 396 if self.hint is not None: 397 result["hint"] = from_union([from_str, from_none], self.hint) 398 result["key"] = from_str(self.key) 399 if self.required is not None: 400 result["required"] = from_union( 401 [ 402 from_bool, 403 lambda x: to_enum(AllowDependencyFailureEnum, x), 404 from_none, 405 ], 406 self.required, 407 ) 408 if self.text is not None: 409 result["text"] = from_union([from_str, from_none], self.text) 410 if self.multiple is not None: 411 result["multiple"] = from_union( 412 [ 413 from_bool, 414 lambda x: to_enum(AllowDependencyFailureEnum, x), 415 from_none, 416 ], 417 self.multiple, 418 ) 419 if self.options is not None: 420 result["options"] = from_union( 421 [lambda x: from_list(lambda x: to_class(Option, x), x), from_none], 422 self.options, 423 ) 424 if self.select is not None: 425 result["select"] = from_union([from_str, from_none], self.select) 426 return result
A list of input fields required to be filled out before unblocking the step
342 def __init__( 343 self, 344 default: Optional[Union[List[str], str]], 345 format: Optional[str], 346 hint: Optional[str], 347 key: str, 348 required: Optional[Union[bool, AllowDependencyFailureEnum]], 349 text: Optional[str], 350 multiple: Optional[Union[bool, AllowDependencyFailureEnum]], 351 options: Optional[List[Option]], 352 select: Optional[str], 353 ) -> None: 354 self.default = default 355 self.format = format 356 self.hint = hint 357 self.key = key 358 self.required = required 359 self.text = text 360 self.multiple = multiple 361 self.options = options 362 self.select = select
The value that is pre-filled in the text field
The value of the option(s) that will be pre-selected in the dropdown
The format must be a regular expression implicitly anchored to the beginning and end of the input and is functionally equivalent to the HTML5 pattern attribute.
Whether the field is required for form submission
Whether more than one option may be selected
364 @staticmethod 365 def from_dict(obj: Any) -> "Field": 366 assert isinstance(obj, dict) 367 default = from_union( 368 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("default") 369 ) 370 format = from_union([from_str, from_none], obj.get("format")) 371 hint = from_union([from_str, from_none], obj.get("hint")) 372 key = from_str(obj.get("key")) 373 required = from_union( 374 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("required") 375 ) 376 text = from_union([from_str, from_none], obj.get("text")) 377 multiple = from_union( 378 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("multiple") 379 ) 380 options = from_union( 381 [lambda x: from_list(Option.from_dict, x), from_none], obj.get("options") 382 ) 383 select = from_union([from_str, from_none], obj.get("select")) 384 return Field( 385 default, format, hint, key, required, text, multiple, options, select 386 )
388 def to_dict(self) -> dict: 389 result: dict = {} 390 if self.default is not None: 391 result["default"] = from_union( 392 [lambda x: from_list(from_str, x), from_str, from_none], self.default 393 ) 394 if self.format is not None: 395 result["format"] = from_union([from_str, from_none], self.format) 396 if self.hint is not None: 397 result["hint"] = from_union([from_str, from_none], self.hint) 398 result["key"] = from_str(self.key) 399 if self.required is not None: 400 result["required"] = from_union( 401 [ 402 from_bool, 403 lambda x: to_enum(AllowDependencyFailureEnum, x), 404 from_none, 405 ], 406 self.required, 407 ) 408 if self.text is not None: 409 result["text"] = from_union([from_str, from_none], self.text) 410 if self.multiple is not None: 411 result["multiple"] = from_union( 412 [ 413 from_bool, 414 lambda x: to_enum(AllowDependencyFailureEnum, x), 415 from_none, 416 ], 417 self.multiple, 418 ) 419 if self.options is not None: 420 result["options"] = from_union( 421 [lambda x: from_list(lambda x: to_class(Option, x), x), from_none], 422 self.options, 423 ) 424 if self.select is not None: 425 result["select"] = from_union([from_str, from_none], self.select) 426 return result
433class BlockStep: 434 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 435 block: Optional[str] 436 """The label of the block step""" 437 438 blocked_state: Optional[BlockedState] 439 """The state that the build is set to when the build is blocked by this block step""" 440 441 branches: Optional[Union[List[str], str]] 442 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 443 fields: Optional[List[Field]] 444 id: Optional[str] 445 identifier: Optional[str] 446 block_step_if: Optional[str] 447 key: Optional[str] 448 label: Optional[str] 449 name: Optional[str] 450 prompt: Optional[str] 451 type: Optional[BlockType] 452 453 def __init__( 454 self, 455 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 456 block: Optional[str], 457 blocked_state: Optional[BlockedState], 458 branches: Optional[Union[List[str], str]], 459 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 460 fields: Optional[List[Field]], 461 id: Optional[str], 462 identifier: Optional[str], 463 block_step_if: Optional[str], 464 key: Optional[str], 465 label: Optional[str], 466 name: Optional[str], 467 prompt: Optional[str], 468 type: Optional[BlockType], 469 ) -> None: 470 self.allow_dependency_failure = allow_dependency_failure 471 self.block = block 472 self.blocked_state = blocked_state 473 self.branches = branches 474 self.depends_on = depends_on 475 self.fields = fields 476 self.id = id 477 self.identifier = identifier 478 self.block_step_if = block_step_if 479 self.key = key 480 self.label = label 481 self.name = name 482 self.prompt = prompt 483 self.type = type 484 485 @staticmethod 486 def from_dict(obj: Any) -> "BlockStep": 487 assert isinstance(obj, dict) 488 allow_dependency_failure = from_union( 489 [from_bool, AllowDependencyFailureEnum, from_none], 490 obj.get("allow_dependency_failure"), 491 ) 492 block = from_union([from_str, from_none], obj.get("block")) 493 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 494 branches = from_union( 495 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 496 ) 497 depends_on = from_union( 498 [ 499 from_none, 500 lambda x: from_list( 501 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 502 ), 503 from_str, 504 ], 505 obj.get("depends_on"), 506 ) 507 fields = from_union( 508 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 509 ) 510 id = from_union([from_str, from_none], obj.get("id")) 511 identifier = from_union([from_str, from_none], obj.get("identifier")) 512 block_step_if = from_union([from_str, from_none], obj.get("if")) 513 key = from_union([from_str, from_none], obj.get("key")) 514 label = from_union([from_str, from_none], obj.get("label")) 515 name = from_union([from_str, from_none], obj.get("name")) 516 prompt = from_union([from_str, from_none], obj.get("prompt")) 517 type = from_union([BlockType, from_none], obj.get("type")) 518 return BlockStep( 519 allow_dependency_failure, 520 block, 521 blocked_state, 522 branches, 523 depends_on, 524 fields, 525 id, 526 identifier, 527 block_step_if, 528 key, 529 label, 530 name, 531 prompt, 532 type, 533 ) 534 535 def to_dict(self) -> dict: 536 result: dict = {} 537 if self.allow_dependency_failure is not None: 538 result["allow_dependency_failure"] = from_union( 539 [ 540 from_bool, 541 lambda x: to_enum(AllowDependencyFailureEnum, x), 542 from_none, 543 ], 544 self.allow_dependency_failure, 545 ) 546 if self.block is not None: 547 result["block"] = from_union([from_str, from_none], self.block) 548 if self.blocked_state is not None: 549 result["blocked_state"] = from_union( 550 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 551 ) 552 if self.branches is not None: 553 result["branches"] = from_union( 554 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 555 ) 556 if self.depends_on is not None: 557 result["depends_on"] = from_union( 558 [ 559 from_none, 560 lambda x: from_list( 561 lambda x: from_union( 562 [lambda x: to_class(DependsOnClass, x), from_str], x 563 ), 564 x, 565 ), 566 from_str, 567 ], 568 self.depends_on, 569 ) 570 if self.fields is not None: 571 result["fields"] = from_union( 572 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 573 self.fields, 574 ) 575 if self.id is not None: 576 result["id"] = from_union([from_str, from_none], self.id) 577 if self.identifier is not None: 578 result["identifier"] = from_union([from_str, from_none], self.identifier) 579 if self.block_step_if is not None: 580 result["if"] = from_union([from_str, from_none], self.block_step_if) 581 if self.key is not None: 582 result["key"] = from_union([from_str, from_none], self.key) 583 if self.label is not None: 584 result["label"] = from_union([from_str, from_none], self.label) 585 if self.name is not None: 586 result["name"] = from_union([from_str, from_none], self.name) 587 if self.prompt is not None: 588 result["prompt"] = from_union([from_str, from_none], self.prompt) 589 if self.type is not None: 590 result["type"] = from_union( 591 [lambda x: to_enum(BlockType, x), from_none], self.type 592 ) 593 return result
453 def __init__( 454 self, 455 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 456 block: Optional[str], 457 blocked_state: Optional[BlockedState], 458 branches: Optional[Union[List[str], str]], 459 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 460 fields: Optional[List[Field]], 461 id: Optional[str], 462 identifier: Optional[str], 463 block_step_if: Optional[str], 464 key: Optional[str], 465 label: Optional[str], 466 name: Optional[str], 467 prompt: Optional[str], 468 type: Optional[BlockType], 469 ) -> None: 470 self.allow_dependency_failure = allow_dependency_failure 471 self.block = block 472 self.blocked_state = blocked_state 473 self.branches = branches 474 self.depends_on = depends_on 475 self.fields = fields 476 self.id = id 477 self.identifier = identifier 478 self.block_step_if = block_step_if 479 self.key = key 480 self.label = label 481 self.name = name 482 self.prompt = prompt 483 self.type = type
The state that the build is set to when the build is blocked by this block step
485 @staticmethod 486 def from_dict(obj: Any) -> "BlockStep": 487 assert isinstance(obj, dict) 488 allow_dependency_failure = from_union( 489 [from_bool, AllowDependencyFailureEnum, from_none], 490 obj.get("allow_dependency_failure"), 491 ) 492 block = from_union([from_str, from_none], obj.get("block")) 493 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 494 branches = from_union( 495 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 496 ) 497 depends_on = from_union( 498 [ 499 from_none, 500 lambda x: from_list( 501 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 502 ), 503 from_str, 504 ], 505 obj.get("depends_on"), 506 ) 507 fields = from_union( 508 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 509 ) 510 id = from_union([from_str, from_none], obj.get("id")) 511 identifier = from_union([from_str, from_none], obj.get("identifier")) 512 block_step_if = from_union([from_str, from_none], obj.get("if")) 513 key = from_union([from_str, from_none], obj.get("key")) 514 label = from_union([from_str, from_none], obj.get("label")) 515 name = from_union([from_str, from_none], obj.get("name")) 516 prompt = from_union([from_str, from_none], obj.get("prompt")) 517 type = from_union([BlockType, from_none], obj.get("type")) 518 return BlockStep( 519 allow_dependency_failure, 520 block, 521 blocked_state, 522 branches, 523 depends_on, 524 fields, 525 id, 526 identifier, 527 block_step_if, 528 key, 529 label, 530 name, 531 prompt, 532 type, 533 )
535 def to_dict(self) -> dict: 536 result: dict = {} 537 if self.allow_dependency_failure is not None: 538 result["allow_dependency_failure"] = from_union( 539 [ 540 from_bool, 541 lambda x: to_enum(AllowDependencyFailureEnum, x), 542 from_none, 543 ], 544 self.allow_dependency_failure, 545 ) 546 if self.block is not None: 547 result["block"] = from_union([from_str, from_none], self.block) 548 if self.blocked_state is not None: 549 result["blocked_state"] = from_union( 550 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 551 ) 552 if self.branches is not None: 553 result["branches"] = from_union( 554 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 555 ) 556 if self.depends_on is not None: 557 result["depends_on"] = from_union( 558 [ 559 from_none, 560 lambda x: from_list( 561 lambda x: from_union( 562 [lambda x: to_class(DependsOnClass, x), from_str], x 563 ), 564 x, 565 ), 566 from_str, 567 ], 568 self.depends_on, 569 ) 570 if self.fields is not None: 571 result["fields"] = from_union( 572 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 573 self.fields, 574 ) 575 if self.id is not None: 576 result["id"] = from_union([from_str, from_none], self.id) 577 if self.identifier is not None: 578 result["identifier"] = from_union([from_str, from_none], self.identifier) 579 if self.block_step_if is not None: 580 result["if"] = from_union([from_str, from_none], self.block_step_if) 581 if self.key is not None: 582 result["key"] = from_union([from_str, from_none], self.key) 583 if self.label is not None: 584 result["label"] = from_union([from_str, from_none], self.label) 585 if self.name is not None: 586 result["name"] = from_union([from_str, from_none], self.name) 587 if self.prompt is not None: 588 result["prompt"] = from_union([from_str, from_none], self.prompt) 589 if self.type is not None: 590 result["type"] = from_union( 591 [lambda x: to_enum(BlockType, x), from_none], self.type 592 ) 593 return result
596class Build: 597 """Properties of the build that will be created when the step is triggered""" 598 599 branch: Optional[str] 600 """The branch for the build""" 601 602 commit: Optional[str] 603 """The commit hash for the build""" 604 605 env: Optional[Dict[str, Any]] 606 message: Optional[str] 607 """The message for the build (supports emoji)""" 608 609 meta_data: Optional[Dict[str, Any]] 610 """Meta-data for the build""" 611 612 def __init__( 613 self, 614 branch: Optional[str], 615 commit: Optional[str], 616 env: Optional[Dict[str, Any]], 617 message: Optional[str], 618 meta_data: Optional[Dict[str, Any]], 619 ) -> None: 620 self.branch = branch 621 self.commit = commit 622 self.env = env 623 self.message = message 624 self.meta_data = meta_data 625 626 @staticmethod 627 def from_dict(obj: Any) -> "Build": 628 assert isinstance(obj, dict) 629 branch = from_union([from_str, from_none], obj.get("branch")) 630 commit = from_union([from_str, from_none], obj.get("commit")) 631 env = from_union( 632 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 633 ) 634 message = from_union([from_str, from_none], obj.get("message")) 635 meta_data = from_union( 636 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("meta_data") 637 ) 638 return Build(branch, commit, env, message, meta_data) 639 640 def to_dict(self) -> dict: 641 result: dict = {} 642 if self.branch is not None: 643 result["branch"] = from_union([from_str, from_none], self.branch) 644 if self.commit is not None: 645 result["commit"] = from_union([from_str, from_none], self.commit) 646 if self.env is not None: 647 result["env"] = from_union( 648 [lambda x: from_dict(lambda x: x, x), from_none], self.env 649 ) 650 if self.message is not None: 651 result["message"] = from_union([from_str, from_none], self.message) 652 if self.meta_data is not None: 653 result["meta_data"] = from_union( 654 [lambda x: from_dict(lambda x: x, x), from_none], self.meta_data 655 ) 656 return result
Properties of the build that will be created when the step is triggered
612 def __init__( 613 self, 614 branch: Optional[str], 615 commit: Optional[str], 616 env: Optional[Dict[str, Any]], 617 message: Optional[str], 618 meta_data: Optional[Dict[str, Any]], 619 ) -> None: 620 self.branch = branch 621 self.commit = commit 622 self.env = env 623 self.message = message 624 self.meta_data = meta_data
626 @staticmethod 627 def from_dict(obj: Any) -> "Build": 628 assert isinstance(obj, dict) 629 branch = from_union([from_str, from_none], obj.get("branch")) 630 commit = from_union([from_str, from_none], obj.get("commit")) 631 env = from_union( 632 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 633 ) 634 message = from_union([from_str, from_none], obj.get("message")) 635 meta_data = from_union( 636 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("meta_data") 637 ) 638 return Build(branch, commit, env, message, meta_data)
640 def to_dict(self) -> dict: 641 result: dict = {} 642 if self.branch is not None: 643 result["branch"] = from_union([from_str, from_none], self.branch) 644 if self.commit is not None: 645 result["commit"] = from_union([from_str, from_none], self.commit) 646 if self.env is not None: 647 result["env"] = from_union( 648 [lambda x: from_dict(lambda x: x, x), from_none], self.env 649 ) 650 if self.message is not None: 651 result["message"] = from_union([from_str, from_none], self.message) 652 if self.meta_data is not None: 653 result["meta_data"] = from_union( 654 [lambda x: from_dict(lambda x: x, x), from_none], self.meta_data 655 ) 656 return result
659class CacheClass: 660 name: Optional[str] 661 paths: List[str] 662 size: Optional[str] 663 664 def __init__( 665 self, name: Optional[str], paths: List[str], size: Optional[str] 666 ) -> None: 667 self.name = name 668 self.paths = paths 669 self.size = size 670 671 @staticmethod 672 def from_dict(obj: Any) -> "CacheClass": 673 assert isinstance(obj, dict) 674 name = from_union([from_str, from_none], obj.get("name")) 675 paths = from_list(from_str, obj.get("paths")) 676 size = from_union([from_str, from_none], obj.get("size")) 677 return CacheClass(name, paths, size) 678 679 def to_dict(self) -> dict: 680 result: dict = {} 681 if self.name is not None: 682 result["name"] = from_union([from_str, from_none], self.name) 683 result["paths"] = from_list(from_str, self.paths) 684 if self.size is not None: 685 result["size"] = from_union([from_str, from_none], self.size) 686 return result
671 @staticmethod 672 def from_dict(obj: Any) -> "CacheClass": 673 assert isinstance(obj, dict) 674 name = from_union([from_str, from_none], obj.get("name")) 675 paths = from_list(from_str, obj.get("paths")) 676 size = from_union([from_str, from_none], obj.get("size")) 677 return CacheClass(name, paths, size)
679 def to_dict(self) -> dict: 680 result: dict = {} 681 if self.name is not None: 682 result["name"] = from_union([from_str, from_none], self.name) 683 result["paths"] = from_list(from_str, self.paths) 684 if self.size is not None: 685 result["size"] = from_union([from_str, from_none], self.size) 686 return result
689class ConcurrencyMethod(Enum): 690 """Control command order, allowed values are 'ordered' (default) and 'eager'. If you use 691 this attribute, you must also define concurrency_group and concurrency. 692 """ 693 694 EAGER = "eager" 695 ORDERED = "ordered"
Control command order, allowed values are 'ordered' (default) and 'eager'. If you use this attribute, you must also define concurrency_group and concurrency.
702class SoftFailElement: 703 exit_status: Optional[Union[int, ExitStatusEnum]] 704 """The exit status number that will cause this job to soft-fail""" 705 706 def __init__(self, exit_status: Optional[Union[int, ExitStatusEnum]]) -> None: 707 self.exit_status = exit_status 708 709 @staticmethod 710 def from_dict(obj: Any) -> "SoftFailElement": 711 assert isinstance(obj, dict) 712 exit_status = from_union( 713 [from_int, ExitStatusEnum, from_none], obj.get("exit_status") 714 ) 715 return SoftFailElement(exit_status) 716 717 def to_dict(self) -> dict: 718 result: dict = {} 719 if self.exit_status is not None: 720 result["exit_status"] = from_union( 721 [from_int, lambda x: to_enum(ExitStatusEnum, x), from_none], 722 self.exit_status, 723 ) 724 return result
The exit status number that will cause this job to soft-fail
727class Adjustment: 728 """An adjustment to a Build Matrix""" 729 730 skip: Optional[Union[bool, str]] 731 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 732 adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]] 733 734 def __init__( 735 self, 736 skip: Optional[Union[bool, str]], 737 soft_fail: Optional[ 738 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 739 ], 740 adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]], 741 ) -> None: 742 self.skip = skip 743 self.soft_fail = soft_fail 744 self.adjustment_with = adjustment_with 745 746 @staticmethod 747 def from_dict(obj: Any) -> "Adjustment": 748 assert isinstance(obj, dict) 749 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 750 soft_fail = from_union( 751 [ 752 from_bool, 753 lambda x: from_list(SoftFailElement.from_dict, x), 754 AllowDependencyFailureEnum, 755 from_none, 756 ], 757 obj.get("soft_fail"), 758 ) 759 adjustment_with = from_union( 760 [ 761 lambda x: from_list( 762 lambda x: from_union([from_int, from_bool, from_str], x), x 763 ), 764 lambda x: from_dict(from_str, x), 765 ], 766 obj.get("with"), 767 ) 768 return Adjustment(skip, soft_fail, adjustment_with) 769 770 def to_dict(self) -> dict: 771 result: dict = {} 772 if self.skip is not None: 773 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 774 if self.soft_fail is not None: 775 result["soft_fail"] = from_union( 776 [ 777 from_bool, 778 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 779 lambda x: to_enum(AllowDependencyFailureEnum, x), 780 from_none, 781 ], 782 self.soft_fail, 783 ) 784 result["with"] = from_union( 785 [ 786 lambda x: from_list( 787 lambda x: from_union([from_int, from_bool, from_str], x), x 788 ), 789 lambda x: from_dict(from_str, x), 790 ], 791 self.adjustment_with, 792 ) 793 return result
An adjustment to a Build Matrix
734 def __init__( 735 self, 736 skip: Optional[Union[bool, str]], 737 soft_fail: Optional[ 738 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 739 ], 740 adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]], 741 ) -> None: 742 self.skip = skip 743 self.soft_fail = soft_fail 744 self.adjustment_with = adjustment_with
746 @staticmethod 747 def from_dict(obj: Any) -> "Adjustment": 748 assert isinstance(obj, dict) 749 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 750 soft_fail = from_union( 751 [ 752 from_bool, 753 lambda x: from_list(SoftFailElement.from_dict, x), 754 AllowDependencyFailureEnum, 755 from_none, 756 ], 757 obj.get("soft_fail"), 758 ) 759 adjustment_with = from_union( 760 [ 761 lambda x: from_list( 762 lambda x: from_union([from_int, from_bool, from_str], x), x 763 ), 764 lambda x: from_dict(from_str, x), 765 ], 766 obj.get("with"), 767 ) 768 return Adjustment(skip, soft_fail, adjustment_with)
770 def to_dict(self) -> dict: 771 result: dict = {} 772 if self.skip is not None: 773 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 774 if self.soft_fail is not None: 775 result["soft_fail"] = from_union( 776 [ 777 from_bool, 778 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 779 lambda x: to_enum(AllowDependencyFailureEnum, x), 780 from_none, 781 ], 782 self.soft_fail, 783 ) 784 result["with"] = from_union( 785 [ 786 lambda x: from_list( 787 lambda x: from_union([from_int, from_bool, from_str], x), x 788 ), 789 lambda x: from_dict(from_str, x), 790 ], 791 self.adjustment_with, 792 ) 793 return result
796class MatrixClass: 797 """Configuration for multi-dimension Build Matrix""" 798 799 adjustments: Optional[List[Adjustment]] 800 """List of Build Matrix adjustments""" 801 802 setup: Union[List[Union[int, bool, str]], Dict[str, List[Union[int, bool, str]]]] 803 804 def __init__( 805 self, 806 adjustments: Optional[List[Adjustment]], 807 setup: Union[ 808 List[Union[int, bool, str]], Dict[str, List[Union[int, bool, str]]] 809 ], 810 ) -> None: 811 self.adjustments = adjustments 812 self.setup = setup 813 814 @staticmethod 815 def from_dict(obj: Any) -> "MatrixClass": 816 assert isinstance(obj, dict) 817 adjustments = from_union( 818 [lambda x: from_list(Adjustment.from_dict, x), from_none], 819 obj.get("adjustments"), 820 ) 821 setup = from_union( 822 [ 823 lambda x: from_list( 824 lambda x: from_union([from_int, from_bool, from_str], x), x 825 ), 826 lambda x: from_dict( 827 lambda x: from_list( 828 lambda x: from_union([from_int, from_bool, from_str], x), x 829 ), 830 x, 831 ), 832 ], 833 obj.get("setup"), 834 ) 835 return MatrixClass(adjustments, setup) 836 837 def to_dict(self) -> dict: 838 result: dict = {} 839 if self.adjustments is not None: 840 result["adjustments"] = from_union( 841 [lambda x: from_list(lambda x: to_class(Adjustment, x), x), from_none], 842 self.adjustments, 843 ) 844 result["setup"] = from_union( 845 [ 846 lambda x: from_list( 847 lambda x: from_union([from_int, from_bool, from_str], x), x 848 ), 849 lambda x: from_dict( 850 lambda x: from_list( 851 lambda x: from_union([from_int, from_bool, from_str], x), x 852 ), 853 x, 854 ), 855 ], 856 self.setup, 857 ) 858 return result
Configuration for multi-dimension Build Matrix
814 @staticmethod 815 def from_dict(obj: Any) -> "MatrixClass": 816 assert isinstance(obj, dict) 817 adjustments = from_union( 818 [lambda x: from_list(Adjustment.from_dict, x), from_none], 819 obj.get("adjustments"), 820 ) 821 setup = from_union( 822 [ 823 lambda x: from_list( 824 lambda x: from_union([from_int, from_bool, from_str], x), x 825 ), 826 lambda x: from_dict( 827 lambda x: from_list( 828 lambda x: from_union([from_int, from_bool, from_str], x), x 829 ), 830 x, 831 ), 832 ], 833 obj.get("setup"), 834 ) 835 return MatrixClass(adjustments, setup)
837 def to_dict(self) -> dict: 838 result: dict = {} 839 if self.adjustments is not None: 840 result["adjustments"] = from_union( 841 [lambda x: from_list(lambda x: to_class(Adjustment, x), x), from_none], 842 self.adjustments, 843 ) 844 result["setup"] = from_union( 845 [ 846 lambda x: from_list( 847 lambda x: from_union([from_int, from_bool, from_str], x), x 848 ), 849 lambda x: from_dict( 850 lambda x: from_list( 851 lambda x: from_union([from_int, from_bool, from_str], x), x 852 ), 853 x, 854 ), 855 ], 856 self.setup, 857 ) 858 return result
861class FluffyGithubCommitStatus: 862 context: Optional[str] 863 """GitHub commit status name""" 864 865 def __init__(self, context: Optional[str]) -> None: 866 self.context = context 867 868 @staticmethod 869 def from_dict(obj: Any) -> "FluffyGithubCommitStatus": 870 assert isinstance(obj, dict) 871 context = from_union([from_str, from_none], obj.get("context")) 872 return FluffyGithubCommitStatus(context) 873 874 def to_dict(self) -> dict: 875 result: dict = {} 876 if self.context is not None: 877 result["context"] = from_union([from_str, from_none], self.context) 878 return result
881class FluffySlack: 882 channels: Optional[List[str]] 883 message: Optional[str] 884 885 def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None: 886 self.channels = channels 887 self.message = message 888 889 @staticmethod 890 def from_dict(obj: Any) -> "FluffySlack": 891 assert isinstance(obj, dict) 892 channels = from_union( 893 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 894 ) 895 message = from_union([from_str, from_none], obj.get("message")) 896 return FluffySlack(channels, message) 897 898 def to_dict(self) -> dict: 899 result: dict = {} 900 if self.channels is not None: 901 result["channels"] = from_union( 902 [lambda x: from_list(from_str, x), from_none], self.channels 903 ) 904 if self.message is not None: 905 result["message"] = from_union([from_str, from_none], self.message) 906 return result
889 @staticmethod 890 def from_dict(obj: Any) -> "FluffySlack": 891 assert isinstance(obj, dict) 892 channels = from_union( 893 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 894 ) 895 message = from_union([from_str, from_none], obj.get("message")) 896 return FluffySlack(channels, message)
898 def to_dict(self) -> dict: 899 result: dict = {} 900 if self.channels is not None: 901 result["channels"] = from_union( 902 [lambda x: from_list(from_str, x), from_none], self.channels 903 ) 904 if self.message is not None: 905 result["message"] = from_union([from_str, from_none], self.message) 906 return result
909class NotifyClass: 910 basecamp_campfire: Optional[str] 911 notify_if: Optional[str] 912 slack: Optional[Union[FluffySlack, str]] 913 github_commit_status: Optional[FluffyGithubCommitStatus] 914 github_check: Optional[Dict[str, Any]] 915 916 def __init__( 917 self, 918 basecamp_campfire: Optional[str], 919 notify_if: Optional[str], 920 slack: Optional[Union[FluffySlack, str]], 921 github_commit_status: Optional[FluffyGithubCommitStatus], 922 github_check: Optional[Dict[str, Any]], 923 ) -> None: 924 self.basecamp_campfire = basecamp_campfire 925 self.notify_if = notify_if 926 self.slack = slack 927 self.github_commit_status = github_commit_status 928 self.github_check = github_check 929 930 @staticmethod 931 def from_dict(obj: Any) -> "NotifyClass": 932 assert isinstance(obj, dict) 933 basecamp_campfire = from_union( 934 [from_str, from_none], obj.get("basecamp_campfire") 935 ) 936 notify_if = from_union([from_str, from_none], obj.get("if")) 937 slack = from_union( 938 [FluffySlack.from_dict, from_str, from_none], obj.get("slack") 939 ) 940 github_commit_status = from_union( 941 [FluffyGithubCommitStatus.from_dict, from_none], 942 obj.get("github_commit_status"), 943 ) 944 github_check = from_union( 945 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 946 ) 947 return NotifyClass( 948 basecamp_campfire, notify_if, slack, github_commit_status, github_check 949 ) 950 951 def to_dict(self) -> dict: 952 result: dict = {} 953 if self.basecamp_campfire is not None: 954 result["basecamp_campfire"] = from_union( 955 [from_str, from_none], self.basecamp_campfire 956 ) 957 if self.notify_if is not None: 958 result["if"] = from_union([from_str, from_none], self.notify_if) 959 if self.slack is not None: 960 result["slack"] = from_union( 961 [lambda x: to_class(FluffySlack, x), from_str, from_none], self.slack 962 ) 963 if self.github_commit_status is not None: 964 result["github_commit_status"] = from_union( 965 [lambda x: to_class(FluffyGithubCommitStatus, x), from_none], 966 self.github_commit_status, 967 ) 968 if self.github_check is not None: 969 result["github_check"] = from_union( 970 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 971 ) 972 return result
916 def __init__( 917 self, 918 basecamp_campfire: Optional[str], 919 notify_if: Optional[str], 920 slack: Optional[Union[FluffySlack, str]], 921 github_commit_status: Optional[FluffyGithubCommitStatus], 922 github_check: Optional[Dict[str, Any]], 923 ) -> None: 924 self.basecamp_campfire = basecamp_campfire 925 self.notify_if = notify_if 926 self.slack = slack 927 self.github_commit_status = github_commit_status 928 self.github_check = github_check
930 @staticmethod 931 def from_dict(obj: Any) -> "NotifyClass": 932 assert isinstance(obj, dict) 933 basecamp_campfire = from_union( 934 [from_str, from_none], obj.get("basecamp_campfire") 935 ) 936 notify_if = from_union([from_str, from_none], obj.get("if")) 937 slack = from_union( 938 [FluffySlack.from_dict, from_str, from_none], obj.get("slack") 939 ) 940 github_commit_status = from_union( 941 [FluffyGithubCommitStatus.from_dict, from_none], 942 obj.get("github_commit_status"), 943 ) 944 github_check = from_union( 945 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 946 ) 947 return NotifyClass( 948 basecamp_campfire, notify_if, slack, github_commit_status, github_check 949 )
951 def to_dict(self) -> dict: 952 result: dict = {} 953 if self.basecamp_campfire is not None: 954 result["basecamp_campfire"] = from_union( 955 [from_str, from_none], self.basecamp_campfire 956 ) 957 if self.notify_if is not None: 958 result["if"] = from_union([from_str, from_none], self.notify_if) 959 if self.slack is not None: 960 result["slack"] = from_union( 961 [lambda x: to_class(FluffySlack, x), from_str, from_none], self.slack 962 ) 963 if self.github_commit_status is not None: 964 result["github_commit_status"] = from_union( 965 [lambda x: to_class(FluffyGithubCommitStatus, x), from_none], 966 self.github_commit_status, 967 ) 968 if self.github_check is not None: 969 result["github_check"] = from_union( 970 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 971 ) 972 return result
975class SignalReason(Enum): 976 """The exit signal reason, if any, that may be retried""" 977 978 AGENT_REFUSED = "agent_refused" 979 AGENT_STOP = "agent_stop" 980 CANCEL = "cancel" 981 EMPTY = "*" 982 NONE = "none" 983 PROCESS_RUN_ERROR = "process_run_error" 984 SIGNATURE_REJECTED = "signature_rejected"
The exit signal reason, if any, that may be retried
987class AutomaticRetry: 988 exit_status: Optional[Union[int, List[int], ExitStatusEnum]] 989 """The exit status number that will cause this job to retry""" 990 991 limit: Optional[int] 992 """The number of times this job can be retried""" 993 994 signal: Optional[str] 995 """The exit signal, if any, that may be retried""" 996 997 signal_reason: Optional[SignalReason] 998 """The exit signal reason, if any, that may be retried""" 999 1000 def __init__( 1001 self, 1002 exit_status: Optional[Union[int, List[int], ExitStatusEnum]], 1003 limit: Optional[int], 1004 signal: Optional[str], 1005 signal_reason: Optional[SignalReason], 1006 ) -> None: 1007 self.exit_status = exit_status 1008 self.limit = limit 1009 self.signal = signal 1010 self.signal_reason = signal_reason 1011 1012 @staticmethod 1013 def from_dict(obj: Any) -> "AutomaticRetry": 1014 assert isinstance(obj, dict) 1015 exit_status = from_union( 1016 [from_int, lambda x: from_list(from_int, x), ExitStatusEnum, from_none], 1017 obj.get("exit_status"), 1018 ) 1019 limit = from_union([from_int, from_none], obj.get("limit")) 1020 signal = from_union([from_str, from_none], obj.get("signal")) 1021 signal_reason = from_union([SignalReason, from_none], obj.get("signal_reason")) 1022 return AutomaticRetry(exit_status, limit, signal, signal_reason) 1023 1024 def to_dict(self) -> dict: 1025 result: dict = {} 1026 if self.exit_status is not None: 1027 result["exit_status"] = from_union( 1028 [ 1029 from_int, 1030 lambda x: from_list(from_int, x), 1031 lambda x: to_enum(ExitStatusEnum, x), 1032 from_none, 1033 ], 1034 self.exit_status, 1035 ) 1036 if self.limit is not None: 1037 result["limit"] = from_union([from_int, from_none], self.limit) 1038 if self.signal is not None: 1039 result["signal"] = from_union([from_str, from_none], self.signal) 1040 if self.signal_reason is not None: 1041 result["signal_reason"] = from_union( 1042 [lambda x: to_enum(SignalReason, x), from_none], self.signal_reason 1043 ) 1044 return result
1000 def __init__( 1001 self, 1002 exit_status: Optional[Union[int, List[int], ExitStatusEnum]], 1003 limit: Optional[int], 1004 signal: Optional[str], 1005 signal_reason: Optional[SignalReason], 1006 ) -> None: 1007 self.exit_status = exit_status 1008 self.limit = limit 1009 self.signal = signal 1010 self.signal_reason = signal_reason
The exit status number that will cause this job to retry
1012 @staticmethod 1013 def from_dict(obj: Any) -> "AutomaticRetry": 1014 assert isinstance(obj, dict) 1015 exit_status = from_union( 1016 [from_int, lambda x: from_list(from_int, x), ExitStatusEnum, from_none], 1017 obj.get("exit_status"), 1018 ) 1019 limit = from_union([from_int, from_none], obj.get("limit")) 1020 signal = from_union([from_str, from_none], obj.get("signal")) 1021 signal_reason = from_union([SignalReason, from_none], obj.get("signal_reason")) 1022 return AutomaticRetry(exit_status, limit, signal, signal_reason)
1024 def to_dict(self) -> dict: 1025 result: dict = {} 1026 if self.exit_status is not None: 1027 result["exit_status"] = from_union( 1028 [ 1029 from_int, 1030 lambda x: from_list(from_int, x), 1031 lambda x: to_enum(ExitStatusEnum, x), 1032 from_none, 1033 ], 1034 self.exit_status, 1035 ) 1036 if self.limit is not None: 1037 result["limit"] = from_union([from_int, from_none], self.limit) 1038 if self.signal is not None: 1039 result["signal"] = from_union([from_str, from_none], self.signal) 1040 if self.signal_reason is not None: 1041 result["signal_reason"] = from_union( 1042 [lambda x: to_enum(SignalReason, x), from_none], self.signal_reason 1043 ) 1044 return result
1047class ManualClass: 1048 allowed: Optional[Union[bool, AllowDependencyFailureEnum]] 1049 """Whether or not this job can be retried manually""" 1050 1051 permit_on_passed: Optional[Union[bool, AllowDependencyFailureEnum]] 1052 """Whether or not this job can be retried after it has passed""" 1053 1054 reason: Optional[str] 1055 """A string that will be displayed in a tooltip on the Retry button in Buildkite. This will 1056 only be displayed if the allowed attribute is set to false. 1057 """ 1058 1059 def __init__( 1060 self, 1061 allowed: Optional[Union[bool, AllowDependencyFailureEnum]], 1062 permit_on_passed: Optional[Union[bool, AllowDependencyFailureEnum]], 1063 reason: Optional[str], 1064 ) -> None: 1065 self.allowed = allowed 1066 self.permit_on_passed = permit_on_passed 1067 self.reason = reason 1068 1069 @staticmethod 1070 def from_dict(obj: Any) -> "ManualClass": 1071 assert isinstance(obj, dict) 1072 allowed = from_union( 1073 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("allowed") 1074 ) 1075 permit_on_passed = from_union( 1076 [from_bool, AllowDependencyFailureEnum, from_none], 1077 obj.get("permit_on_passed"), 1078 ) 1079 reason = from_union([from_str, from_none], obj.get("reason")) 1080 return ManualClass(allowed, permit_on_passed, reason) 1081 1082 def to_dict(self) -> dict: 1083 result: dict = {} 1084 if self.allowed is not None: 1085 result["allowed"] = from_union( 1086 [ 1087 from_bool, 1088 lambda x: to_enum(AllowDependencyFailureEnum, x), 1089 from_none, 1090 ], 1091 self.allowed, 1092 ) 1093 if self.permit_on_passed is not None: 1094 result["permit_on_passed"] = from_union( 1095 [ 1096 from_bool, 1097 lambda x: to_enum(AllowDependencyFailureEnum, x), 1098 from_none, 1099 ], 1100 self.permit_on_passed, 1101 ) 1102 if self.reason is not None: 1103 result["reason"] = from_union([from_str, from_none], self.reason) 1104 return result
1059 def __init__( 1060 self, 1061 allowed: Optional[Union[bool, AllowDependencyFailureEnum]], 1062 permit_on_passed: Optional[Union[bool, AllowDependencyFailureEnum]], 1063 reason: Optional[str], 1064 ) -> None: 1065 self.allowed = allowed 1066 self.permit_on_passed = permit_on_passed 1067 self.reason = reason
Whether or not this job can be retried manually
Whether or not this job can be retried after it has passed
A string that will be displayed in a tooltip on the Retry button in Buildkite. This will only be displayed if the allowed attribute is set to false.
1069 @staticmethod 1070 def from_dict(obj: Any) -> "ManualClass": 1071 assert isinstance(obj, dict) 1072 allowed = from_union( 1073 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("allowed") 1074 ) 1075 permit_on_passed = from_union( 1076 [from_bool, AllowDependencyFailureEnum, from_none], 1077 obj.get("permit_on_passed"), 1078 ) 1079 reason = from_union([from_str, from_none], obj.get("reason")) 1080 return ManualClass(allowed, permit_on_passed, reason)
1082 def to_dict(self) -> dict: 1083 result: dict = {} 1084 if self.allowed is not None: 1085 result["allowed"] = from_union( 1086 [ 1087 from_bool, 1088 lambda x: to_enum(AllowDependencyFailureEnum, x), 1089 from_none, 1090 ], 1091 self.allowed, 1092 ) 1093 if self.permit_on_passed is not None: 1094 result["permit_on_passed"] = from_union( 1095 [ 1096 from_bool, 1097 lambda x: to_enum(AllowDependencyFailureEnum, x), 1098 from_none, 1099 ], 1100 self.permit_on_passed, 1101 ) 1102 if self.reason is not None: 1103 result["reason"] = from_union([from_str, from_none], self.reason) 1104 return result
1107class Retry: 1108 """The conditions for retrying this step.""" 1109 1110 automatic: Optional[ 1111 Union[bool, AutomaticRetry, List[AutomaticRetry], AllowDependencyFailureEnum] 1112 ] 1113 """Whether to allow a job to retry automatically. If set to true, the retry conditions are 1114 set to the default value. 1115 """ 1116 manual: Optional[Union[bool, ManualClass, AllowDependencyFailureEnum]] 1117 """Whether to allow a job to be retried manually""" 1118 1119 def __init__( 1120 self, 1121 automatic: Optional[ 1122 Union[ 1123 bool, AutomaticRetry, List[AutomaticRetry], AllowDependencyFailureEnum 1124 ] 1125 ], 1126 manual: Optional[Union[bool, ManualClass, AllowDependencyFailureEnum]], 1127 ) -> None: 1128 self.automatic = automatic 1129 self.manual = manual 1130 1131 @staticmethod 1132 def from_dict(obj: Any) -> "Retry": 1133 assert isinstance(obj, dict) 1134 automatic = from_union( 1135 [ 1136 from_bool, 1137 AutomaticRetry.from_dict, 1138 lambda x: from_list(AutomaticRetry.from_dict, x), 1139 AllowDependencyFailureEnum, 1140 from_none, 1141 ], 1142 obj.get("automatic"), 1143 ) 1144 manual = from_union( 1145 [from_bool, ManualClass.from_dict, AllowDependencyFailureEnum, from_none], 1146 obj.get("manual"), 1147 ) 1148 return Retry(automatic, manual) 1149 1150 def to_dict(self) -> dict: 1151 result: dict = {} 1152 if self.automatic is not None: 1153 result["automatic"] = from_union( 1154 [ 1155 from_bool, 1156 lambda x: to_class(AutomaticRetry, x), 1157 lambda x: from_list(lambda x: to_class(AutomaticRetry, x), x), 1158 lambda x: to_enum(AllowDependencyFailureEnum, x), 1159 from_none, 1160 ], 1161 self.automatic, 1162 ) 1163 if self.manual is not None: 1164 result["manual"] = from_union( 1165 [ 1166 from_bool, 1167 lambda x: to_class(ManualClass, x), 1168 lambda x: to_enum(AllowDependencyFailureEnum, x), 1169 from_none, 1170 ], 1171 self.manual, 1172 ) 1173 return result
The conditions for retrying this step.
1119 def __init__( 1120 self, 1121 automatic: Optional[ 1122 Union[ 1123 bool, AutomaticRetry, List[AutomaticRetry], AllowDependencyFailureEnum 1124 ] 1125 ], 1126 manual: Optional[Union[bool, ManualClass, AllowDependencyFailureEnum]], 1127 ) -> None: 1128 self.automatic = automatic 1129 self.manual = manual
Whether to allow a job to retry automatically. If set to true, the retry conditions are set to the default value.
Whether to allow a job to be retried manually
1131 @staticmethod 1132 def from_dict(obj: Any) -> "Retry": 1133 assert isinstance(obj, dict) 1134 automatic = from_union( 1135 [ 1136 from_bool, 1137 AutomaticRetry.from_dict, 1138 lambda x: from_list(AutomaticRetry.from_dict, x), 1139 AllowDependencyFailureEnum, 1140 from_none, 1141 ], 1142 obj.get("automatic"), 1143 ) 1144 manual = from_union( 1145 [from_bool, ManualClass.from_dict, AllowDependencyFailureEnum, from_none], 1146 obj.get("manual"), 1147 ) 1148 return Retry(automatic, manual)
1150 def to_dict(self) -> dict: 1151 result: dict = {} 1152 if self.automatic is not None: 1153 result["automatic"] = from_union( 1154 [ 1155 from_bool, 1156 lambda x: to_class(AutomaticRetry, x), 1157 lambda x: from_list(lambda x: to_class(AutomaticRetry, x), x), 1158 lambda x: to_enum(AllowDependencyFailureEnum, x), 1159 from_none, 1160 ], 1161 self.automatic, 1162 ) 1163 if self.manual is not None: 1164 result["manual"] = from_union( 1165 [ 1166 from_bool, 1167 lambda x: to_class(ManualClass, x), 1168 lambda x: to_enum(AllowDependencyFailureEnum, x), 1169 from_none, 1170 ], 1171 self.manual, 1172 ) 1173 return result
1176class Signature: 1177 """The signature of the command step, generally injected by agents at pipeline upload""" 1178 1179 algorithm: Optional[str] 1180 """The algorithm used to generate the signature""" 1181 1182 signed_fields: Optional[List[str]] 1183 """The fields that were signed to form the signature value""" 1184 1185 value: Optional[str] 1186 """The signature value, a JWS compact signature with a detached body""" 1187 1188 def __init__( 1189 self, 1190 algorithm: Optional[str], 1191 signed_fields: Optional[List[str]], 1192 value: Optional[str], 1193 ) -> None: 1194 self.algorithm = algorithm 1195 self.signed_fields = signed_fields 1196 self.value = value 1197 1198 @staticmethod 1199 def from_dict(obj: Any) -> "Signature": 1200 assert isinstance(obj, dict) 1201 algorithm = from_union([from_str, from_none], obj.get("algorithm")) 1202 signed_fields = from_union( 1203 [lambda x: from_list(from_str, x), from_none], obj.get("signed_fields") 1204 ) 1205 value = from_union([from_str, from_none], obj.get("value")) 1206 return Signature(algorithm, signed_fields, value) 1207 1208 def to_dict(self) -> dict: 1209 result: dict = {} 1210 if self.algorithm is not None: 1211 result["algorithm"] = from_union([from_str, from_none], self.algorithm) 1212 if self.signed_fields is not None: 1213 result["signed_fields"] = from_union( 1214 [lambda x: from_list(from_str, x), from_none], self.signed_fields 1215 ) 1216 if self.value is not None: 1217 result["value"] = from_union([from_str, from_none], self.value) 1218 return result
The signature of the command step, generally injected by agents at pipeline upload
1198 @staticmethod 1199 def from_dict(obj: Any) -> "Signature": 1200 assert isinstance(obj, dict) 1201 algorithm = from_union([from_str, from_none], obj.get("algorithm")) 1202 signed_fields = from_union( 1203 [lambda x: from_list(from_str, x), from_none], obj.get("signed_fields") 1204 ) 1205 value = from_union([from_str, from_none], obj.get("value")) 1206 return Signature(algorithm, signed_fields, value)
1208 def to_dict(self) -> dict: 1209 result: dict = {} 1210 if self.algorithm is not None: 1211 result["algorithm"] = from_union([from_str, from_none], self.algorithm) 1212 if self.signed_fields is not None: 1213 result["signed_fields"] = from_union( 1214 [lambda x: from_list(from_str, x), from_none], self.signed_fields 1215 ) 1216 if self.value is not None: 1217 result["value"] = from_union([from_str, from_none], self.value) 1218 return result
1221class CommandType(Enum): 1222 COMMAND = "command" 1223 COMMANDS = "commands" 1224 SCRIPT = "script"
1227class CommandStep: 1228 agents: Optional[Union[Dict[str, Any], List[str]]] 1229 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 1230 artifact_paths: Optional[Union[List[str], str]] 1231 """The glob path/s of artifacts to upload once this step has finished running""" 1232 1233 branches: Optional[Union[List[str], str]] 1234 cache: Optional[Union[List[str], CacheClass, str]] 1235 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]] 1236 command: Optional[Union[List[str], str]] 1237 """The commands to run on the agent""" 1238 1239 commands: Optional[Union[List[str], str]] 1240 """The commands to run on the agent""" 1241 1242 concurrency: Optional[int] 1243 """The maximum number of jobs created from this step that are allowed to run at the same 1244 time. If you use this attribute, you must also define concurrency_group. 1245 """ 1246 concurrency_group: Optional[str] 1247 """A unique name for the concurrency group that you are creating with the concurrency 1248 attribute 1249 """ 1250 concurrency_method: Optional[ConcurrencyMethod] 1251 """Control command order, allowed values are 'ordered' (default) and 'eager'. If you use 1252 this attribute, you must also define concurrency_group and concurrency. 1253 """ 1254 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 1255 env: Optional[Dict[str, Any]] 1256 id: Optional[str] 1257 identifier: Optional[str] 1258 command_step_if: Optional[str] 1259 key: Optional[str] 1260 label: Optional[str] 1261 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]] 1262 name: Optional[str] 1263 notify: Optional[List[Union[NotifyClass, NotifyEnum]]] 1264 """Array of notification options for this step""" 1265 1266 parallelism: Optional[int] 1267 """The number of parallel jobs that will be created based on this step""" 1268 1269 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]] 1270 priority: Optional[int] 1271 """Priority of the job, higher priorities are assigned to agents""" 1272 1273 retry: Optional[Retry] 1274 """The conditions for retrying this step.""" 1275 1276 signature: Optional[Signature] 1277 """The signature of the command step, generally injected by agents at pipeline upload""" 1278 1279 skip: Optional[Union[bool, str]] 1280 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 1281 timeout_in_minutes: Optional[int] 1282 """The number of minutes to time out a job""" 1283 1284 type: Optional[CommandType] 1285 1286 def __init__( 1287 self, 1288 agents: Optional[Union[Dict[str, Any], List[str]]], 1289 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 1290 artifact_paths: Optional[Union[List[str], str]], 1291 branches: Optional[Union[List[str], str]], 1292 cache: Optional[Union[List[str], CacheClass, str]], 1293 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 1294 command: Optional[Union[List[str], str]], 1295 commands: Optional[Union[List[str], str]], 1296 concurrency: Optional[int], 1297 concurrency_group: Optional[str], 1298 concurrency_method: Optional[ConcurrencyMethod], 1299 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 1300 env: Optional[Dict[str, Any]], 1301 id: Optional[str], 1302 identifier: Optional[str], 1303 command_step_if: Optional[str], 1304 key: Optional[str], 1305 label: Optional[str], 1306 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 1307 name: Optional[str], 1308 notify: Optional[List[Union[NotifyClass, NotifyEnum]]], 1309 parallelism: Optional[int], 1310 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 1311 priority: Optional[int], 1312 retry: Optional[Retry], 1313 signature: Optional[Signature], 1314 skip: Optional[Union[bool, str]], 1315 soft_fail: Optional[ 1316 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 1317 ], 1318 timeout_in_minutes: Optional[int], 1319 type: Optional[CommandType], 1320 ) -> None: 1321 self.agents = agents 1322 self.allow_dependency_failure = allow_dependency_failure 1323 self.artifact_paths = artifact_paths 1324 self.branches = branches 1325 self.cache = cache 1326 self.cancel_on_build_failing = cancel_on_build_failing 1327 self.command = command 1328 self.commands = commands 1329 self.concurrency = concurrency 1330 self.concurrency_group = concurrency_group 1331 self.concurrency_method = concurrency_method 1332 self.depends_on = depends_on 1333 self.env = env 1334 self.id = id 1335 self.identifier = identifier 1336 self.command_step_if = command_step_if 1337 self.key = key 1338 self.label = label 1339 self.matrix = matrix 1340 self.name = name 1341 self.notify = notify 1342 self.parallelism = parallelism 1343 self.plugins = plugins 1344 self.priority = priority 1345 self.retry = retry 1346 self.signature = signature 1347 self.skip = skip 1348 self.soft_fail = soft_fail 1349 self.timeout_in_minutes = timeout_in_minutes 1350 self.type = type 1351 1352 @staticmethod 1353 def from_dict(obj: Any) -> "CommandStep": 1354 assert isinstance(obj, dict) 1355 agents = from_union( 1356 [ 1357 lambda x: from_dict(lambda x: x, x), 1358 lambda x: from_list(from_str, x), 1359 from_none, 1360 ], 1361 obj.get("agents"), 1362 ) 1363 allow_dependency_failure = from_union( 1364 [from_bool, AllowDependencyFailureEnum, from_none], 1365 obj.get("allow_dependency_failure"), 1366 ) 1367 artifact_paths = from_union( 1368 [lambda x: from_list(from_str, x), from_str, from_none], 1369 obj.get("artifact_paths"), 1370 ) 1371 branches = from_union( 1372 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 1373 ) 1374 cache = from_union( 1375 [ 1376 lambda x: from_list(from_str, x), 1377 CacheClass.from_dict, 1378 from_str, 1379 from_none, 1380 ], 1381 obj.get("cache"), 1382 ) 1383 cancel_on_build_failing = from_union( 1384 [from_bool, AllowDependencyFailureEnum, from_none], 1385 obj.get("cancel_on_build_failing"), 1386 ) 1387 command = from_union( 1388 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("command") 1389 ) 1390 commands = from_union( 1391 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("commands") 1392 ) 1393 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 1394 concurrency_group = from_union( 1395 [from_str, from_none], obj.get("concurrency_group") 1396 ) 1397 concurrency_method = from_union( 1398 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 1399 ) 1400 depends_on = from_union( 1401 [ 1402 from_none, 1403 lambda x: from_list( 1404 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 1405 ), 1406 from_str, 1407 ], 1408 obj.get("depends_on"), 1409 ) 1410 env = from_union( 1411 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 1412 ) 1413 id = from_union([from_str, from_none], obj.get("id")) 1414 identifier = from_union([from_str, from_none], obj.get("identifier")) 1415 command_step_if = from_union([from_str, from_none], obj.get("if")) 1416 key = from_union([from_str, from_none], obj.get("key")) 1417 label = from_union([from_str, from_none], obj.get("label")) 1418 matrix = from_union( 1419 [ 1420 lambda x: from_list( 1421 lambda x: from_union([from_int, from_bool, from_str], x), x 1422 ), 1423 MatrixClass.from_dict, 1424 from_none, 1425 ], 1426 obj.get("matrix"), 1427 ) 1428 name = from_union([from_str, from_none], obj.get("name")) 1429 notify = from_union( 1430 [ 1431 lambda x: from_list( 1432 lambda x: from_union([NotifyClass.from_dict, NotifyEnum], x), x 1433 ), 1434 from_none, 1435 ], 1436 obj.get("notify"), 1437 ) 1438 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 1439 plugins = from_union( 1440 [ 1441 lambda x: from_list( 1442 lambda x: from_union( 1443 [lambda x: from_dict(lambda x: x, x), from_str], x 1444 ), 1445 x, 1446 ), 1447 lambda x: from_dict(lambda x: x, x), 1448 from_none, 1449 ], 1450 obj.get("plugins"), 1451 ) 1452 priority = from_union([from_int, from_none], obj.get("priority")) 1453 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 1454 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 1455 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 1456 soft_fail = from_union( 1457 [ 1458 from_bool, 1459 lambda x: from_list(SoftFailElement.from_dict, x), 1460 AllowDependencyFailureEnum, 1461 from_none, 1462 ], 1463 obj.get("soft_fail"), 1464 ) 1465 timeout_in_minutes = from_union( 1466 [from_int, from_none], obj.get("timeout_in_minutes") 1467 ) 1468 type = from_union([CommandType, from_none], obj.get("type")) 1469 return CommandStep( 1470 agents, 1471 allow_dependency_failure, 1472 artifact_paths, 1473 branches, 1474 cache, 1475 cancel_on_build_failing, 1476 command, 1477 commands, 1478 concurrency, 1479 concurrency_group, 1480 concurrency_method, 1481 depends_on, 1482 env, 1483 id, 1484 identifier, 1485 command_step_if, 1486 key, 1487 label, 1488 matrix, 1489 name, 1490 notify, 1491 parallelism, 1492 plugins, 1493 priority, 1494 retry, 1495 signature, 1496 skip, 1497 soft_fail, 1498 timeout_in_minutes, 1499 type, 1500 ) 1501 1502 def to_dict(self) -> dict: 1503 result: dict = {} 1504 if self.agents is not None: 1505 result["agents"] = from_union( 1506 [ 1507 lambda x: from_dict(lambda x: x, x), 1508 lambda x: from_list(from_str, x), 1509 from_none, 1510 ], 1511 self.agents, 1512 ) 1513 if self.allow_dependency_failure is not None: 1514 result["allow_dependency_failure"] = from_union( 1515 [ 1516 from_bool, 1517 lambda x: to_enum(AllowDependencyFailureEnum, x), 1518 from_none, 1519 ], 1520 self.allow_dependency_failure, 1521 ) 1522 if self.artifact_paths is not None: 1523 result["artifact_paths"] = from_union( 1524 [lambda x: from_list(from_str, x), from_str, from_none], 1525 self.artifact_paths, 1526 ) 1527 if self.branches is not None: 1528 result["branches"] = from_union( 1529 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 1530 ) 1531 if self.cache is not None: 1532 result["cache"] = from_union( 1533 [ 1534 lambda x: from_list(from_str, x), 1535 lambda x: to_class(CacheClass, x), 1536 from_str, 1537 from_none, 1538 ], 1539 self.cache, 1540 ) 1541 if self.cancel_on_build_failing is not None: 1542 result["cancel_on_build_failing"] = from_union( 1543 [ 1544 from_bool, 1545 lambda x: to_enum(AllowDependencyFailureEnum, x), 1546 from_none, 1547 ], 1548 self.cancel_on_build_failing, 1549 ) 1550 if self.command is not None: 1551 result["command"] = from_union( 1552 [lambda x: from_list(from_str, x), from_str, from_none], self.command 1553 ) 1554 if self.commands is not None: 1555 result["commands"] = from_union( 1556 [lambda x: from_list(from_str, x), from_str, from_none], self.commands 1557 ) 1558 if self.concurrency is not None: 1559 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 1560 if self.concurrency_group is not None: 1561 result["concurrency_group"] = from_union( 1562 [from_str, from_none], self.concurrency_group 1563 ) 1564 if self.concurrency_method is not None: 1565 result["concurrency_method"] = from_union( 1566 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 1567 self.concurrency_method, 1568 ) 1569 if self.depends_on is not None: 1570 result["depends_on"] = from_union( 1571 [ 1572 from_none, 1573 lambda x: from_list( 1574 lambda x: from_union( 1575 [lambda x: to_class(DependsOnClass, x), from_str], x 1576 ), 1577 x, 1578 ), 1579 from_str, 1580 ], 1581 self.depends_on, 1582 ) 1583 if self.env is not None: 1584 result["env"] = from_union( 1585 [lambda x: from_dict(lambda x: x, x), from_none], self.env 1586 ) 1587 if self.id is not None: 1588 result["id"] = from_union([from_str, from_none], self.id) 1589 if self.identifier is not None: 1590 result["identifier"] = from_union([from_str, from_none], self.identifier) 1591 if self.command_step_if is not None: 1592 result["if"] = from_union([from_str, from_none], self.command_step_if) 1593 if self.key is not None: 1594 result["key"] = from_union([from_str, from_none], self.key) 1595 if self.label is not None: 1596 result["label"] = from_union([from_str, from_none], self.label) 1597 if self.matrix is not None: 1598 result["matrix"] = from_union( 1599 [ 1600 lambda x: from_list( 1601 lambda x: from_union([from_int, from_bool, from_str], x), x 1602 ), 1603 lambda x: to_class(MatrixClass, x), 1604 from_none, 1605 ], 1606 self.matrix, 1607 ) 1608 if self.name is not None: 1609 result["name"] = from_union([from_str, from_none], self.name) 1610 if self.notify is not None: 1611 result["notify"] = from_union( 1612 [ 1613 lambda x: from_list( 1614 lambda x: from_union( 1615 [ 1616 lambda x: to_class(NotifyClass, x), 1617 lambda x: to_enum(NotifyEnum, x), 1618 ], 1619 x, 1620 ), 1621 x, 1622 ), 1623 from_none, 1624 ], 1625 self.notify, 1626 ) 1627 if self.parallelism is not None: 1628 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 1629 if self.plugins is not None: 1630 result["plugins"] = from_union( 1631 [ 1632 lambda x: from_list( 1633 lambda x: from_union( 1634 [lambda x: from_dict(lambda x: x, x), from_str], x 1635 ), 1636 x, 1637 ), 1638 lambda x: from_dict(lambda x: x, x), 1639 from_none, 1640 ], 1641 self.plugins, 1642 ) 1643 if self.priority is not None: 1644 result["priority"] = from_union([from_int, from_none], self.priority) 1645 if self.retry is not None: 1646 result["retry"] = from_union( 1647 [lambda x: to_class(Retry, x), from_none], self.retry 1648 ) 1649 if self.signature is not None: 1650 result["signature"] = from_union( 1651 [lambda x: to_class(Signature, x), from_none], self.signature 1652 ) 1653 if self.skip is not None: 1654 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 1655 if self.soft_fail is not None: 1656 result["soft_fail"] = from_union( 1657 [ 1658 from_bool, 1659 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 1660 lambda x: to_enum(AllowDependencyFailureEnum, x), 1661 from_none, 1662 ], 1663 self.soft_fail, 1664 ) 1665 if self.timeout_in_minutes is not None: 1666 result["timeout_in_minutes"] = from_union( 1667 [from_int, from_none], self.timeout_in_minutes 1668 ) 1669 if self.type is not None: 1670 result["type"] = from_union( 1671 [lambda x: to_enum(CommandType, x), from_none], self.type 1672 ) 1673 return result
1286 def __init__( 1287 self, 1288 agents: Optional[Union[Dict[str, Any], List[str]]], 1289 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 1290 artifact_paths: Optional[Union[List[str], str]], 1291 branches: Optional[Union[List[str], str]], 1292 cache: Optional[Union[List[str], CacheClass, str]], 1293 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 1294 command: Optional[Union[List[str], str]], 1295 commands: Optional[Union[List[str], str]], 1296 concurrency: Optional[int], 1297 concurrency_group: Optional[str], 1298 concurrency_method: Optional[ConcurrencyMethod], 1299 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 1300 env: Optional[Dict[str, Any]], 1301 id: Optional[str], 1302 identifier: Optional[str], 1303 command_step_if: Optional[str], 1304 key: Optional[str], 1305 label: Optional[str], 1306 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 1307 name: Optional[str], 1308 notify: Optional[List[Union[NotifyClass, NotifyEnum]]], 1309 parallelism: Optional[int], 1310 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 1311 priority: Optional[int], 1312 retry: Optional[Retry], 1313 signature: Optional[Signature], 1314 skip: Optional[Union[bool, str]], 1315 soft_fail: Optional[ 1316 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 1317 ], 1318 timeout_in_minutes: Optional[int], 1319 type: Optional[CommandType], 1320 ) -> None: 1321 self.agents = agents 1322 self.allow_dependency_failure = allow_dependency_failure 1323 self.artifact_paths = artifact_paths 1324 self.branches = branches 1325 self.cache = cache 1326 self.cancel_on_build_failing = cancel_on_build_failing 1327 self.command = command 1328 self.commands = commands 1329 self.concurrency = concurrency 1330 self.concurrency_group = concurrency_group 1331 self.concurrency_method = concurrency_method 1332 self.depends_on = depends_on 1333 self.env = env 1334 self.id = id 1335 self.identifier = identifier 1336 self.command_step_if = command_step_if 1337 self.key = key 1338 self.label = label 1339 self.matrix = matrix 1340 self.name = name 1341 self.notify = notify 1342 self.parallelism = parallelism 1343 self.plugins = plugins 1344 self.priority = priority 1345 self.retry = retry 1346 self.signature = signature 1347 self.skip = skip 1348 self.soft_fail = soft_fail 1349 self.timeout_in_minutes = timeout_in_minutes 1350 self.type = type
The glob path/s of artifacts to upload once this step has finished running
The maximum number of jobs created from this step that are allowed to run at the same time. If you use this attribute, you must also define concurrency_group.
A unique name for the concurrency group that you are creating with the concurrency attribute
Control command order, allowed values are 'ordered' (default) and 'eager'. If you use this attribute, you must also define concurrency_group and concurrency.
The signature of the command step, generally injected by agents at pipeline upload
1352 @staticmethod 1353 def from_dict(obj: Any) -> "CommandStep": 1354 assert isinstance(obj, dict) 1355 agents = from_union( 1356 [ 1357 lambda x: from_dict(lambda x: x, x), 1358 lambda x: from_list(from_str, x), 1359 from_none, 1360 ], 1361 obj.get("agents"), 1362 ) 1363 allow_dependency_failure = from_union( 1364 [from_bool, AllowDependencyFailureEnum, from_none], 1365 obj.get("allow_dependency_failure"), 1366 ) 1367 artifact_paths = from_union( 1368 [lambda x: from_list(from_str, x), from_str, from_none], 1369 obj.get("artifact_paths"), 1370 ) 1371 branches = from_union( 1372 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 1373 ) 1374 cache = from_union( 1375 [ 1376 lambda x: from_list(from_str, x), 1377 CacheClass.from_dict, 1378 from_str, 1379 from_none, 1380 ], 1381 obj.get("cache"), 1382 ) 1383 cancel_on_build_failing = from_union( 1384 [from_bool, AllowDependencyFailureEnum, from_none], 1385 obj.get("cancel_on_build_failing"), 1386 ) 1387 command = from_union( 1388 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("command") 1389 ) 1390 commands = from_union( 1391 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("commands") 1392 ) 1393 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 1394 concurrency_group = from_union( 1395 [from_str, from_none], obj.get("concurrency_group") 1396 ) 1397 concurrency_method = from_union( 1398 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 1399 ) 1400 depends_on = from_union( 1401 [ 1402 from_none, 1403 lambda x: from_list( 1404 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 1405 ), 1406 from_str, 1407 ], 1408 obj.get("depends_on"), 1409 ) 1410 env = from_union( 1411 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 1412 ) 1413 id = from_union([from_str, from_none], obj.get("id")) 1414 identifier = from_union([from_str, from_none], obj.get("identifier")) 1415 command_step_if = from_union([from_str, from_none], obj.get("if")) 1416 key = from_union([from_str, from_none], obj.get("key")) 1417 label = from_union([from_str, from_none], obj.get("label")) 1418 matrix = from_union( 1419 [ 1420 lambda x: from_list( 1421 lambda x: from_union([from_int, from_bool, from_str], x), x 1422 ), 1423 MatrixClass.from_dict, 1424 from_none, 1425 ], 1426 obj.get("matrix"), 1427 ) 1428 name = from_union([from_str, from_none], obj.get("name")) 1429 notify = from_union( 1430 [ 1431 lambda x: from_list( 1432 lambda x: from_union([NotifyClass.from_dict, NotifyEnum], x), x 1433 ), 1434 from_none, 1435 ], 1436 obj.get("notify"), 1437 ) 1438 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 1439 plugins = from_union( 1440 [ 1441 lambda x: from_list( 1442 lambda x: from_union( 1443 [lambda x: from_dict(lambda x: x, x), from_str], x 1444 ), 1445 x, 1446 ), 1447 lambda x: from_dict(lambda x: x, x), 1448 from_none, 1449 ], 1450 obj.get("plugins"), 1451 ) 1452 priority = from_union([from_int, from_none], obj.get("priority")) 1453 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 1454 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 1455 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 1456 soft_fail = from_union( 1457 [ 1458 from_bool, 1459 lambda x: from_list(SoftFailElement.from_dict, x), 1460 AllowDependencyFailureEnum, 1461 from_none, 1462 ], 1463 obj.get("soft_fail"), 1464 ) 1465 timeout_in_minutes = from_union( 1466 [from_int, from_none], obj.get("timeout_in_minutes") 1467 ) 1468 type = from_union([CommandType, from_none], obj.get("type")) 1469 return CommandStep( 1470 agents, 1471 allow_dependency_failure, 1472 artifact_paths, 1473 branches, 1474 cache, 1475 cancel_on_build_failing, 1476 command, 1477 commands, 1478 concurrency, 1479 concurrency_group, 1480 concurrency_method, 1481 depends_on, 1482 env, 1483 id, 1484 identifier, 1485 command_step_if, 1486 key, 1487 label, 1488 matrix, 1489 name, 1490 notify, 1491 parallelism, 1492 plugins, 1493 priority, 1494 retry, 1495 signature, 1496 skip, 1497 soft_fail, 1498 timeout_in_minutes, 1499 type, 1500 )
1502 def to_dict(self) -> dict: 1503 result: dict = {} 1504 if self.agents is not None: 1505 result["agents"] = from_union( 1506 [ 1507 lambda x: from_dict(lambda x: x, x), 1508 lambda x: from_list(from_str, x), 1509 from_none, 1510 ], 1511 self.agents, 1512 ) 1513 if self.allow_dependency_failure is not None: 1514 result["allow_dependency_failure"] = from_union( 1515 [ 1516 from_bool, 1517 lambda x: to_enum(AllowDependencyFailureEnum, x), 1518 from_none, 1519 ], 1520 self.allow_dependency_failure, 1521 ) 1522 if self.artifact_paths is not None: 1523 result["artifact_paths"] = from_union( 1524 [lambda x: from_list(from_str, x), from_str, from_none], 1525 self.artifact_paths, 1526 ) 1527 if self.branches is not None: 1528 result["branches"] = from_union( 1529 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 1530 ) 1531 if self.cache is not None: 1532 result["cache"] = from_union( 1533 [ 1534 lambda x: from_list(from_str, x), 1535 lambda x: to_class(CacheClass, x), 1536 from_str, 1537 from_none, 1538 ], 1539 self.cache, 1540 ) 1541 if self.cancel_on_build_failing is not None: 1542 result["cancel_on_build_failing"] = from_union( 1543 [ 1544 from_bool, 1545 lambda x: to_enum(AllowDependencyFailureEnum, x), 1546 from_none, 1547 ], 1548 self.cancel_on_build_failing, 1549 ) 1550 if self.command is not None: 1551 result["command"] = from_union( 1552 [lambda x: from_list(from_str, x), from_str, from_none], self.command 1553 ) 1554 if self.commands is not None: 1555 result["commands"] = from_union( 1556 [lambda x: from_list(from_str, x), from_str, from_none], self.commands 1557 ) 1558 if self.concurrency is not None: 1559 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 1560 if self.concurrency_group is not None: 1561 result["concurrency_group"] = from_union( 1562 [from_str, from_none], self.concurrency_group 1563 ) 1564 if self.concurrency_method is not None: 1565 result["concurrency_method"] = from_union( 1566 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 1567 self.concurrency_method, 1568 ) 1569 if self.depends_on is not None: 1570 result["depends_on"] = from_union( 1571 [ 1572 from_none, 1573 lambda x: from_list( 1574 lambda x: from_union( 1575 [lambda x: to_class(DependsOnClass, x), from_str], x 1576 ), 1577 x, 1578 ), 1579 from_str, 1580 ], 1581 self.depends_on, 1582 ) 1583 if self.env is not None: 1584 result["env"] = from_union( 1585 [lambda x: from_dict(lambda x: x, x), from_none], self.env 1586 ) 1587 if self.id is not None: 1588 result["id"] = from_union([from_str, from_none], self.id) 1589 if self.identifier is not None: 1590 result["identifier"] = from_union([from_str, from_none], self.identifier) 1591 if self.command_step_if is not None: 1592 result["if"] = from_union([from_str, from_none], self.command_step_if) 1593 if self.key is not None: 1594 result["key"] = from_union([from_str, from_none], self.key) 1595 if self.label is not None: 1596 result["label"] = from_union([from_str, from_none], self.label) 1597 if self.matrix is not None: 1598 result["matrix"] = from_union( 1599 [ 1600 lambda x: from_list( 1601 lambda x: from_union([from_int, from_bool, from_str], x), x 1602 ), 1603 lambda x: to_class(MatrixClass, x), 1604 from_none, 1605 ], 1606 self.matrix, 1607 ) 1608 if self.name is not None: 1609 result["name"] = from_union([from_str, from_none], self.name) 1610 if self.notify is not None: 1611 result["notify"] = from_union( 1612 [ 1613 lambda x: from_list( 1614 lambda x: from_union( 1615 [ 1616 lambda x: to_class(NotifyClass, x), 1617 lambda x: to_enum(NotifyEnum, x), 1618 ], 1619 x, 1620 ), 1621 x, 1622 ), 1623 from_none, 1624 ], 1625 self.notify, 1626 ) 1627 if self.parallelism is not None: 1628 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 1629 if self.plugins is not None: 1630 result["plugins"] = from_union( 1631 [ 1632 lambda x: from_list( 1633 lambda x: from_union( 1634 [lambda x: from_dict(lambda x: x, x), from_str], x 1635 ), 1636 x, 1637 ), 1638 lambda x: from_dict(lambda x: x, x), 1639 from_none, 1640 ], 1641 self.plugins, 1642 ) 1643 if self.priority is not None: 1644 result["priority"] = from_union([from_int, from_none], self.priority) 1645 if self.retry is not None: 1646 result["retry"] = from_union( 1647 [lambda x: to_class(Retry, x), from_none], self.retry 1648 ) 1649 if self.signature is not None: 1650 result["signature"] = from_union( 1651 [lambda x: to_class(Signature, x), from_none], self.signature 1652 ) 1653 if self.skip is not None: 1654 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 1655 if self.soft_fail is not None: 1656 result["soft_fail"] = from_union( 1657 [ 1658 from_bool, 1659 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 1660 lambda x: to_enum(AllowDependencyFailureEnum, x), 1661 from_none, 1662 ], 1663 self.soft_fail, 1664 ) 1665 if self.timeout_in_minutes is not None: 1666 result["timeout_in_minutes"] = from_union( 1667 [from_int, from_none], self.timeout_in_minutes 1668 ) 1669 if self.type is not None: 1670 result["type"] = from_union( 1671 [lambda x: to_enum(CommandType, x), from_none], self.type 1672 ) 1673 return result
1680class InputStep: 1681 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 1682 branches: Optional[Union[List[str], str]] 1683 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 1684 fields: Optional[List[Field]] 1685 id: Optional[str] 1686 identifier: Optional[str] 1687 input_step_if: Optional[str] 1688 input: Optional[str] 1689 """The label of the input step""" 1690 1691 key: Optional[str] 1692 label: Optional[str] 1693 name: Optional[str] 1694 prompt: Optional[str] 1695 type: Optional[InputType] 1696 1697 def __init__( 1698 self, 1699 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 1700 branches: Optional[Union[List[str], str]], 1701 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 1702 fields: Optional[List[Field]], 1703 id: Optional[str], 1704 identifier: Optional[str], 1705 input_step_if: Optional[str], 1706 input: Optional[str], 1707 key: Optional[str], 1708 label: Optional[str], 1709 name: Optional[str], 1710 prompt: Optional[str], 1711 type: Optional[InputType], 1712 ) -> None: 1713 self.allow_dependency_failure = allow_dependency_failure 1714 self.branches = branches 1715 self.depends_on = depends_on 1716 self.fields = fields 1717 self.id = id 1718 self.identifier = identifier 1719 self.input_step_if = input_step_if 1720 self.input = input 1721 self.key = key 1722 self.label = label 1723 self.name = name 1724 self.prompt = prompt 1725 self.type = type 1726 1727 @staticmethod 1728 def from_dict(obj: Any) -> "InputStep": 1729 assert isinstance(obj, dict) 1730 allow_dependency_failure = from_union( 1731 [from_bool, AllowDependencyFailureEnum, from_none], 1732 obj.get("allow_dependency_failure"), 1733 ) 1734 branches = from_union( 1735 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 1736 ) 1737 depends_on = from_union( 1738 [ 1739 from_none, 1740 lambda x: from_list( 1741 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 1742 ), 1743 from_str, 1744 ], 1745 obj.get("depends_on"), 1746 ) 1747 fields = from_union( 1748 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 1749 ) 1750 id = from_union([from_str, from_none], obj.get("id")) 1751 identifier = from_union([from_str, from_none], obj.get("identifier")) 1752 input_step_if = from_union([from_str, from_none], obj.get("if")) 1753 input = from_union([from_str, from_none], obj.get("input")) 1754 key = from_union([from_str, from_none], obj.get("key")) 1755 label = from_union([from_str, from_none], obj.get("label")) 1756 name = from_union([from_str, from_none], obj.get("name")) 1757 prompt = from_union([from_str, from_none], obj.get("prompt")) 1758 type = from_union([InputType, from_none], obj.get("type")) 1759 return InputStep( 1760 allow_dependency_failure, 1761 branches, 1762 depends_on, 1763 fields, 1764 id, 1765 identifier, 1766 input_step_if, 1767 input, 1768 key, 1769 label, 1770 name, 1771 prompt, 1772 type, 1773 ) 1774 1775 def to_dict(self) -> dict: 1776 result: dict = {} 1777 if self.allow_dependency_failure is not None: 1778 result["allow_dependency_failure"] = from_union( 1779 [ 1780 from_bool, 1781 lambda x: to_enum(AllowDependencyFailureEnum, x), 1782 from_none, 1783 ], 1784 self.allow_dependency_failure, 1785 ) 1786 if self.branches is not None: 1787 result["branches"] = from_union( 1788 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 1789 ) 1790 if self.depends_on is not None: 1791 result["depends_on"] = from_union( 1792 [ 1793 from_none, 1794 lambda x: from_list( 1795 lambda x: from_union( 1796 [lambda x: to_class(DependsOnClass, x), from_str], x 1797 ), 1798 x, 1799 ), 1800 from_str, 1801 ], 1802 self.depends_on, 1803 ) 1804 if self.fields is not None: 1805 result["fields"] = from_union( 1806 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 1807 self.fields, 1808 ) 1809 if self.id is not None: 1810 result["id"] = from_union([from_str, from_none], self.id) 1811 if self.identifier is not None: 1812 result["identifier"] = from_union([from_str, from_none], self.identifier) 1813 if self.input_step_if is not None: 1814 result["if"] = from_union([from_str, from_none], self.input_step_if) 1815 if self.input is not None: 1816 result["input"] = from_union([from_str, from_none], self.input) 1817 if self.key is not None: 1818 result["key"] = from_union([from_str, from_none], self.key) 1819 if self.label is not None: 1820 result["label"] = from_union([from_str, from_none], self.label) 1821 if self.name is not None: 1822 result["name"] = from_union([from_str, from_none], self.name) 1823 if self.prompt is not None: 1824 result["prompt"] = from_union([from_str, from_none], self.prompt) 1825 if self.type is not None: 1826 result["type"] = from_union( 1827 [lambda x: to_enum(InputType, x), from_none], self.type 1828 ) 1829 return result
1697 def __init__( 1698 self, 1699 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 1700 branches: Optional[Union[List[str], str]], 1701 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 1702 fields: Optional[List[Field]], 1703 id: Optional[str], 1704 identifier: Optional[str], 1705 input_step_if: Optional[str], 1706 input: Optional[str], 1707 key: Optional[str], 1708 label: Optional[str], 1709 name: Optional[str], 1710 prompt: Optional[str], 1711 type: Optional[InputType], 1712 ) -> None: 1713 self.allow_dependency_failure = allow_dependency_failure 1714 self.branches = branches 1715 self.depends_on = depends_on 1716 self.fields = fields 1717 self.id = id 1718 self.identifier = identifier 1719 self.input_step_if = input_step_if 1720 self.input = input 1721 self.key = key 1722 self.label = label 1723 self.name = name 1724 self.prompt = prompt 1725 self.type = type
1727 @staticmethod 1728 def from_dict(obj: Any) -> "InputStep": 1729 assert isinstance(obj, dict) 1730 allow_dependency_failure = from_union( 1731 [from_bool, AllowDependencyFailureEnum, from_none], 1732 obj.get("allow_dependency_failure"), 1733 ) 1734 branches = from_union( 1735 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 1736 ) 1737 depends_on = from_union( 1738 [ 1739 from_none, 1740 lambda x: from_list( 1741 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 1742 ), 1743 from_str, 1744 ], 1745 obj.get("depends_on"), 1746 ) 1747 fields = from_union( 1748 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 1749 ) 1750 id = from_union([from_str, from_none], obj.get("id")) 1751 identifier = from_union([from_str, from_none], obj.get("identifier")) 1752 input_step_if = from_union([from_str, from_none], obj.get("if")) 1753 input = from_union([from_str, from_none], obj.get("input")) 1754 key = from_union([from_str, from_none], obj.get("key")) 1755 label = from_union([from_str, from_none], obj.get("label")) 1756 name = from_union([from_str, from_none], obj.get("name")) 1757 prompt = from_union([from_str, from_none], obj.get("prompt")) 1758 type = from_union([InputType, from_none], obj.get("type")) 1759 return InputStep( 1760 allow_dependency_failure, 1761 branches, 1762 depends_on, 1763 fields, 1764 id, 1765 identifier, 1766 input_step_if, 1767 input, 1768 key, 1769 label, 1770 name, 1771 prompt, 1772 type, 1773 )
1775 def to_dict(self) -> dict: 1776 result: dict = {} 1777 if self.allow_dependency_failure is not None: 1778 result["allow_dependency_failure"] = from_union( 1779 [ 1780 from_bool, 1781 lambda x: to_enum(AllowDependencyFailureEnum, x), 1782 from_none, 1783 ], 1784 self.allow_dependency_failure, 1785 ) 1786 if self.branches is not None: 1787 result["branches"] = from_union( 1788 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 1789 ) 1790 if self.depends_on is not None: 1791 result["depends_on"] = from_union( 1792 [ 1793 from_none, 1794 lambda x: from_list( 1795 lambda x: from_union( 1796 [lambda x: to_class(DependsOnClass, x), from_str], x 1797 ), 1798 x, 1799 ), 1800 from_str, 1801 ], 1802 self.depends_on, 1803 ) 1804 if self.fields is not None: 1805 result["fields"] = from_union( 1806 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 1807 self.fields, 1808 ) 1809 if self.id is not None: 1810 result["id"] = from_union([from_str, from_none], self.id) 1811 if self.identifier is not None: 1812 result["identifier"] = from_union([from_str, from_none], self.identifier) 1813 if self.input_step_if is not None: 1814 result["if"] = from_union([from_str, from_none], self.input_step_if) 1815 if self.input is not None: 1816 result["input"] = from_union([from_str, from_none], self.input) 1817 if self.key is not None: 1818 result["key"] = from_union([from_str, from_none], self.key) 1819 if self.label is not None: 1820 result["label"] = from_union([from_str, from_none], self.label) 1821 if self.name is not None: 1822 result["name"] = from_union([from_str, from_none], self.name) 1823 if self.prompt is not None: 1824 result["prompt"] = from_union([from_str, from_none], self.prompt) 1825 if self.type is not None: 1826 result["type"] = from_union( 1827 [lambda x: to_enum(InputType, x), from_none], self.type 1828 ) 1829 return result
1832class TentacledGithubCommitStatus: 1833 context: Optional[str] 1834 """GitHub commit status name""" 1835 1836 def __init__(self, context: Optional[str]) -> None: 1837 self.context = context 1838 1839 @staticmethod 1840 def from_dict(obj: Any) -> "TentacledGithubCommitStatus": 1841 assert isinstance(obj, dict) 1842 context = from_union([from_str, from_none], obj.get("context")) 1843 return TentacledGithubCommitStatus(context) 1844 1845 def to_dict(self) -> dict: 1846 result: dict = {} 1847 if self.context is not None: 1848 result["context"] = from_union([from_str, from_none], self.context) 1849 return result
1852class TentacledSlack: 1853 channels: Optional[List[str]] 1854 message: Optional[str] 1855 1856 def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None: 1857 self.channels = channels 1858 self.message = message 1859 1860 @staticmethod 1861 def from_dict(obj: Any) -> "TentacledSlack": 1862 assert isinstance(obj, dict) 1863 channels = from_union( 1864 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 1865 ) 1866 message = from_union([from_str, from_none], obj.get("message")) 1867 return TentacledSlack(channels, message) 1868 1869 def to_dict(self) -> dict: 1870 result: dict = {} 1871 if self.channels is not None: 1872 result["channels"] = from_union( 1873 [lambda x: from_list(from_str, x), from_none], self.channels 1874 ) 1875 if self.message is not None: 1876 result["message"] = from_union([from_str, from_none], self.message) 1877 return result
1860 @staticmethod 1861 def from_dict(obj: Any) -> "TentacledSlack": 1862 assert isinstance(obj, dict) 1863 channels = from_union( 1864 [lambda x: from_list(from_str, x), from_none], obj.get("channels") 1865 ) 1866 message = from_union([from_str, from_none], obj.get("message")) 1867 return TentacledSlack(channels, message)
1869 def to_dict(self) -> dict: 1870 result: dict = {} 1871 if self.channels is not None: 1872 result["channels"] = from_union( 1873 [lambda x: from_list(from_str, x), from_none], self.channels 1874 ) 1875 if self.message is not None: 1876 result["message"] = from_union([from_str, from_none], self.message) 1877 return result
1880class FluffyBuildNotify: 1881 basecamp_campfire: Optional[str] 1882 build_notify_if: Optional[str] 1883 slack: Optional[Union[TentacledSlack, str]] 1884 github_commit_status: Optional[TentacledGithubCommitStatus] 1885 github_check: Optional[Dict[str, Any]] 1886 email: Optional[str] 1887 webhook: Optional[str] 1888 pagerduty_change_event: Optional[str] 1889 1890 def __init__( 1891 self, 1892 basecamp_campfire: Optional[str], 1893 build_notify_if: Optional[str], 1894 slack: Optional[Union[TentacledSlack, str]], 1895 github_commit_status: Optional[TentacledGithubCommitStatus], 1896 github_check: Optional[Dict[str, Any]], 1897 email: Optional[str], 1898 webhook: Optional[str], 1899 pagerduty_change_event: Optional[str], 1900 ) -> None: 1901 self.basecamp_campfire = basecamp_campfire 1902 self.build_notify_if = build_notify_if 1903 self.slack = slack 1904 self.github_commit_status = github_commit_status 1905 self.github_check = github_check 1906 self.email = email 1907 self.webhook = webhook 1908 self.pagerduty_change_event = pagerduty_change_event 1909 1910 @staticmethod 1911 def from_dict(obj: Any) -> "FluffyBuildNotify": 1912 assert isinstance(obj, dict) 1913 basecamp_campfire = from_union( 1914 [from_str, from_none], obj.get("basecamp_campfire") 1915 ) 1916 build_notify_if = from_union([from_str, from_none], obj.get("if")) 1917 slack = from_union( 1918 [TentacledSlack.from_dict, from_str, from_none], obj.get("slack") 1919 ) 1920 github_commit_status = from_union( 1921 [TentacledGithubCommitStatus.from_dict, from_none], 1922 obj.get("github_commit_status"), 1923 ) 1924 github_check = from_union( 1925 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 1926 ) 1927 email = from_union([from_str, from_none], obj.get("email")) 1928 webhook = from_union([from_str, from_none], obj.get("webhook")) 1929 pagerduty_change_event = from_union( 1930 [from_str, from_none], obj.get("pagerduty_change_event") 1931 ) 1932 return FluffyBuildNotify( 1933 basecamp_campfire, 1934 build_notify_if, 1935 slack, 1936 github_commit_status, 1937 github_check, 1938 email, 1939 webhook, 1940 pagerduty_change_event, 1941 ) 1942 1943 def to_dict(self) -> dict: 1944 result: dict = {} 1945 if self.basecamp_campfire is not None: 1946 result["basecamp_campfire"] = from_union( 1947 [from_str, from_none], self.basecamp_campfire 1948 ) 1949 if self.build_notify_if is not None: 1950 result["if"] = from_union([from_str, from_none], self.build_notify_if) 1951 if self.slack is not None: 1952 result["slack"] = from_union( 1953 [lambda x: to_class(TentacledSlack, x), from_str, from_none], self.slack 1954 ) 1955 if self.github_commit_status is not None: 1956 result["github_commit_status"] = from_union( 1957 [lambda x: to_class(TentacledGithubCommitStatus, x), from_none], 1958 self.github_commit_status, 1959 ) 1960 if self.github_check is not None: 1961 result["github_check"] = from_union( 1962 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 1963 ) 1964 if self.email is not None: 1965 result["email"] = from_union([from_str, from_none], self.email) 1966 if self.webhook is not None: 1967 result["webhook"] = from_union([from_str, from_none], self.webhook) 1968 if self.pagerduty_change_event is not None: 1969 result["pagerduty_change_event"] = from_union( 1970 [from_str, from_none], self.pagerduty_change_event 1971 ) 1972 return result
1890 def __init__( 1891 self, 1892 basecamp_campfire: Optional[str], 1893 build_notify_if: Optional[str], 1894 slack: Optional[Union[TentacledSlack, str]], 1895 github_commit_status: Optional[TentacledGithubCommitStatus], 1896 github_check: Optional[Dict[str, Any]], 1897 email: Optional[str], 1898 webhook: Optional[str], 1899 pagerduty_change_event: Optional[str], 1900 ) -> None: 1901 self.basecamp_campfire = basecamp_campfire 1902 self.build_notify_if = build_notify_if 1903 self.slack = slack 1904 self.github_commit_status = github_commit_status 1905 self.github_check = github_check 1906 self.email = email 1907 self.webhook = webhook 1908 self.pagerduty_change_event = pagerduty_change_event
1910 @staticmethod 1911 def from_dict(obj: Any) -> "FluffyBuildNotify": 1912 assert isinstance(obj, dict) 1913 basecamp_campfire = from_union( 1914 [from_str, from_none], obj.get("basecamp_campfire") 1915 ) 1916 build_notify_if = from_union([from_str, from_none], obj.get("if")) 1917 slack = from_union( 1918 [TentacledSlack.from_dict, from_str, from_none], obj.get("slack") 1919 ) 1920 github_commit_status = from_union( 1921 [TentacledGithubCommitStatus.from_dict, from_none], 1922 obj.get("github_commit_status"), 1923 ) 1924 github_check = from_union( 1925 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("github_check") 1926 ) 1927 email = from_union([from_str, from_none], obj.get("email")) 1928 webhook = from_union([from_str, from_none], obj.get("webhook")) 1929 pagerduty_change_event = from_union( 1930 [from_str, from_none], obj.get("pagerduty_change_event") 1931 ) 1932 return FluffyBuildNotify( 1933 basecamp_campfire, 1934 build_notify_if, 1935 slack, 1936 github_commit_status, 1937 github_check, 1938 email, 1939 webhook, 1940 pagerduty_change_event, 1941 )
1943 def to_dict(self) -> dict: 1944 result: dict = {} 1945 if self.basecamp_campfire is not None: 1946 result["basecamp_campfire"] = from_union( 1947 [from_str, from_none], self.basecamp_campfire 1948 ) 1949 if self.build_notify_if is not None: 1950 result["if"] = from_union([from_str, from_none], self.build_notify_if) 1951 if self.slack is not None: 1952 result["slack"] = from_union( 1953 [lambda x: to_class(TentacledSlack, x), from_str, from_none], self.slack 1954 ) 1955 if self.github_commit_status is not None: 1956 result["github_commit_status"] = from_union( 1957 [lambda x: to_class(TentacledGithubCommitStatus, x), from_none], 1958 self.github_commit_status, 1959 ) 1960 if self.github_check is not None: 1961 result["github_check"] = from_union( 1962 [lambda x: from_dict(lambda x: x, x), from_none], self.github_check 1963 ) 1964 if self.email is not None: 1965 result["email"] = from_union([from_str, from_none], self.email) 1966 if self.webhook is not None: 1967 result["webhook"] = from_union([from_str, from_none], self.webhook) 1968 if self.pagerduty_change_event is not None: 1969 result["pagerduty_change_event"] = from_union( 1970 [from_str, from_none], self.pagerduty_change_event 1971 ) 1972 return result
1979class TriggerStep: 1980 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 1981 trigger_step_async: Optional[Union[bool, AllowDependencyFailureEnum]] 1982 """Whether to continue the build without waiting for the triggered step to complete""" 1983 1984 branches: Optional[Union[List[str], str]] 1985 build: Optional[Build] 1986 """Properties of the build that will be created when the step is triggered""" 1987 1988 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 1989 id: Optional[str] 1990 identifier: Optional[str] 1991 trigger_step_if: Optional[str] 1992 key: Optional[str] 1993 label: Optional[str] 1994 name: Optional[str] 1995 skip: Optional[Union[bool, str]] 1996 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 1997 trigger: str 1998 """The slug of the pipeline to create a build""" 1999 2000 type: Optional[TriggerType] 2001 2002 def __init__( 2003 self, 2004 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2005 trigger_step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 2006 branches: Optional[Union[List[str], str]], 2007 build: Optional[Build], 2008 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2009 id: Optional[str], 2010 identifier: Optional[str], 2011 trigger_step_if: Optional[str], 2012 key: Optional[str], 2013 label: Optional[str], 2014 name: Optional[str], 2015 skip: Optional[Union[bool, str]], 2016 soft_fail: Optional[ 2017 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 2018 ], 2019 trigger: str, 2020 type: Optional[TriggerType], 2021 ) -> None: 2022 self.allow_dependency_failure = allow_dependency_failure 2023 self.trigger_step_async = trigger_step_async 2024 self.branches = branches 2025 self.build = build 2026 self.depends_on = depends_on 2027 self.id = id 2028 self.identifier = identifier 2029 self.trigger_step_if = trigger_step_if 2030 self.key = key 2031 self.label = label 2032 self.name = name 2033 self.skip = skip 2034 self.soft_fail = soft_fail 2035 self.trigger = trigger 2036 self.type = type 2037 2038 @staticmethod 2039 def from_dict(obj: Any) -> "TriggerStep": 2040 assert isinstance(obj, dict) 2041 allow_dependency_failure = from_union( 2042 [from_bool, AllowDependencyFailureEnum, from_none], 2043 obj.get("allow_dependency_failure"), 2044 ) 2045 trigger_step_async = from_union( 2046 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 2047 ) 2048 branches = from_union( 2049 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2050 ) 2051 build = from_union([Build.from_dict, from_none], obj.get("build")) 2052 depends_on = from_union( 2053 [ 2054 from_none, 2055 lambda x: from_list( 2056 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2057 ), 2058 from_str, 2059 ], 2060 obj.get("depends_on"), 2061 ) 2062 id = from_union([from_str, from_none], obj.get("id")) 2063 identifier = from_union([from_str, from_none], obj.get("identifier")) 2064 trigger_step_if = from_union([from_str, from_none], obj.get("if")) 2065 key = from_union([from_str, from_none], obj.get("key")) 2066 label = from_union([from_str, from_none], obj.get("label")) 2067 name = from_union([from_str, from_none], obj.get("name")) 2068 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 2069 soft_fail = from_union( 2070 [ 2071 from_bool, 2072 lambda x: from_list(SoftFailElement.from_dict, x), 2073 AllowDependencyFailureEnum, 2074 from_none, 2075 ], 2076 obj.get("soft_fail"), 2077 ) 2078 trigger = from_str(obj.get("trigger")) 2079 type = from_union([TriggerType, from_none], obj.get("type")) 2080 return TriggerStep( 2081 allow_dependency_failure, 2082 trigger_step_async, 2083 branches, 2084 build, 2085 depends_on, 2086 id, 2087 identifier, 2088 trigger_step_if, 2089 key, 2090 label, 2091 name, 2092 skip, 2093 soft_fail, 2094 trigger, 2095 type, 2096 ) 2097 2098 def to_dict(self) -> dict: 2099 result: dict = {} 2100 if self.allow_dependency_failure is not None: 2101 result["allow_dependency_failure"] = from_union( 2102 [ 2103 from_bool, 2104 lambda x: to_enum(AllowDependencyFailureEnum, x), 2105 from_none, 2106 ], 2107 self.allow_dependency_failure, 2108 ) 2109 if self.trigger_step_async is not None: 2110 result["async"] = from_union( 2111 [ 2112 from_bool, 2113 lambda x: to_enum(AllowDependencyFailureEnum, x), 2114 from_none, 2115 ], 2116 self.trigger_step_async, 2117 ) 2118 if self.branches is not None: 2119 result["branches"] = from_union( 2120 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2121 ) 2122 if self.build is not None: 2123 result["build"] = from_union( 2124 [lambda x: to_class(Build, x), from_none], self.build 2125 ) 2126 if self.depends_on is not None: 2127 result["depends_on"] = from_union( 2128 [ 2129 from_none, 2130 lambda x: from_list( 2131 lambda x: from_union( 2132 [lambda x: to_class(DependsOnClass, x), from_str], x 2133 ), 2134 x, 2135 ), 2136 from_str, 2137 ], 2138 self.depends_on, 2139 ) 2140 if self.id is not None: 2141 result["id"] = from_union([from_str, from_none], self.id) 2142 if self.identifier is not None: 2143 result["identifier"] = from_union([from_str, from_none], self.identifier) 2144 if self.trigger_step_if is not None: 2145 result["if"] = from_union([from_str, from_none], self.trigger_step_if) 2146 if self.key is not None: 2147 result["key"] = from_union([from_str, from_none], self.key) 2148 if self.label is not None: 2149 result["label"] = from_union([from_str, from_none], self.label) 2150 if self.name is not None: 2151 result["name"] = from_union([from_str, from_none], self.name) 2152 if self.skip is not None: 2153 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 2154 if self.soft_fail is not None: 2155 result["soft_fail"] = from_union( 2156 [ 2157 from_bool, 2158 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 2159 lambda x: to_enum(AllowDependencyFailureEnum, x), 2160 from_none, 2161 ], 2162 self.soft_fail, 2163 ) 2164 result["trigger"] = from_str(self.trigger) 2165 if self.type is not None: 2166 result["type"] = from_union( 2167 [lambda x: to_enum(TriggerType, x), from_none], self.type 2168 ) 2169 return result
2002 def __init__( 2003 self, 2004 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2005 trigger_step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 2006 branches: Optional[Union[List[str], str]], 2007 build: Optional[Build], 2008 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2009 id: Optional[str], 2010 identifier: Optional[str], 2011 trigger_step_if: Optional[str], 2012 key: Optional[str], 2013 label: Optional[str], 2014 name: Optional[str], 2015 skip: Optional[Union[bool, str]], 2016 soft_fail: Optional[ 2017 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 2018 ], 2019 trigger: str, 2020 type: Optional[TriggerType], 2021 ) -> None: 2022 self.allow_dependency_failure = allow_dependency_failure 2023 self.trigger_step_async = trigger_step_async 2024 self.branches = branches 2025 self.build = build 2026 self.depends_on = depends_on 2027 self.id = id 2028 self.identifier = identifier 2029 self.trigger_step_if = trigger_step_if 2030 self.key = key 2031 self.label = label 2032 self.name = name 2033 self.skip = skip 2034 self.soft_fail = soft_fail 2035 self.trigger = trigger 2036 self.type = type
Whether to continue the build without waiting for the triggered step to complete
2038 @staticmethod 2039 def from_dict(obj: Any) -> "TriggerStep": 2040 assert isinstance(obj, dict) 2041 allow_dependency_failure = from_union( 2042 [from_bool, AllowDependencyFailureEnum, from_none], 2043 obj.get("allow_dependency_failure"), 2044 ) 2045 trigger_step_async = from_union( 2046 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 2047 ) 2048 branches = from_union( 2049 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2050 ) 2051 build = from_union([Build.from_dict, from_none], obj.get("build")) 2052 depends_on = from_union( 2053 [ 2054 from_none, 2055 lambda x: from_list( 2056 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2057 ), 2058 from_str, 2059 ], 2060 obj.get("depends_on"), 2061 ) 2062 id = from_union([from_str, from_none], obj.get("id")) 2063 identifier = from_union([from_str, from_none], obj.get("identifier")) 2064 trigger_step_if = from_union([from_str, from_none], obj.get("if")) 2065 key = from_union([from_str, from_none], obj.get("key")) 2066 label = from_union([from_str, from_none], obj.get("label")) 2067 name = from_union([from_str, from_none], obj.get("name")) 2068 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 2069 soft_fail = from_union( 2070 [ 2071 from_bool, 2072 lambda x: from_list(SoftFailElement.from_dict, x), 2073 AllowDependencyFailureEnum, 2074 from_none, 2075 ], 2076 obj.get("soft_fail"), 2077 ) 2078 trigger = from_str(obj.get("trigger")) 2079 type = from_union([TriggerType, from_none], obj.get("type")) 2080 return TriggerStep( 2081 allow_dependency_failure, 2082 trigger_step_async, 2083 branches, 2084 build, 2085 depends_on, 2086 id, 2087 identifier, 2088 trigger_step_if, 2089 key, 2090 label, 2091 name, 2092 skip, 2093 soft_fail, 2094 trigger, 2095 type, 2096 )
2098 def to_dict(self) -> dict: 2099 result: dict = {} 2100 if self.allow_dependency_failure is not None: 2101 result["allow_dependency_failure"] = from_union( 2102 [ 2103 from_bool, 2104 lambda x: to_enum(AllowDependencyFailureEnum, x), 2105 from_none, 2106 ], 2107 self.allow_dependency_failure, 2108 ) 2109 if self.trigger_step_async is not None: 2110 result["async"] = from_union( 2111 [ 2112 from_bool, 2113 lambda x: to_enum(AllowDependencyFailureEnum, x), 2114 from_none, 2115 ], 2116 self.trigger_step_async, 2117 ) 2118 if self.branches is not None: 2119 result["branches"] = from_union( 2120 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2121 ) 2122 if self.build is not None: 2123 result["build"] = from_union( 2124 [lambda x: to_class(Build, x), from_none], self.build 2125 ) 2126 if self.depends_on is not None: 2127 result["depends_on"] = from_union( 2128 [ 2129 from_none, 2130 lambda x: from_list( 2131 lambda x: from_union( 2132 [lambda x: to_class(DependsOnClass, x), from_str], x 2133 ), 2134 x, 2135 ), 2136 from_str, 2137 ], 2138 self.depends_on, 2139 ) 2140 if self.id is not None: 2141 result["id"] = from_union([from_str, from_none], self.id) 2142 if self.identifier is not None: 2143 result["identifier"] = from_union([from_str, from_none], self.identifier) 2144 if self.trigger_step_if is not None: 2145 result["if"] = from_union([from_str, from_none], self.trigger_step_if) 2146 if self.key is not None: 2147 result["key"] = from_union([from_str, from_none], self.key) 2148 if self.label is not None: 2149 result["label"] = from_union([from_str, from_none], self.label) 2150 if self.name is not None: 2151 result["name"] = from_union([from_str, from_none], self.name) 2152 if self.skip is not None: 2153 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 2154 if self.soft_fail is not None: 2155 result["soft_fail"] = from_union( 2156 [ 2157 from_bool, 2158 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 2159 lambda x: to_enum(AllowDependencyFailureEnum, x), 2160 from_none, 2161 ], 2162 self.soft_fail, 2163 ) 2164 result["trigger"] = from_str(self.trigger) 2165 if self.type is not None: 2166 result["type"] = from_union( 2167 [lambda x: to_enum(TriggerType, x), from_none], self.type 2168 ) 2169 return result
2172class BlockStepType(Enum): 2173 BLOCK = "block" 2174 COMMAND = "command" 2175 COMMANDS = "commands" 2176 INPUT = "input" 2177 SCRIPT = "script" 2178 TRIGGER = "trigger" 2179 WAIT = "wait" 2180 WAITER = "waiter"
2188class WaitStep: 2189 """Waits for previous steps to pass before continuing""" 2190 2191 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2192 branches: Optional[Union[List[str], str]] 2193 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2194 """Continue to the next steps, even if the previous group of steps fail""" 2195 2196 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 2197 id: Optional[str] 2198 identifier: Optional[str] 2199 wait_step_if: Optional[str] 2200 key: Optional[str] 2201 label: Optional[str] 2202 name: Optional[str] 2203 type: Optional[WaitType] 2204 wait: Optional[str] 2205 """Waits for previous steps to pass before continuing""" 2206 2207 def __init__( 2208 self, 2209 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2210 branches: Optional[Union[List[str], str]], 2211 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2212 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2213 id: Optional[str], 2214 identifier: Optional[str], 2215 wait_step_if: Optional[str], 2216 key: Optional[str], 2217 label: Optional[str], 2218 name: Optional[str], 2219 type: Optional[WaitType], 2220 wait: Optional[str], 2221 ) -> None: 2222 self.allow_dependency_failure = allow_dependency_failure 2223 self.branches = branches 2224 self.continue_on_failure = continue_on_failure 2225 self.depends_on = depends_on 2226 self.id = id 2227 self.identifier = identifier 2228 self.wait_step_if = wait_step_if 2229 self.key = key 2230 self.label = label 2231 self.name = name 2232 self.type = type 2233 self.wait = wait 2234 2235 @staticmethod 2236 def from_dict(obj: Any) -> "WaitStep": 2237 assert isinstance(obj, dict) 2238 allow_dependency_failure = from_union( 2239 [from_bool, AllowDependencyFailureEnum, from_none], 2240 obj.get("allow_dependency_failure"), 2241 ) 2242 branches = from_union( 2243 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2244 ) 2245 continue_on_failure = from_union( 2246 [from_bool, AllowDependencyFailureEnum, from_none], 2247 obj.get("continue_on_failure"), 2248 ) 2249 depends_on = from_union( 2250 [ 2251 from_none, 2252 lambda x: from_list( 2253 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2254 ), 2255 from_str, 2256 ], 2257 obj.get("depends_on"), 2258 ) 2259 id = from_union([from_str, from_none], obj.get("id")) 2260 identifier = from_union([from_str, from_none], obj.get("identifier")) 2261 wait_step_if = from_union([from_str, from_none], obj.get("if")) 2262 key = from_union([from_str, from_none], obj.get("key")) 2263 label = from_union([from_none, from_str], obj.get("label")) 2264 name = from_union([from_none, from_str], obj.get("name")) 2265 type = from_union([WaitType, from_none], obj.get("type")) 2266 wait = from_union([from_none, from_str], obj.get("wait")) 2267 return WaitStep( 2268 allow_dependency_failure, 2269 branches, 2270 continue_on_failure, 2271 depends_on, 2272 id, 2273 identifier, 2274 wait_step_if, 2275 key, 2276 label, 2277 name, 2278 type, 2279 wait, 2280 ) 2281 2282 def to_dict(self) -> dict: 2283 result: dict = {} 2284 if self.allow_dependency_failure is not None: 2285 result["allow_dependency_failure"] = from_union( 2286 [ 2287 from_bool, 2288 lambda x: to_enum(AllowDependencyFailureEnum, x), 2289 from_none, 2290 ], 2291 self.allow_dependency_failure, 2292 ) 2293 if self.branches is not None: 2294 result["branches"] = from_union( 2295 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2296 ) 2297 if self.continue_on_failure is not None: 2298 result["continue_on_failure"] = from_union( 2299 [ 2300 from_bool, 2301 lambda x: to_enum(AllowDependencyFailureEnum, x), 2302 from_none, 2303 ], 2304 self.continue_on_failure, 2305 ) 2306 if self.depends_on is not None: 2307 result["depends_on"] = from_union( 2308 [ 2309 from_none, 2310 lambda x: from_list( 2311 lambda x: from_union( 2312 [lambda x: to_class(DependsOnClass, x), from_str], x 2313 ), 2314 x, 2315 ), 2316 from_str, 2317 ], 2318 self.depends_on, 2319 ) 2320 if self.id is not None: 2321 result["id"] = from_union([from_str, from_none], self.id) 2322 if self.identifier is not None: 2323 result["identifier"] = from_union([from_str, from_none], self.identifier) 2324 if self.wait_step_if is not None: 2325 result["if"] = from_union([from_str, from_none], self.wait_step_if) 2326 if self.key is not None: 2327 result["key"] = from_union([from_str, from_none], self.key) 2328 if self.label is not None: 2329 result["label"] = from_union([from_none, from_str], self.label) 2330 if self.name is not None: 2331 result["name"] = from_union([from_none, from_str], self.name) 2332 if self.type is not None: 2333 result["type"] = from_union( 2334 [lambda x: to_enum(WaitType, x), from_none], self.type 2335 ) 2336 if self.wait is not None: 2337 result["wait"] = from_union([from_none, from_str], self.wait) 2338 return result
Waits for previous steps to pass before continuing
2207 def __init__( 2208 self, 2209 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2210 branches: Optional[Union[List[str], str]], 2211 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2212 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2213 id: Optional[str], 2214 identifier: Optional[str], 2215 wait_step_if: Optional[str], 2216 key: Optional[str], 2217 label: Optional[str], 2218 name: Optional[str], 2219 type: Optional[WaitType], 2220 wait: Optional[str], 2221 ) -> None: 2222 self.allow_dependency_failure = allow_dependency_failure 2223 self.branches = branches 2224 self.continue_on_failure = continue_on_failure 2225 self.depends_on = depends_on 2226 self.id = id 2227 self.identifier = identifier 2228 self.wait_step_if = wait_step_if 2229 self.key = key 2230 self.label = label 2231 self.name = name 2232 self.type = type 2233 self.wait = wait
Continue to the next steps, even if the previous group of steps fail
2235 @staticmethod 2236 def from_dict(obj: Any) -> "WaitStep": 2237 assert isinstance(obj, dict) 2238 allow_dependency_failure = from_union( 2239 [from_bool, AllowDependencyFailureEnum, from_none], 2240 obj.get("allow_dependency_failure"), 2241 ) 2242 branches = from_union( 2243 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2244 ) 2245 continue_on_failure = from_union( 2246 [from_bool, AllowDependencyFailureEnum, from_none], 2247 obj.get("continue_on_failure"), 2248 ) 2249 depends_on = from_union( 2250 [ 2251 from_none, 2252 lambda x: from_list( 2253 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2254 ), 2255 from_str, 2256 ], 2257 obj.get("depends_on"), 2258 ) 2259 id = from_union([from_str, from_none], obj.get("id")) 2260 identifier = from_union([from_str, from_none], obj.get("identifier")) 2261 wait_step_if = from_union([from_str, from_none], obj.get("if")) 2262 key = from_union([from_str, from_none], obj.get("key")) 2263 label = from_union([from_none, from_str], obj.get("label")) 2264 name = from_union([from_none, from_str], obj.get("name")) 2265 type = from_union([WaitType, from_none], obj.get("type")) 2266 wait = from_union([from_none, from_str], obj.get("wait")) 2267 return WaitStep( 2268 allow_dependency_failure, 2269 branches, 2270 continue_on_failure, 2271 depends_on, 2272 id, 2273 identifier, 2274 wait_step_if, 2275 key, 2276 label, 2277 name, 2278 type, 2279 wait, 2280 )
2282 def to_dict(self) -> dict: 2283 result: dict = {} 2284 if self.allow_dependency_failure is not None: 2285 result["allow_dependency_failure"] = from_union( 2286 [ 2287 from_bool, 2288 lambda x: to_enum(AllowDependencyFailureEnum, x), 2289 from_none, 2290 ], 2291 self.allow_dependency_failure, 2292 ) 2293 if self.branches is not None: 2294 result["branches"] = from_union( 2295 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2296 ) 2297 if self.continue_on_failure is not None: 2298 result["continue_on_failure"] = from_union( 2299 [ 2300 from_bool, 2301 lambda x: to_enum(AllowDependencyFailureEnum, x), 2302 from_none, 2303 ], 2304 self.continue_on_failure, 2305 ) 2306 if self.depends_on is not None: 2307 result["depends_on"] = from_union( 2308 [ 2309 from_none, 2310 lambda x: from_list( 2311 lambda x: from_union( 2312 [lambda x: to_class(DependsOnClass, x), from_str], x 2313 ), 2314 x, 2315 ), 2316 from_str, 2317 ], 2318 self.depends_on, 2319 ) 2320 if self.id is not None: 2321 result["id"] = from_union([from_str, from_none], self.id) 2322 if self.identifier is not None: 2323 result["identifier"] = from_union([from_str, from_none], self.identifier) 2324 if self.wait_step_if is not None: 2325 result["if"] = from_union([from_str, from_none], self.wait_step_if) 2326 if self.key is not None: 2327 result["key"] = from_union([from_str, from_none], self.key) 2328 if self.label is not None: 2329 result["label"] = from_union([from_none, from_str], self.label) 2330 if self.name is not None: 2331 result["name"] = from_union([from_none, from_str], self.name) 2332 if self.type is not None: 2333 result["type"] = from_union( 2334 [lambda x: to_enum(WaitType, x), from_none], self.type 2335 ) 2336 if self.wait is not None: 2337 result["wait"] = from_union([from_none, from_str], self.wait) 2338 return result
2341class PurpleStep: 2342 """Waits for previous steps to pass before continuing""" 2343 2344 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2345 block: Optional[Union[str, BlockStep]] 2346 """The label of the block step""" 2347 2348 blocked_state: Optional[BlockedState] 2349 """The state that the build is set to when the build is blocked by this block step""" 2350 2351 branches: Optional[Union[List[str], str]] 2352 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 2353 fields: Optional[List[Field]] 2354 id: Optional[str] 2355 identifier: Optional[str] 2356 step_if: Optional[str] 2357 key: Optional[str] 2358 label: Optional[str] 2359 name: Optional[str] 2360 prompt: Optional[str] 2361 type: Optional[BlockStepType] 2362 input: Optional[Union[str, InputStep]] 2363 """The label of the input step""" 2364 2365 agents: Optional[Union[Dict[str, Any], List[str]]] 2366 artifact_paths: Optional[Union[List[str], str]] 2367 """The glob path/s of artifacts to upload once this step has finished running""" 2368 2369 cache: Optional[Union[List[str], CacheClass, str]] 2370 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]] 2371 command: Optional[Union[List[str], CommandStep, str]] 2372 """The commands to run on the agent""" 2373 2374 commands: Optional[Union[List[str], CommandStep, str]] 2375 """The commands to run on the agent""" 2376 2377 concurrency: Optional[int] 2378 """The maximum number of jobs created from this step that are allowed to run at the same 2379 time. If you use this attribute, you must also define concurrency_group. 2380 """ 2381 concurrency_group: Optional[str] 2382 """A unique name for the concurrency group that you are creating with the concurrency 2383 attribute 2384 """ 2385 concurrency_method: Optional[ConcurrencyMethod] 2386 """Control command order, allowed values are 'ordered' (default) and 'eager'. If you use 2387 this attribute, you must also define concurrency_group and concurrency. 2388 """ 2389 env: Optional[Dict[str, Any]] 2390 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]] 2391 notify: Optional[List[Union[NotifyClass, NotifyEnum]]] 2392 """Array of notification options for this step""" 2393 2394 parallelism: Optional[int] 2395 """The number of parallel jobs that will be created based on this step""" 2396 2397 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]] 2398 priority: Optional[int] 2399 """Priority of the job, higher priorities are assigned to agents""" 2400 2401 retry: Optional[Retry] 2402 """The conditions for retrying this step.""" 2403 2404 signature: Optional[Signature] 2405 """The signature of the command step, generally injected by agents at pipeline upload""" 2406 2407 skip: Optional[Union[bool, str]] 2408 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 2409 timeout_in_minutes: Optional[int] 2410 """The number of minutes to time out a job""" 2411 2412 script: Optional[CommandStep] 2413 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2414 """Continue to the next steps, even if the previous group of steps fail""" 2415 2416 wait: Optional[Union[WaitStep, str]] 2417 """Waits for previous steps to pass before continuing""" 2418 2419 waiter: Optional[WaitStep] 2420 step_async: Optional[Union[bool, AllowDependencyFailureEnum]] 2421 """Whether to continue the build without waiting for the triggered step to complete""" 2422 2423 build: Optional[Build] 2424 """Properties of the build that will be created when the step is triggered""" 2425 2426 trigger: Optional[Union[str, TriggerStep]] 2427 """The slug of the pipeline to create a build""" 2428 2429 def __init__( 2430 self, 2431 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2432 block: Optional[Union[str, BlockStep]], 2433 blocked_state: Optional[BlockedState], 2434 branches: Optional[Union[List[str], str]], 2435 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2436 fields: Optional[List[Field]], 2437 id: Optional[str], 2438 identifier: Optional[str], 2439 step_if: Optional[str], 2440 key: Optional[str], 2441 label: Optional[str], 2442 name: Optional[str], 2443 prompt: Optional[str], 2444 type: Optional[BlockStepType], 2445 input: Optional[Union[str, InputStep]], 2446 agents: Optional[Union[Dict[str, Any], List[str]]], 2447 artifact_paths: Optional[Union[List[str], str]], 2448 cache: Optional[Union[List[str], CacheClass, str]], 2449 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 2450 command: Optional[Union[List[str], CommandStep, str]], 2451 commands: Optional[Union[List[str], CommandStep, str]], 2452 concurrency: Optional[int], 2453 concurrency_group: Optional[str], 2454 concurrency_method: Optional[ConcurrencyMethod], 2455 env: Optional[Dict[str, Any]], 2456 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 2457 notify: Optional[List[Union[NotifyClass, NotifyEnum]]], 2458 parallelism: Optional[int], 2459 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 2460 priority: Optional[int], 2461 retry: Optional[Retry], 2462 signature: Optional[Signature], 2463 skip: Optional[Union[bool, str]], 2464 soft_fail: Optional[ 2465 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 2466 ], 2467 timeout_in_minutes: Optional[int], 2468 script: Optional[CommandStep], 2469 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2470 wait: Optional[Union[WaitStep, str]], 2471 waiter: Optional[WaitStep], 2472 step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 2473 build: Optional[Build], 2474 trigger: Optional[Union[str, TriggerStep]], 2475 ) -> None: 2476 self.allow_dependency_failure = allow_dependency_failure 2477 self.block = block 2478 self.blocked_state = blocked_state 2479 self.branches = branches 2480 self.depends_on = depends_on 2481 self.fields = fields 2482 self.id = id 2483 self.identifier = identifier 2484 self.step_if = step_if 2485 self.key = key 2486 self.label = label 2487 self.name = name 2488 self.prompt = prompt 2489 self.type = type 2490 self.input = input 2491 self.agents = agents 2492 self.artifact_paths = artifact_paths 2493 self.cache = cache 2494 self.cancel_on_build_failing = cancel_on_build_failing 2495 self.command = command 2496 self.commands = commands 2497 self.concurrency = concurrency 2498 self.concurrency_group = concurrency_group 2499 self.concurrency_method = concurrency_method 2500 self.env = env 2501 self.matrix = matrix 2502 self.notify = notify 2503 self.parallelism = parallelism 2504 self.plugins = plugins 2505 self.priority = priority 2506 self.retry = retry 2507 self.signature = signature 2508 self.skip = skip 2509 self.soft_fail = soft_fail 2510 self.timeout_in_minutes = timeout_in_minutes 2511 self.script = script 2512 self.continue_on_failure = continue_on_failure 2513 self.wait = wait 2514 self.waiter = waiter 2515 self.step_async = step_async 2516 self.build = build 2517 self.trigger = trigger 2518 2519 @staticmethod 2520 def from_dict(obj: Any) -> "PurpleStep": 2521 assert isinstance(obj, dict) 2522 allow_dependency_failure = from_union( 2523 [from_bool, AllowDependencyFailureEnum, from_none], 2524 obj.get("allow_dependency_failure"), 2525 ) 2526 block = from_union([from_str, BlockStep.from_dict, from_none], obj.get("block")) 2527 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 2528 branches = from_union( 2529 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2530 ) 2531 depends_on = from_union( 2532 [ 2533 from_none, 2534 lambda x: from_list( 2535 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2536 ), 2537 from_str, 2538 ], 2539 obj.get("depends_on"), 2540 ) 2541 fields = from_union( 2542 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 2543 ) 2544 id = from_union([from_str, from_none], obj.get("id")) 2545 identifier = from_union([from_str, from_none], obj.get("identifier")) 2546 step_if = from_union([from_str, from_none], obj.get("if")) 2547 key = from_union([from_str, from_none], obj.get("key")) 2548 label = from_union([from_none, from_str], obj.get("label")) 2549 name = from_union([from_none, from_str], obj.get("name")) 2550 prompt = from_union([from_str, from_none], obj.get("prompt")) 2551 type = from_union([BlockStepType, from_none], obj.get("type")) 2552 input = from_union([from_str, InputStep.from_dict, from_none], obj.get("input")) 2553 agents = from_union( 2554 [ 2555 lambda x: from_dict(lambda x: x, x), 2556 lambda x: from_list(from_str, x), 2557 from_none, 2558 ], 2559 obj.get("agents"), 2560 ) 2561 artifact_paths = from_union( 2562 [lambda x: from_list(from_str, x), from_str, from_none], 2563 obj.get("artifact_paths"), 2564 ) 2565 cache = from_union( 2566 [ 2567 lambda x: from_list(from_str, x), 2568 CacheClass.from_dict, 2569 from_str, 2570 from_none, 2571 ], 2572 obj.get("cache"), 2573 ) 2574 cancel_on_build_failing = from_union( 2575 [from_bool, AllowDependencyFailureEnum, from_none], 2576 obj.get("cancel_on_build_failing"), 2577 ) 2578 command = from_union( 2579 [ 2580 lambda x: from_list(from_str, x), 2581 CommandStep.from_dict, 2582 from_str, 2583 from_none, 2584 ], 2585 obj.get("command"), 2586 ) 2587 commands = from_union( 2588 [ 2589 lambda x: from_list(from_str, x), 2590 CommandStep.from_dict, 2591 from_str, 2592 from_none, 2593 ], 2594 obj.get("commands"), 2595 ) 2596 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 2597 concurrency_group = from_union( 2598 [from_str, from_none], obj.get("concurrency_group") 2599 ) 2600 concurrency_method = from_union( 2601 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 2602 ) 2603 env = from_union( 2604 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 2605 ) 2606 matrix = from_union( 2607 [ 2608 lambda x: from_list( 2609 lambda x: from_union([from_int, from_bool, from_str], x), x 2610 ), 2611 MatrixClass.from_dict, 2612 from_none, 2613 ], 2614 obj.get("matrix"), 2615 ) 2616 notify = from_union( 2617 [ 2618 lambda x: from_list( 2619 lambda x: from_union([NotifyClass.from_dict, NotifyEnum], x), x 2620 ), 2621 from_none, 2622 ], 2623 obj.get("notify"), 2624 ) 2625 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 2626 plugins = from_union( 2627 [ 2628 lambda x: from_list( 2629 lambda x: from_union( 2630 [lambda x: from_dict(lambda x: x, x), from_str], x 2631 ), 2632 x, 2633 ), 2634 lambda x: from_dict(lambda x: x, x), 2635 from_none, 2636 ], 2637 obj.get("plugins"), 2638 ) 2639 priority = from_union([from_int, from_none], obj.get("priority")) 2640 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 2641 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 2642 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 2643 soft_fail = from_union( 2644 [ 2645 from_bool, 2646 lambda x: from_list(SoftFailElement.from_dict, x), 2647 AllowDependencyFailureEnum, 2648 from_none, 2649 ], 2650 obj.get("soft_fail"), 2651 ) 2652 timeout_in_minutes = from_union( 2653 [from_int, from_none], obj.get("timeout_in_minutes") 2654 ) 2655 script = from_union([CommandStep.from_dict, from_none], obj.get("script")) 2656 continue_on_failure = from_union( 2657 [from_bool, AllowDependencyFailureEnum, from_none], 2658 obj.get("continue_on_failure"), 2659 ) 2660 wait = from_union([from_none, WaitStep.from_dict, from_str], obj.get("wait")) 2661 waiter = from_union([WaitStep.from_dict, from_none], obj.get("waiter")) 2662 step_async = from_union( 2663 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 2664 ) 2665 build = from_union([Build.from_dict, from_none], obj.get("build")) 2666 trigger = from_union( 2667 [from_str, TriggerStep.from_dict, from_none], obj.get("trigger") 2668 ) 2669 return PurpleStep( 2670 allow_dependency_failure, 2671 block, 2672 blocked_state, 2673 branches, 2674 depends_on, 2675 fields, 2676 id, 2677 identifier, 2678 step_if, 2679 key, 2680 label, 2681 name, 2682 prompt, 2683 type, 2684 input, 2685 agents, 2686 artifact_paths, 2687 cache, 2688 cancel_on_build_failing, 2689 command, 2690 commands, 2691 concurrency, 2692 concurrency_group, 2693 concurrency_method, 2694 env, 2695 matrix, 2696 notify, 2697 parallelism, 2698 plugins, 2699 priority, 2700 retry, 2701 signature, 2702 skip, 2703 soft_fail, 2704 timeout_in_minutes, 2705 script, 2706 continue_on_failure, 2707 wait, 2708 waiter, 2709 step_async, 2710 build, 2711 trigger, 2712 ) 2713 2714 def to_dict(self) -> dict: 2715 result: dict = {} 2716 if self.allow_dependency_failure is not None: 2717 result["allow_dependency_failure"] = from_union( 2718 [ 2719 from_bool, 2720 lambda x: to_enum(AllowDependencyFailureEnum, x), 2721 from_none, 2722 ], 2723 self.allow_dependency_failure, 2724 ) 2725 if self.block is not None: 2726 result["block"] = from_union( 2727 [from_str, lambda x: to_class(BlockStep, x), from_none], self.block 2728 ) 2729 if self.blocked_state is not None: 2730 result["blocked_state"] = from_union( 2731 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 2732 ) 2733 if self.branches is not None: 2734 result["branches"] = from_union( 2735 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2736 ) 2737 if self.depends_on is not None: 2738 result["depends_on"] = from_union( 2739 [ 2740 from_none, 2741 lambda x: from_list( 2742 lambda x: from_union( 2743 [lambda x: to_class(DependsOnClass, x), from_str], x 2744 ), 2745 x, 2746 ), 2747 from_str, 2748 ], 2749 self.depends_on, 2750 ) 2751 if self.fields is not None: 2752 result["fields"] = from_union( 2753 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 2754 self.fields, 2755 ) 2756 if self.id is not None: 2757 result["id"] = from_union([from_str, from_none], self.id) 2758 if self.identifier is not None: 2759 result["identifier"] = from_union([from_str, from_none], self.identifier) 2760 if self.step_if is not None: 2761 result["if"] = from_union([from_str, from_none], self.step_if) 2762 if self.key is not None: 2763 result["key"] = from_union([from_str, from_none], self.key) 2764 if self.label is not None: 2765 result["label"] = from_union([from_none, from_str], self.label) 2766 if self.name is not None: 2767 result["name"] = from_union([from_none, from_str], self.name) 2768 if self.prompt is not None: 2769 result["prompt"] = from_union([from_str, from_none], self.prompt) 2770 if self.type is not None: 2771 result["type"] = from_union( 2772 [lambda x: to_enum(BlockStepType, x), from_none], self.type 2773 ) 2774 if self.input is not None: 2775 result["input"] = from_union( 2776 [from_str, lambda x: to_class(InputStep, x), from_none], self.input 2777 ) 2778 if self.agents is not None: 2779 result["agents"] = from_union( 2780 [ 2781 lambda x: from_dict(lambda x: x, x), 2782 lambda x: from_list(from_str, x), 2783 from_none, 2784 ], 2785 self.agents, 2786 ) 2787 if self.artifact_paths is not None: 2788 result["artifact_paths"] = from_union( 2789 [lambda x: from_list(from_str, x), from_str, from_none], 2790 self.artifact_paths, 2791 ) 2792 if self.cache is not None: 2793 result["cache"] = from_union( 2794 [ 2795 lambda x: from_list(from_str, x), 2796 lambda x: to_class(CacheClass, x), 2797 from_str, 2798 from_none, 2799 ], 2800 self.cache, 2801 ) 2802 if self.cancel_on_build_failing is not None: 2803 result["cancel_on_build_failing"] = from_union( 2804 [ 2805 from_bool, 2806 lambda x: to_enum(AllowDependencyFailureEnum, x), 2807 from_none, 2808 ], 2809 self.cancel_on_build_failing, 2810 ) 2811 if self.command is not None: 2812 result["command"] = from_union( 2813 [ 2814 lambda x: from_list(from_str, x), 2815 lambda x: to_class(CommandStep, x), 2816 from_str, 2817 from_none, 2818 ], 2819 self.command, 2820 ) 2821 if self.commands is not None: 2822 result["commands"] = from_union( 2823 [ 2824 lambda x: from_list(from_str, x), 2825 lambda x: to_class(CommandStep, x), 2826 from_str, 2827 from_none, 2828 ], 2829 self.commands, 2830 ) 2831 if self.concurrency is not None: 2832 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 2833 if self.concurrency_group is not None: 2834 result["concurrency_group"] = from_union( 2835 [from_str, from_none], self.concurrency_group 2836 ) 2837 if self.concurrency_method is not None: 2838 result["concurrency_method"] = from_union( 2839 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 2840 self.concurrency_method, 2841 ) 2842 if self.env is not None: 2843 result["env"] = from_union( 2844 [lambda x: from_dict(lambda x: x, x), from_none], self.env 2845 ) 2846 if self.matrix is not None: 2847 result["matrix"] = from_union( 2848 [ 2849 lambda x: from_list( 2850 lambda x: from_union([from_int, from_bool, from_str], x), x 2851 ), 2852 lambda x: to_class(MatrixClass, x), 2853 from_none, 2854 ], 2855 self.matrix, 2856 ) 2857 if self.notify is not None: 2858 result["notify"] = from_union( 2859 [ 2860 lambda x: from_list( 2861 lambda x: from_union( 2862 [ 2863 lambda x: to_class(NotifyClass, x), 2864 lambda x: to_enum(NotifyEnum, x), 2865 ], 2866 x, 2867 ), 2868 x, 2869 ), 2870 from_none, 2871 ], 2872 self.notify, 2873 ) 2874 if self.parallelism is not None: 2875 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 2876 if self.plugins is not None: 2877 result["plugins"] = from_union( 2878 [ 2879 lambda x: from_list( 2880 lambda x: from_union( 2881 [lambda x: from_dict(lambda x: x, x), from_str], x 2882 ), 2883 x, 2884 ), 2885 lambda x: from_dict(lambda x: x, x), 2886 from_none, 2887 ], 2888 self.plugins, 2889 ) 2890 if self.priority is not None: 2891 result["priority"] = from_union([from_int, from_none], self.priority) 2892 if self.retry is not None: 2893 result["retry"] = from_union( 2894 [lambda x: to_class(Retry, x), from_none], self.retry 2895 ) 2896 if self.signature is not None: 2897 result["signature"] = from_union( 2898 [lambda x: to_class(Signature, x), from_none], self.signature 2899 ) 2900 if self.skip is not None: 2901 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 2902 if self.soft_fail is not None: 2903 result["soft_fail"] = from_union( 2904 [ 2905 from_bool, 2906 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 2907 lambda x: to_enum(AllowDependencyFailureEnum, x), 2908 from_none, 2909 ], 2910 self.soft_fail, 2911 ) 2912 if self.timeout_in_minutes is not None: 2913 result["timeout_in_minutes"] = from_union( 2914 [from_int, from_none], self.timeout_in_minutes 2915 ) 2916 if self.script is not None: 2917 result["script"] = from_union( 2918 [lambda x: to_class(CommandStep, x), from_none], self.script 2919 ) 2920 if self.continue_on_failure is not None: 2921 result["continue_on_failure"] = from_union( 2922 [ 2923 from_bool, 2924 lambda x: to_enum(AllowDependencyFailureEnum, x), 2925 from_none, 2926 ], 2927 self.continue_on_failure, 2928 ) 2929 if self.wait is not None: 2930 result["wait"] = from_union( 2931 [from_none, lambda x: to_class(WaitStep, x), from_str], self.wait 2932 ) 2933 if self.waiter is not None: 2934 result["waiter"] = from_union( 2935 [lambda x: to_class(WaitStep, x), from_none], self.waiter 2936 ) 2937 if self.step_async is not None: 2938 result["async"] = from_union( 2939 [ 2940 from_bool, 2941 lambda x: to_enum(AllowDependencyFailureEnum, x), 2942 from_none, 2943 ], 2944 self.step_async, 2945 ) 2946 if self.build is not None: 2947 result["build"] = from_union( 2948 [lambda x: to_class(Build, x), from_none], self.build 2949 ) 2950 if self.trigger is not None: 2951 result["trigger"] = from_union( 2952 [from_str, lambda x: to_class(TriggerStep, x), from_none], self.trigger 2953 ) 2954 return result
Waits for previous steps to pass before continuing
2429 def __init__( 2430 self, 2431 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2432 block: Optional[Union[str, BlockStep]], 2433 blocked_state: Optional[BlockedState], 2434 branches: Optional[Union[List[str], str]], 2435 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 2436 fields: Optional[List[Field]], 2437 id: Optional[str], 2438 identifier: Optional[str], 2439 step_if: Optional[str], 2440 key: Optional[str], 2441 label: Optional[str], 2442 name: Optional[str], 2443 prompt: Optional[str], 2444 type: Optional[BlockStepType], 2445 input: Optional[Union[str, InputStep]], 2446 agents: Optional[Union[Dict[str, Any], List[str]]], 2447 artifact_paths: Optional[Union[List[str], str]], 2448 cache: Optional[Union[List[str], CacheClass, str]], 2449 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 2450 command: Optional[Union[List[str], CommandStep, str]], 2451 commands: Optional[Union[List[str], CommandStep, str]], 2452 concurrency: Optional[int], 2453 concurrency_group: Optional[str], 2454 concurrency_method: Optional[ConcurrencyMethod], 2455 env: Optional[Dict[str, Any]], 2456 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 2457 notify: Optional[List[Union[NotifyClass, NotifyEnum]]], 2458 parallelism: Optional[int], 2459 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 2460 priority: Optional[int], 2461 retry: Optional[Retry], 2462 signature: Optional[Signature], 2463 skip: Optional[Union[bool, str]], 2464 soft_fail: Optional[ 2465 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 2466 ], 2467 timeout_in_minutes: Optional[int], 2468 script: Optional[CommandStep], 2469 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 2470 wait: Optional[Union[WaitStep, str]], 2471 waiter: Optional[WaitStep], 2472 step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 2473 build: Optional[Build], 2474 trigger: Optional[Union[str, TriggerStep]], 2475 ) -> None: 2476 self.allow_dependency_failure = allow_dependency_failure 2477 self.block = block 2478 self.blocked_state = blocked_state 2479 self.branches = branches 2480 self.depends_on = depends_on 2481 self.fields = fields 2482 self.id = id 2483 self.identifier = identifier 2484 self.step_if = step_if 2485 self.key = key 2486 self.label = label 2487 self.name = name 2488 self.prompt = prompt 2489 self.type = type 2490 self.input = input 2491 self.agents = agents 2492 self.artifact_paths = artifact_paths 2493 self.cache = cache 2494 self.cancel_on_build_failing = cancel_on_build_failing 2495 self.command = command 2496 self.commands = commands 2497 self.concurrency = concurrency 2498 self.concurrency_group = concurrency_group 2499 self.concurrency_method = concurrency_method 2500 self.env = env 2501 self.matrix = matrix 2502 self.notify = notify 2503 self.parallelism = parallelism 2504 self.plugins = plugins 2505 self.priority = priority 2506 self.retry = retry 2507 self.signature = signature 2508 self.skip = skip 2509 self.soft_fail = soft_fail 2510 self.timeout_in_minutes = timeout_in_minutes 2511 self.script = script 2512 self.continue_on_failure = continue_on_failure 2513 self.wait = wait 2514 self.waiter = waiter 2515 self.step_async = step_async 2516 self.build = build 2517 self.trigger = trigger
The state that the build is set to when the build is blocked by this block step
The glob path/s of artifacts to upload once this step has finished running
The maximum number of jobs created from this step that are allowed to run at the same time. If you use this attribute, you must also define concurrency_group.
A unique name for the concurrency group that you are creating with the concurrency attribute
Control command order, allowed values are 'ordered' (default) and 'eager'. If you use this attribute, you must also define concurrency_group and concurrency.
The signature of the command step, generally injected by agents at pipeline upload
Continue to the next steps, even if the previous group of steps fail
Whether to continue the build without waiting for the triggered step to complete
2519 @staticmethod 2520 def from_dict(obj: Any) -> "PurpleStep": 2521 assert isinstance(obj, dict) 2522 allow_dependency_failure = from_union( 2523 [from_bool, AllowDependencyFailureEnum, from_none], 2524 obj.get("allow_dependency_failure"), 2525 ) 2526 block = from_union([from_str, BlockStep.from_dict, from_none], obj.get("block")) 2527 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 2528 branches = from_union( 2529 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 2530 ) 2531 depends_on = from_union( 2532 [ 2533 from_none, 2534 lambda x: from_list( 2535 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 2536 ), 2537 from_str, 2538 ], 2539 obj.get("depends_on"), 2540 ) 2541 fields = from_union( 2542 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 2543 ) 2544 id = from_union([from_str, from_none], obj.get("id")) 2545 identifier = from_union([from_str, from_none], obj.get("identifier")) 2546 step_if = from_union([from_str, from_none], obj.get("if")) 2547 key = from_union([from_str, from_none], obj.get("key")) 2548 label = from_union([from_none, from_str], obj.get("label")) 2549 name = from_union([from_none, from_str], obj.get("name")) 2550 prompt = from_union([from_str, from_none], obj.get("prompt")) 2551 type = from_union([BlockStepType, from_none], obj.get("type")) 2552 input = from_union([from_str, InputStep.from_dict, from_none], obj.get("input")) 2553 agents = from_union( 2554 [ 2555 lambda x: from_dict(lambda x: x, x), 2556 lambda x: from_list(from_str, x), 2557 from_none, 2558 ], 2559 obj.get("agents"), 2560 ) 2561 artifact_paths = from_union( 2562 [lambda x: from_list(from_str, x), from_str, from_none], 2563 obj.get("artifact_paths"), 2564 ) 2565 cache = from_union( 2566 [ 2567 lambda x: from_list(from_str, x), 2568 CacheClass.from_dict, 2569 from_str, 2570 from_none, 2571 ], 2572 obj.get("cache"), 2573 ) 2574 cancel_on_build_failing = from_union( 2575 [from_bool, AllowDependencyFailureEnum, from_none], 2576 obj.get("cancel_on_build_failing"), 2577 ) 2578 command = from_union( 2579 [ 2580 lambda x: from_list(from_str, x), 2581 CommandStep.from_dict, 2582 from_str, 2583 from_none, 2584 ], 2585 obj.get("command"), 2586 ) 2587 commands = from_union( 2588 [ 2589 lambda x: from_list(from_str, x), 2590 CommandStep.from_dict, 2591 from_str, 2592 from_none, 2593 ], 2594 obj.get("commands"), 2595 ) 2596 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 2597 concurrency_group = from_union( 2598 [from_str, from_none], obj.get("concurrency_group") 2599 ) 2600 concurrency_method = from_union( 2601 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 2602 ) 2603 env = from_union( 2604 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 2605 ) 2606 matrix = from_union( 2607 [ 2608 lambda x: from_list( 2609 lambda x: from_union([from_int, from_bool, from_str], x), x 2610 ), 2611 MatrixClass.from_dict, 2612 from_none, 2613 ], 2614 obj.get("matrix"), 2615 ) 2616 notify = from_union( 2617 [ 2618 lambda x: from_list( 2619 lambda x: from_union([NotifyClass.from_dict, NotifyEnum], x), x 2620 ), 2621 from_none, 2622 ], 2623 obj.get("notify"), 2624 ) 2625 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 2626 plugins = from_union( 2627 [ 2628 lambda x: from_list( 2629 lambda x: from_union( 2630 [lambda x: from_dict(lambda x: x, x), from_str], x 2631 ), 2632 x, 2633 ), 2634 lambda x: from_dict(lambda x: x, x), 2635 from_none, 2636 ], 2637 obj.get("plugins"), 2638 ) 2639 priority = from_union([from_int, from_none], obj.get("priority")) 2640 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 2641 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 2642 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 2643 soft_fail = from_union( 2644 [ 2645 from_bool, 2646 lambda x: from_list(SoftFailElement.from_dict, x), 2647 AllowDependencyFailureEnum, 2648 from_none, 2649 ], 2650 obj.get("soft_fail"), 2651 ) 2652 timeout_in_minutes = from_union( 2653 [from_int, from_none], obj.get("timeout_in_minutes") 2654 ) 2655 script = from_union([CommandStep.from_dict, from_none], obj.get("script")) 2656 continue_on_failure = from_union( 2657 [from_bool, AllowDependencyFailureEnum, from_none], 2658 obj.get("continue_on_failure"), 2659 ) 2660 wait = from_union([from_none, WaitStep.from_dict, from_str], obj.get("wait")) 2661 waiter = from_union([WaitStep.from_dict, from_none], obj.get("waiter")) 2662 step_async = from_union( 2663 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 2664 ) 2665 build = from_union([Build.from_dict, from_none], obj.get("build")) 2666 trigger = from_union( 2667 [from_str, TriggerStep.from_dict, from_none], obj.get("trigger") 2668 ) 2669 return PurpleStep( 2670 allow_dependency_failure, 2671 block, 2672 blocked_state, 2673 branches, 2674 depends_on, 2675 fields, 2676 id, 2677 identifier, 2678 step_if, 2679 key, 2680 label, 2681 name, 2682 prompt, 2683 type, 2684 input, 2685 agents, 2686 artifact_paths, 2687 cache, 2688 cancel_on_build_failing, 2689 command, 2690 commands, 2691 concurrency, 2692 concurrency_group, 2693 concurrency_method, 2694 env, 2695 matrix, 2696 notify, 2697 parallelism, 2698 plugins, 2699 priority, 2700 retry, 2701 signature, 2702 skip, 2703 soft_fail, 2704 timeout_in_minutes, 2705 script, 2706 continue_on_failure, 2707 wait, 2708 waiter, 2709 step_async, 2710 build, 2711 trigger, 2712 )
2714 def to_dict(self) -> dict: 2715 result: dict = {} 2716 if self.allow_dependency_failure is not None: 2717 result["allow_dependency_failure"] = from_union( 2718 [ 2719 from_bool, 2720 lambda x: to_enum(AllowDependencyFailureEnum, x), 2721 from_none, 2722 ], 2723 self.allow_dependency_failure, 2724 ) 2725 if self.block is not None: 2726 result["block"] = from_union( 2727 [from_str, lambda x: to_class(BlockStep, x), from_none], self.block 2728 ) 2729 if self.blocked_state is not None: 2730 result["blocked_state"] = from_union( 2731 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 2732 ) 2733 if self.branches is not None: 2734 result["branches"] = from_union( 2735 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 2736 ) 2737 if self.depends_on is not None: 2738 result["depends_on"] = from_union( 2739 [ 2740 from_none, 2741 lambda x: from_list( 2742 lambda x: from_union( 2743 [lambda x: to_class(DependsOnClass, x), from_str], x 2744 ), 2745 x, 2746 ), 2747 from_str, 2748 ], 2749 self.depends_on, 2750 ) 2751 if self.fields is not None: 2752 result["fields"] = from_union( 2753 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 2754 self.fields, 2755 ) 2756 if self.id is not None: 2757 result["id"] = from_union([from_str, from_none], self.id) 2758 if self.identifier is not None: 2759 result["identifier"] = from_union([from_str, from_none], self.identifier) 2760 if self.step_if is not None: 2761 result["if"] = from_union([from_str, from_none], self.step_if) 2762 if self.key is not None: 2763 result["key"] = from_union([from_str, from_none], self.key) 2764 if self.label is not None: 2765 result["label"] = from_union([from_none, from_str], self.label) 2766 if self.name is not None: 2767 result["name"] = from_union([from_none, from_str], self.name) 2768 if self.prompt is not None: 2769 result["prompt"] = from_union([from_str, from_none], self.prompt) 2770 if self.type is not None: 2771 result["type"] = from_union( 2772 [lambda x: to_enum(BlockStepType, x), from_none], self.type 2773 ) 2774 if self.input is not None: 2775 result["input"] = from_union( 2776 [from_str, lambda x: to_class(InputStep, x), from_none], self.input 2777 ) 2778 if self.agents is not None: 2779 result["agents"] = from_union( 2780 [ 2781 lambda x: from_dict(lambda x: x, x), 2782 lambda x: from_list(from_str, x), 2783 from_none, 2784 ], 2785 self.agents, 2786 ) 2787 if self.artifact_paths is not None: 2788 result["artifact_paths"] = from_union( 2789 [lambda x: from_list(from_str, x), from_str, from_none], 2790 self.artifact_paths, 2791 ) 2792 if self.cache is not None: 2793 result["cache"] = from_union( 2794 [ 2795 lambda x: from_list(from_str, x), 2796 lambda x: to_class(CacheClass, x), 2797 from_str, 2798 from_none, 2799 ], 2800 self.cache, 2801 ) 2802 if self.cancel_on_build_failing is not None: 2803 result["cancel_on_build_failing"] = from_union( 2804 [ 2805 from_bool, 2806 lambda x: to_enum(AllowDependencyFailureEnum, x), 2807 from_none, 2808 ], 2809 self.cancel_on_build_failing, 2810 ) 2811 if self.command is not None: 2812 result["command"] = from_union( 2813 [ 2814 lambda x: from_list(from_str, x), 2815 lambda x: to_class(CommandStep, x), 2816 from_str, 2817 from_none, 2818 ], 2819 self.command, 2820 ) 2821 if self.commands is not None: 2822 result["commands"] = from_union( 2823 [ 2824 lambda x: from_list(from_str, x), 2825 lambda x: to_class(CommandStep, x), 2826 from_str, 2827 from_none, 2828 ], 2829 self.commands, 2830 ) 2831 if self.concurrency is not None: 2832 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 2833 if self.concurrency_group is not None: 2834 result["concurrency_group"] = from_union( 2835 [from_str, from_none], self.concurrency_group 2836 ) 2837 if self.concurrency_method is not None: 2838 result["concurrency_method"] = from_union( 2839 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 2840 self.concurrency_method, 2841 ) 2842 if self.env is not None: 2843 result["env"] = from_union( 2844 [lambda x: from_dict(lambda x: x, x), from_none], self.env 2845 ) 2846 if self.matrix is not None: 2847 result["matrix"] = from_union( 2848 [ 2849 lambda x: from_list( 2850 lambda x: from_union([from_int, from_bool, from_str], x), x 2851 ), 2852 lambda x: to_class(MatrixClass, x), 2853 from_none, 2854 ], 2855 self.matrix, 2856 ) 2857 if self.notify is not None: 2858 result["notify"] = from_union( 2859 [ 2860 lambda x: from_list( 2861 lambda x: from_union( 2862 [ 2863 lambda x: to_class(NotifyClass, x), 2864 lambda x: to_enum(NotifyEnum, x), 2865 ], 2866 x, 2867 ), 2868 x, 2869 ), 2870 from_none, 2871 ], 2872 self.notify, 2873 ) 2874 if self.parallelism is not None: 2875 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 2876 if self.plugins is not None: 2877 result["plugins"] = from_union( 2878 [ 2879 lambda x: from_list( 2880 lambda x: from_union( 2881 [lambda x: from_dict(lambda x: x, x), from_str], x 2882 ), 2883 x, 2884 ), 2885 lambda x: from_dict(lambda x: x, x), 2886 from_none, 2887 ], 2888 self.plugins, 2889 ) 2890 if self.priority is not None: 2891 result["priority"] = from_union([from_int, from_none], self.priority) 2892 if self.retry is not None: 2893 result["retry"] = from_union( 2894 [lambda x: to_class(Retry, x), from_none], self.retry 2895 ) 2896 if self.signature is not None: 2897 result["signature"] = from_union( 2898 [lambda x: to_class(Signature, x), from_none], self.signature 2899 ) 2900 if self.skip is not None: 2901 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 2902 if self.soft_fail is not None: 2903 result["soft_fail"] = from_union( 2904 [ 2905 from_bool, 2906 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 2907 lambda x: to_enum(AllowDependencyFailureEnum, x), 2908 from_none, 2909 ], 2910 self.soft_fail, 2911 ) 2912 if self.timeout_in_minutes is not None: 2913 result["timeout_in_minutes"] = from_union( 2914 [from_int, from_none], self.timeout_in_minutes 2915 ) 2916 if self.script is not None: 2917 result["script"] = from_union( 2918 [lambda x: to_class(CommandStep, x), from_none], self.script 2919 ) 2920 if self.continue_on_failure is not None: 2921 result["continue_on_failure"] = from_union( 2922 [ 2923 from_bool, 2924 lambda x: to_enum(AllowDependencyFailureEnum, x), 2925 from_none, 2926 ], 2927 self.continue_on_failure, 2928 ) 2929 if self.wait is not None: 2930 result["wait"] = from_union( 2931 [from_none, lambda x: to_class(WaitStep, x), from_str], self.wait 2932 ) 2933 if self.waiter is not None: 2934 result["waiter"] = from_union( 2935 [lambda x: to_class(WaitStep, x), from_none], self.waiter 2936 ) 2937 if self.step_async is not None: 2938 result["async"] = from_union( 2939 [ 2940 from_bool, 2941 lambda x: to_enum(AllowDependencyFailureEnum, x), 2942 from_none, 2943 ], 2944 self.step_async, 2945 ) 2946 if self.build is not None: 2947 result["build"] = from_union( 2948 [lambda x: to_class(Build, x), from_none], self.build 2949 ) 2950 if self.trigger is not None: 2951 result["trigger"] = from_union( 2952 [from_str, lambda x: to_class(TriggerStep, x), from_none], self.trigger 2953 ) 2954 return result
2957class StringStep(Enum): 2958 """Pauses the execution of a build and waits on a user to unblock it 2959 2960 Waits for previous steps to pass before continuing 2961 """ 2962 2963 BLOCK = "block" 2964 INPUT = "input" 2965 WAIT = "wait" 2966 WAITER = "waiter"
Pauses the execution of a build and waits on a user to unblock it
Waits for previous steps to pass before continuing
2969class GroupStepClass: 2970 """Waits for previous steps to pass before continuing""" 2971 2972 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 2973 block: Optional[Union[str, BlockStep]] 2974 """The label of the block step""" 2975 2976 blocked_state: Optional[BlockedState] 2977 """The state that the build is set to when the build is blocked by this block step""" 2978 2979 branches: Optional[Union[List[str], str]] 2980 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]] 2981 fields: Optional[List[Field]] 2982 id: Optional[str] 2983 identifier: Optional[str] 2984 step_if: Optional[str] 2985 key: Optional[str] 2986 label: Optional[str] 2987 name: Optional[str] 2988 prompt: Optional[str] 2989 type: Optional[BlockStepType] 2990 input: Optional[Union[str, InputStep]] 2991 """The label of the input step""" 2992 2993 agents: Optional[Union[Dict[str, Any], List[str]]] 2994 artifact_paths: Optional[Union[List[str], str]] 2995 """The glob path/s of artifacts to upload once this step has finished running""" 2996 2997 cache: Optional[Union[List[str], CacheClass, str]] 2998 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]] 2999 command: Optional[Union[List[str], CommandStep, str]] 3000 """The commands to run on the agent""" 3001 3002 commands: Optional[Union[List[str], CommandStep, str]] 3003 """The commands to run on the agent""" 3004 3005 concurrency: Optional[int] 3006 """The maximum number of jobs created from this step that are allowed to run at the same 3007 time. If you use this attribute, you must also define concurrency_group. 3008 """ 3009 concurrency_group: Optional[str] 3010 """A unique name for the concurrency group that you are creating with the concurrency 3011 attribute 3012 """ 3013 concurrency_method: Optional[ConcurrencyMethod] 3014 """Control command order, allowed values are 'ordered' (default) and 'eager'. If you use 3015 this attribute, you must also define concurrency_group and concurrency. 3016 """ 3017 env: Optional[Dict[str, Any]] 3018 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]] 3019 notify: Optional[List[Union[FluffyBuildNotify, NotifyEnum]]] 3020 """Array of notification options for this step""" 3021 3022 parallelism: Optional[int] 3023 """The number of parallel jobs that will be created based on this step""" 3024 3025 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]] 3026 priority: Optional[int] 3027 """Priority of the job, higher priorities are assigned to agents""" 3028 3029 retry: Optional[Retry] 3030 """The conditions for retrying this step.""" 3031 3032 signature: Optional[Signature] 3033 """The signature of the command step, generally injected by agents at pipeline upload""" 3034 3035 skip: Optional[Union[bool, str]] 3036 soft_fail: Optional[Union[bool, List[SoftFailElement], AllowDependencyFailureEnum]] 3037 timeout_in_minutes: Optional[int] 3038 """The number of minutes to time out a job""" 3039 3040 script: Optional[CommandStep] 3041 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]] 3042 """Continue to the next steps, even if the previous group of steps fail""" 3043 3044 wait: Optional[Union[WaitStep, str]] 3045 """Waits for previous steps to pass before continuing""" 3046 3047 waiter: Optional[WaitStep] 3048 step_async: Optional[Union[bool, AllowDependencyFailureEnum]] 3049 """Whether to continue the build without waiting for the triggered step to complete""" 3050 3051 build: Optional[Build] 3052 """Properties of the build that will be created when the step is triggered""" 3053 3054 trigger: Optional[Union[str, TriggerStep]] 3055 """The slug of the pipeline to create a build""" 3056 3057 group: Optional[str] 3058 """The name to give to this group of steps""" 3059 3060 steps: Optional[List[Union[PurpleStep, StringStep]]] 3061 """A list of steps""" 3062 3063 def __init__( 3064 self, 3065 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 3066 block: Optional[Union[str, BlockStep]], 3067 blocked_state: Optional[BlockedState], 3068 branches: Optional[Union[List[str], str]], 3069 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 3070 fields: Optional[List[Field]], 3071 id: Optional[str], 3072 identifier: Optional[str], 3073 step_if: Optional[str], 3074 key: Optional[str], 3075 label: Optional[str], 3076 name: Optional[str], 3077 prompt: Optional[str], 3078 type: Optional[BlockStepType], 3079 input: Optional[Union[str, InputStep]], 3080 agents: Optional[Union[Dict[str, Any], List[str]]], 3081 artifact_paths: Optional[Union[List[str], str]], 3082 cache: Optional[Union[List[str], CacheClass, str]], 3083 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 3084 command: Optional[Union[List[str], CommandStep, str]], 3085 commands: Optional[Union[List[str], CommandStep, str]], 3086 concurrency: Optional[int], 3087 concurrency_group: Optional[str], 3088 concurrency_method: Optional[ConcurrencyMethod], 3089 env: Optional[Dict[str, Any]], 3090 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 3091 notify: Optional[List[Union[FluffyBuildNotify, NotifyEnum]]], 3092 parallelism: Optional[int], 3093 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 3094 priority: Optional[int], 3095 retry: Optional[Retry], 3096 signature: Optional[Signature], 3097 skip: Optional[Union[bool, str]], 3098 soft_fail: Optional[ 3099 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 3100 ], 3101 timeout_in_minutes: Optional[int], 3102 script: Optional[CommandStep], 3103 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 3104 wait: Optional[Union[WaitStep, str]], 3105 waiter: Optional[WaitStep], 3106 step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 3107 build: Optional[Build], 3108 trigger: Optional[Union[str, TriggerStep]], 3109 group: Optional[str], 3110 steps: Optional[List[Union[PurpleStep, StringStep]]], 3111 ) -> None: 3112 self.allow_dependency_failure = allow_dependency_failure 3113 self.block = block 3114 self.blocked_state = blocked_state 3115 self.branches = branches 3116 self.depends_on = depends_on 3117 self.fields = fields 3118 self.id = id 3119 self.identifier = identifier 3120 self.step_if = step_if 3121 self.key = key 3122 self.label = label 3123 self.name = name 3124 self.prompt = prompt 3125 self.type = type 3126 self.input = input 3127 self.agents = agents 3128 self.artifact_paths = artifact_paths 3129 self.cache = cache 3130 self.cancel_on_build_failing = cancel_on_build_failing 3131 self.command = command 3132 self.commands = commands 3133 self.concurrency = concurrency 3134 self.concurrency_group = concurrency_group 3135 self.concurrency_method = concurrency_method 3136 self.env = env 3137 self.matrix = matrix 3138 self.notify = notify 3139 self.parallelism = parallelism 3140 self.plugins = plugins 3141 self.priority = priority 3142 self.retry = retry 3143 self.signature = signature 3144 self.skip = skip 3145 self.soft_fail = soft_fail 3146 self.timeout_in_minutes = timeout_in_minutes 3147 self.script = script 3148 self.continue_on_failure = continue_on_failure 3149 self.wait = wait 3150 self.waiter = waiter 3151 self.step_async = step_async 3152 self.build = build 3153 self.trigger = trigger 3154 self.group = group 3155 self.steps = steps 3156 3157 @staticmethod 3158 def from_dict(obj: Any) -> "GroupStepClass": 3159 assert isinstance(obj, dict) 3160 allow_dependency_failure = from_union( 3161 [from_bool, AllowDependencyFailureEnum, from_none], 3162 obj.get("allow_dependency_failure"), 3163 ) 3164 block = from_union([from_str, BlockStep.from_dict, from_none], obj.get("block")) 3165 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 3166 branches = from_union( 3167 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 3168 ) 3169 depends_on = from_union( 3170 [ 3171 from_none, 3172 lambda x: from_list( 3173 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 3174 ), 3175 from_str, 3176 ], 3177 obj.get("depends_on"), 3178 ) 3179 fields = from_union( 3180 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 3181 ) 3182 id = from_union([from_str, from_none], obj.get("id")) 3183 identifier = from_union([from_str, from_none], obj.get("identifier")) 3184 step_if = from_union([from_str, from_none], obj.get("if")) 3185 key = from_union([from_str, from_none], obj.get("key")) 3186 label = from_union([from_none, from_str], obj.get("label")) 3187 name = from_union([from_none, from_str], obj.get("name")) 3188 prompt = from_union([from_str, from_none], obj.get("prompt")) 3189 type = from_union([BlockStepType, from_none], obj.get("type")) 3190 input = from_union([from_str, InputStep.from_dict, from_none], obj.get("input")) 3191 agents = from_union( 3192 [ 3193 lambda x: from_dict(lambda x: x, x), 3194 lambda x: from_list(from_str, x), 3195 from_none, 3196 ], 3197 obj.get("agents"), 3198 ) 3199 artifact_paths = from_union( 3200 [lambda x: from_list(from_str, x), from_str, from_none], 3201 obj.get("artifact_paths"), 3202 ) 3203 cache = from_union( 3204 [ 3205 lambda x: from_list(from_str, x), 3206 CacheClass.from_dict, 3207 from_str, 3208 from_none, 3209 ], 3210 obj.get("cache"), 3211 ) 3212 cancel_on_build_failing = from_union( 3213 [from_bool, AllowDependencyFailureEnum, from_none], 3214 obj.get("cancel_on_build_failing"), 3215 ) 3216 command = from_union( 3217 [ 3218 lambda x: from_list(from_str, x), 3219 CommandStep.from_dict, 3220 from_str, 3221 from_none, 3222 ], 3223 obj.get("command"), 3224 ) 3225 commands = from_union( 3226 [ 3227 lambda x: from_list(from_str, x), 3228 CommandStep.from_dict, 3229 from_str, 3230 from_none, 3231 ], 3232 obj.get("commands"), 3233 ) 3234 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 3235 concurrency_group = from_union( 3236 [from_str, from_none], obj.get("concurrency_group") 3237 ) 3238 concurrency_method = from_union( 3239 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 3240 ) 3241 env = from_union( 3242 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 3243 ) 3244 matrix = from_union( 3245 [ 3246 lambda x: from_list( 3247 lambda x: from_union([from_int, from_bool, from_str], x), x 3248 ), 3249 MatrixClass.from_dict, 3250 from_none, 3251 ], 3252 obj.get("matrix"), 3253 ) 3254 notify = from_union( 3255 [ 3256 lambda x: from_list( 3257 lambda x: from_union([FluffyBuildNotify.from_dict, NotifyEnum], x), 3258 x, 3259 ), 3260 from_none, 3261 ], 3262 obj.get("notify"), 3263 ) 3264 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 3265 plugins = from_union( 3266 [ 3267 lambda x: from_list( 3268 lambda x: from_union( 3269 [lambda x: from_dict(lambda x: x, x), from_str], x 3270 ), 3271 x, 3272 ), 3273 lambda x: from_dict(lambda x: x, x), 3274 from_none, 3275 ], 3276 obj.get("plugins"), 3277 ) 3278 priority = from_union([from_int, from_none], obj.get("priority")) 3279 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 3280 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 3281 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 3282 soft_fail = from_union( 3283 [ 3284 from_bool, 3285 lambda x: from_list(SoftFailElement.from_dict, x), 3286 AllowDependencyFailureEnum, 3287 from_none, 3288 ], 3289 obj.get("soft_fail"), 3290 ) 3291 timeout_in_minutes = from_union( 3292 [from_int, from_none], obj.get("timeout_in_minutes") 3293 ) 3294 script = from_union([CommandStep.from_dict, from_none], obj.get("script")) 3295 continue_on_failure = from_union( 3296 [from_bool, AllowDependencyFailureEnum, from_none], 3297 obj.get("continue_on_failure"), 3298 ) 3299 wait = from_union([from_none, WaitStep.from_dict, from_str], obj.get("wait")) 3300 waiter = from_union([WaitStep.from_dict, from_none], obj.get("waiter")) 3301 step_async = from_union( 3302 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 3303 ) 3304 build = from_union([Build.from_dict, from_none], obj.get("build")) 3305 trigger = from_union( 3306 [from_str, TriggerStep.from_dict, from_none], obj.get("trigger") 3307 ) 3308 group = from_union([from_none, from_str], obj.get("group")) 3309 steps = from_union( 3310 [ 3311 lambda x: from_list( 3312 lambda x: from_union([PurpleStep.from_dict, StringStep], x), x 3313 ), 3314 from_none, 3315 ], 3316 obj.get("steps"), 3317 ) 3318 return GroupStepClass( 3319 allow_dependency_failure, 3320 block, 3321 blocked_state, 3322 branches, 3323 depends_on, 3324 fields, 3325 id, 3326 identifier, 3327 step_if, 3328 key, 3329 label, 3330 name, 3331 prompt, 3332 type, 3333 input, 3334 agents, 3335 artifact_paths, 3336 cache, 3337 cancel_on_build_failing, 3338 command, 3339 commands, 3340 concurrency, 3341 concurrency_group, 3342 concurrency_method, 3343 env, 3344 matrix, 3345 notify, 3346 parallelism, 3347 plugins, 3348 priority, 3349 retry, 3350 signature, 3351 skip, 3352 soft_fail, 3353 timeout_in_minutes, 3354 script, 3355 continue_on_failure, 3356 wait, 3357 waiter, 3358 step_async, 3359 build, 3360 trigger, 3361 group, 3362 steps, 3363 ) 3364 3365 def to_dict(self) -> dict: 3366 result: dict = {} 3367 if self.allow_dependency_failure is not None: 3368 result["allow_dependency_failure"] = from_union( 3369 [ 3370 from_bool, 3371 lambda x: to_enum(AllowDependencyFailureEnum, x), 3372 from_none, 3373 ], 3374 self.allow_dependency_failure, 3375 ) 3376 if self.block is not None: 3377 result["block"] = from_union( 3378 [from_str, lambda x: to_class(BlockStep, x), from_none], self.block 3379 ) 3380 if self.blocked_state is not None: 3381 result["blocked_state"] = from_union( 3382 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 3383 ) 3384 if self.branches is not None: 3385 result["branches"] = from_union( 3386 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 3387 ) 3388 if self.depends_on is not None: 3389 result["depends_on"] = from_union( 3390 [ 3391 from_none, 3392 lambda x: from_list( 3393 lambda x: from_union( 3394 [lambda x: to_class(DependsOnClass, x), from_str], x 3395 ), 3396 x, 3397 ), 3398 from_str, 3399 ], 3400 self.depends_on, 3401 ) 3402 if self.fields is not None: 3403 result["fields"] = from_union( 3404 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 3405 self.fields, 3406 ) 3407 if self.id is not None: 3408 result["id"] = from_union([from_str, from_none], self.id) 3409 if self.identifier is not None: 3410 result["identifier"] = from_union([from_str, from_none], self.identifier) 3411 if self.step_if is not None: 3412 result["if"] = from_union([from_str, from_none], self.step_if) 3413 if self.key is not None: 3414 result["key"] = from_union([from_str, from_none], self.key) 3415 if self.label is not None: 3416 result["label"] = from_union([from_none, from_str], self.label) 3417 if self.name is not None: 3418 result["name"] = from_union([from_none, from_str], self.name) 3419 if self.prompt is not None: 3420 result["prompt"] = from_union([from_str, from_none], self.prompt) 3421 if self.type is not None: 3422 result["type"] = from_union( 3423 [lambda x: to_enum(BlockStepType, x), from_none], self.type 3424 ) 3425 if self.input is not None: 3426 result["input"] = from_union( 3427 [from_str, lambda x: to_class(InputStep, x), from_none], self.input 3428 ) 3429 if self.agents is not None: 3430 result["agents"] = from_union( 3431 [ 3432 lambda x: from_dict(lambda x: x, x), 3433 lambda x: from_list(from_str, x), 3434 from_none, 3435 ], 3436 self.agents, 3437 ) 3438 if self.artifact_paths is not None: 3439 result["artifact_paths"] = from_union( 3440 [lambda x: from_list(from_str, x), from_str, from_none], 3441 self.artifact_paths, 3442 ) 3443 if self.cache is not None: 3444 result["cache"] = from_union( 3445 [ 3446 lambda x: from_list(from_str, x), 3447 lambda x: to_class(CacheClass, x), 3448 from_str, 3449 from_none, 3450 ], 3451 self.cache, 3452 ) 3453 if self.cancel_on_build_failing is not None: 3454 result["cancel_on_build_failing"] = from_union( 3455 [ 3456 from_bool, 3457 lambda x: to_enum(AllowDependencyFailureEnum, x), 3458 from_none, 3459 ], 3460 self.cancel_on_build_failing, 3461 ) 3462 if self.command is not None: 3463 result["command"] = from_union( 3464 [ 3465 lambda x: from_list(from_str, x), 3466 lambda x: to_class(CommandStep, x), 3467 from_str, 3468 from_none, 3469 ], 3470 self.command, 3471 ) 3472 if self.commands is not None: 3473 result["commands"] = from_union( 3474 [ 3475 lambda x: from_list(from_str, x), 3476 lambda x: to_class(CommandStep, x), 3477 from_str, 3478 from_none, 3479 ], 3480 self.commands, 3481 ) 3482 if self.concurrency is not None: 3483 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 3484 if self.concurrency_group is not None: 3485 result["concurrency_group"] = from_union( 3486 [from_str, from_none], self.concurrency_group 3487 ) 3488 if self.concurrency_method is not None: 3489 result["concurrency_method"] = from_union( 3490 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 3491 self.concurrency_method, 3492 ) 3493 if self.env is not None: 3494 result["env"] = from_union( 3495 [lambda x: from_dict(lambda x: x, x), from_none], self.env 3496 ) 3497 if self.matrix is not None: 3498 result["matrix"] = from_union( 3499 [ 3500 lambda x: from_list( 3501 lambda x: from_union([from_int, from_bool, from_str], x), x 3502 ), 3503 lambda x: to_class(MatrixClass, x), 3504 from_none, 3505 ], 3506 self.matrix, 3507 ) 3508 if self.notify is not None: 3509 result["notify"] = from_union( 3510 [ 3511 lambda x: from_list( 3512 lambda x: from_union( 3513 [ 3514 lambda x: to_class(FluffyBuildNotify, x), 3515 lambda x: to_enum(NotifyEnum, x), 3516 ], 3517 x, 3518 ), 3519 x, 3520 ), 3521 from_none, 3522 ], 3523 self.notify, 3524 ) 3525 if self.parallelism is not None: 3526 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 3527 if self.plugins is not None: 3528 result["plugins"] = from_union( 3529 [ 3530 lambda x: from_list( 3531 lambda x: from_union( 3532 [lambda x: from_dict(lambda x: x, x), from_str], x 3533 ), 3534 x, 3535 ), 3536 lambda x: from_dict(lambda x: x, x), 3537 from_none, 3538 ], 3539 self.plugins, 3540 ) 3541 if self.priority is not None: 3542 result["priority"] = from_union([from_int, from_none], self.priority) 3543 if self.retry is not None: 3544 result["retry"] = from_union( 3545 [lambda x: to_class(Retry, x), from_none], self.retry 3546 ) 3547 if self.signature is not None: 3548 result["signature"] = from_union( 3549 [lambda x: to_class(Signature, x), from_none], self.signature 3550 ) 3551 if self.skip is not None: 3552 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 3553 if self.soft_fail is not None: 3554 result["soft_fail"] = from_union( 3555 [ 3556 from_bool, 3557 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 3558 lambda x: to_enum(AllowDependencyFailureEnum, x), 3559 from_none, 3560 ], 3561 self.soft_fail, 3562 ) 3563 if self.timeout_in_minutes is not None: 3564 result["timeout_in_minutes"] = from_union( 3565 [from_int, from_none], self.timeout_in_minutes 3566 ) 3567 if self.script is not None: 3568 result["script"] = from_union( 3569 [lambda x: to_class(CommandStep, x), from_none], self.script 3570 ) 3571 if self.continue_on_failure is not None: 3572 result["continue_on_failure"] = from_union( 3573 [ 3574 from_bool, 3575 lambda x: to_enum(AllowDependencyFailureEnum, x), 3576 from_none, 3577 ], 3578 self.continue_on_failure, 3579 ) 3580 if self.wait is not None: 3581 result["wait"] = from_union( 3582 [from_none, lambda x: to_class(WaitStep, x), from_str], self.wait 3583 ) 3584 if self.waiter is not None: 3585 result["waiter"] = from_union( 3586 [lambda x: to_class(WaitStep, x), from_none], self.waiter 3587 ) 3588 if self.step_async is not None: 3589 result["async"] = from_union( 3590 [ 3591 from_bool, 3592 lambda x: to_enum(AllowDependencyFailureEnum, x), 3593 from_none, 3594 ], 3595 self.step_async, 3596 ) 3597 if self.build is not None: 3598 result["build"] = from_union( 3599 [lambda x: to_class(Build, x), from_none], self.build 3600 ) 3601 if self.trigger is not None: 3602 result["trigger"] = from_union( 3603 [from_str, lambda x: to_class(TriggerStep, x), from_none], self.trigger 3604 ) 3605 if self.group is not None: 3606 result["group"] = from_union([from_none, from_str], self.group) 3607 if self.steps is not None: 3608 result["steps"] = from_union( 3609 [ 3610 lambda x: from_list( 3611 lambda x: from_union( 3612 [ 3613 lambda x: to_class(PurpleStep, x), 3614 lambda x: to_enum(StringStep, x), 3615 ], 3616 x, 3617 ), 3618 x, 3619 ), 3620 from_none, 3621 ], 3622 self.steps, 3623 ) 3624 return result
Waits for previous steps to pass before continuing
3063 def __init__( 3064 self, 3065 allow_dependency_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 3066 block: Optional[Union[str, BlockStep]], 3067 blocked_state: Optional[BlockedState], 3068 branches: Optional[Union[List[str], str]], 3069 depends_on: Optional[Union[List[Union[DependsOnClass, str]], str]], 3070 fields: Optional[List[Field]], 3071 id: Optional[str], 3072 identifier: Optional[str], 3073 step_if: Optional[str], 3074 key: Optional[str], 3075 label: Optional[str], 3076 name: Optional[str], 3077 prompt: Optional[str], 3078 type: Optional[BlockStepType], 3079 input: Optional[Union[str, InputStep]], 3080 agents: Optional[Union[Dict[str, Any], List[str]]], 3081 artifact_paths: Optional[Union[List[str], str]], 3082 cache: Optional[Union[List[str], CacheClass, str]], 3083 cancel_on_build_failing: Optional[Union[bool, AllowDependencyFailureEnum]], 3084 command: Optional[Union[List[str], CommandStep, str]], 3085 commands: Optional[Union[List[str], CommandStep, str]], 3086 concurrency: Optional[int], 3087 concurrency_group: Optional[str], 3088 concurrency_method: Optional[ConcurrencyMethod], 3089 env: Optional[Dict[str, Any]], 3090 matrix: Optional[Union[List[Union[int, bool, str]], MatrixClass]], 3091 notify: Optional[List[Union[FluffyBuildNotify, NotifyEnum]]], 3092 parallelism: Optional[int], 3093 plugins: Optional[Union[List[Union[Dict[str, Any], str]], Dict[str, Any]]], 3094 priority: Optional[int], 3095 retry: Optional[Retry], 3096 signature: Optional[Signature], 3097 skip: Optional[Union[bool, str]], 3098 soft_fail: Optional[ 3099 Union[bool, List[SoftFailElement], AllowDependencyFailureEnum] 3100 ], 3101 timeout_in_minutes: Optional[int], 3102 script: Optional[CommandStep], 3103 continue_on_failure: Optional[Union[bool, AllowDependencyFailureEnum]], 3104 wait: Optional[Union[WaitStep, str]], 3105 waiter: Optional[WaitStep], 3106 step_async: Optional[Union[bool, AllowDependencyFailureEnum]], 3107 build: Optional[Build], 3108 trigger: Optional[Union[str, TriggerStep]], 3109 group: Optional[str], 3110 steps: Optional[List[Union[PurpleStep, StringStep]]], 3111 ) -> None: 3112 self.allow_dependency_failure = allow_dependency_failure 3113 self.block = block 3114 self.blocked_state = blocked_state 3115 self.branches = branches 3116 self.depends_on = depends_on 3117 self.fields = fields 3118 self.id = id 3119 self.identifier = identifier 3120 self.step_if = step_if 3121 self.key = key 3122 self.label = label 3123 self.name = name 3124 self.prompt = prompt 3125 self.type = type 3126 self.input = input 3127 self.agents = agents 3128 self.artifact_paths = artifact_paths 3129 self.cache = cache 3130 self.cancel_on_build_failing = cancel_on_build_failing 3131 self.command = command 3132 self.commands = commands 3133 self.concurrency = concurrency 3134 self.concurrency_group = concurrency_group 3135 self.concurrency_method = concurrency_method 3136 self.env = env 3137 self.matrix = matrix 3138 self.notify = notify 3139 self.parallelism = parallelism 3140 self.plugins = plugins 3141 self.priority = priority 3142 self.retry = retry 3143 self.signature = signature 3144 self.skip = skip 3145 self.soft_fail = soft_fail 3146 self.timeout_in_minutes = timeout_in_minutes 3147 self.script = script 3148 self.continue_on_failure = continue_on_failure 3149 self.wait = wait 3150 self.waiter = waiter 3151 self.step_async = step_async 3152 self.build = build 3153 self.trigger = trigger 3154 self.group = group 3155 self.steps = steps
The state that the build is set to when the build is blocked by this block step
The glob path/s of artifacts to upload once this step has finished running
The maximum number of jobs created from this step that are allowed to run at the same time. If you use this attribute, you must also define concurrency_group.
A unique name for the concurrency group that you are creating with the concurrency attribute
Control command order, allowed values are 'ordered' (default) and 'eager'. If you use this attribute, you must also define concurrency_group and concurrency.
Array of notification options for this step
The signature of the command step, generally injected by agents at pipeline upload
Continue to the next steps, even if the previous group of steps fail
Whether to continue the build without waiting for the triggered step to complete
3157 @staticmethod 3158 def from_dict(obj: Any) -> "GroupStepClass": 3159 assert isinstance(obj, dict) 3160 allow_dependency_failure = from_union( 3161 [from_bool, AllowDependencyFailureEnum, from_none], 3162 obj.get("allow_dependency_failure"), 3163 ) 3164 block = from_union([from_str, BlockStep.from_dict, from_none], obj.get("block")) 3165 blocked_state = from_union([BlockedState, from_none], obj.get("blocked_state")) 3166 branches = from_union( 3167 [lambda x: from_list(from_str, x), from_str, from_none], obj.get("branches") 3168 ) 3169 depends_on = from_union( 3170 [ 3171 from_none, 3172 lambda x: from_list( 3173 lambda x: from_union([DependsOnClass.from_dict, from_str], x), x 3174 ), 3175 from_str, 3176 ], 3177 obj.get("depends_on"), 3178 ) 3179 fields = from_union( 3180 [lambda x: from_list(Field.from_dict, x), from_none], obj.get("fields") 3181 ) 3182 id = from_union([from_str, from_none], obj.get("id")) 3183 identifier = from_union([from_str, from_none], obj.get("identifier")) 3184 step_if = from_union([from_str, from_none], obj.get("if")) 3185 key = from_union([from_str, from_none], obj.get("key")) 3186 label = from_union([from_none, from_str], obj.get("label")) 3187 name = from_union([from_none, from_str], obj.get("name")) 3188 prompt = from_union([from_str, from_none], obj.get("prompt")) 3189 type = from_union([BlockStepType, from_none], obj.get("type")) 3190 input = from_union([from_str, InputStep.from_dict, from_none], obj.get("input")) 3191 agents = from_union( 3192 [ 3193 lambda x: from_dict(lambda x: x, x), 3194 lambda x: from_list(from_str, x), 3195 from_none, 3196 ], 3197 obj.get("agents"), 3198 ) 3199 artifact_paths = from_union( 3200 [lambda x: from_list(from_str, x), from_str, from_none], 3201 obj.get("artifact_paths"), 3202 ) 3203 cache = from_union( 3204 [ 3205 lambda x: from_list(from_str, x), 3206 CacheClass.from_dict, 3207 from_str, 3208 from_none, 3209 ], 3210 obj.get("cache"), 3211 ) 3212 cancel_on_build_failing = from_union( 3213 [from_bool, AllowDependencyFailureEnum, from_none], 3214 obj.get("cancel_on_build_failing"), 3215 ) 3216 command = from_union( 3217 [ 3218 lambda x: from_list(from_str, x), 3219 CommandStep.from_dict, 3220 from_str, 3221 from_none, 3222 ], 3223 obj.get("command"), 3224 ) 3225 commands = from_union( 3226 [ 3227 lambda x: from_list(from_str, x), 3228 CommandStep.from_dict, 3229 from_str, 3230 from_none, 3231 ], 3232 obj.get("commands"), 3233 ) 3234 concurrency = from_union([from_int, from_none], obj.get("concurrency")) 3235 concurrency_group = from_union( 3236 [from_str, from_none], obj.get("concurrency_group") 3237 ) 3238 concurrency_method = from_union( 3239 [ConcurrencyMethod, from_none], obj.get("concurrency_method") 3240 ) 3241 env = from_union( 3242 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 3243 ) 3244 matrix = from_union( 3245 [ 3246 lambda x: from_list( 3247 lambda x: from_union([from_int, from_bool, from_str], x), x 3248 ), 3249 MatrixClass.from_dict, 3250 from_none, 3251 ], 3252 obj.get("matrix"), 3253 ) 3254 notify = from_union( 3255 [ 3256 lambda x: from_list( 3257 lambda x: from_union([FluffyBuildNotify.from_dict, NotifyEnum], x), 3258 x, 3259 ), 3260 from_none, 3261 ], 3262 obj.get("notify"), 3263 ) 3264 parallelism = from_union([from_int, from_none], obj.get("parallelism")) 3265 plugins = from_union( 3266 [ 3267 lambda x: from_list( 3268 lambda x: from_union( 3269 [lambda x: from_dict(lambda x: x, x), from_str], x 3270 ), 3271 x, 3272 ), 3273 lambda x: from_dict(lambda x: x, x), 3274 from_none, 3275 ], 3276 obj.get("plugins"), 3277 ) 3278 priority = from_union([from_int, from_none], obj.get("priority")) 3279 retry = from_union([Retry.from_dict, from_none], obj.get("retry")) 3280 signature = from_union([Signature.from_dict, from_none], obj.get("signature")) 3281 skip = from_union([from_bool, from_str, from_none], obj.get("skip")) 3282 soft_fail = from_union( 3283 [ 3284 from_bool, 3285 lambda x: from_list(SoftFailElement.from_dict, x), 3286 AllowDependencyFailureEnum, 3287 from_none, 3288 ], 3289 obj.get("soft_fail"), 3290 ) 3291 timeout_in_minutes = from_union( 3292 [from_int, from_none], obj.get("timeout_in_minutes") 3293 ) 3294 script = from_union([CommandStep.from_dict, from_none], obj.get("script")) 3295 continue_on_failure = from_union( 3296 [from_bool, AllowDependencyFailureEnum, from_none], 3297 obj.get("continue_on_failure"), 3298 ) 3299 wait = from_union([from_none, WaitStep.from_dict, from_str], obj.get("wait")) 3300 waiter = from_union([WaitStep.from_dict, from_none], obj.get("waiter")) 3301 step_async = from_union( 3302 [from_bool, AllowDependencyFailureEnum, from_none], obj.get("async") 3303 ) 3304 build = from_union([Build.from_dict, from_none], obj.get("build")) 3305 trigger = from_union( 3306 [from_str, TriggerStep.from_dict, from_none], obj.get("trigger") 3307 ) 3308 group = from_union([from_none, from_str], obj.get("group")) 3309 steps = from_union( 3310 [ 3311 lambda x: from_list( 3312 lambda x: from_union([PurpleStep.from_dict, StringStep], x), x 3313 ), 3314 from_none, 3315 ], 3316 obj.get("steps"), 3317 ) 3318 return GroupStepClass( 3319 allow_dependency_failure, 3320 block, 3321 blocked_state, 3322 branches, 3323 depends_on, 3324 fields, 3325 id, 3326 identifier, 3327 step_if, 3328 key, 3329 label, 3330 name, 3331 prompt, 3332 type, 3333 input, 3334 agents, 3335 artifact_paths, 3336 cache, 3337 cancel_on_build_failing, 3338 command, 3339 commands, 3340 concurrency, 3341 concurrency_group, 3342 concurrency_method, 3343 env, 3344 matrix, 3345 notify, 3346 parallelism, 3347 plugins, 3348 priority, 3349 retry, 3350 signature, 3351 skip, 3352 soft_fail, 3353 timeout_in_minutes, 3354 script, 3355 continue_on_failure, 3356 wait, 3357 waiter, 3358 step_async, 3359 build, 3360 trigger, 3361 group, 3362 steps, 3363 )
3365 def to_dict(self) -> dict: 3366 result: dict = {} 3367 if self.allow_dependency_failure is not None: 3368 result["allow_dependency_failure"] = from_union( 3369 [ 3370 from_bool, 3371 lambda x: to_enum(AllowDependencyFailureEnum, x), 3372 from_none, 3373 ], 3374 self.allow_dependency_failure, 3375 ) 3376 if self.block is not None: 3377 result["block"] = from_union( 3378 [from_str, lambda x: to_class(BlockStep, x), from_none], self.block 3379 ) 3380 if self.blocked_state is not None: 3381 result["blocked_state"] = from_union( 3382 [lambda x: to_enum(BlockedState, x), from_none], self.blocked_state 3383 ) 3384 if self.branches is not None: 3385 result["branches"] = from_union( 3386 [lambda x: from_list(from_str, x), from_str, from_none], self.branches 3387 ) 3388 if self.depends_on is not None: 3389 result["depends_on"] = from_union( 3390 [ 3391 from_none, 3392 lambda x: from_list( 3393 lambda x: from_union( 3394 [lambda x: to_class(DependsOnClass, x), from_str], x 3395 ), 3396 x, 3397 ), 3398 from_str, 3399 ], 3400 self.depends_on, 3401 ) 3402 if self.fields is not None: 3403 result["fields"] = from_union( 3404 [lambda x: from_list(lambda x: to_class(Field, x), x), from_none], 3405 self.fields, 3406 ) 3407 if self.id is not None: 3408 result["id"] = from_union([from_str, from_none], self.id) 3409 if self.identifier is not None: 3410 result["identifier"] = from_union([from_str, from_none], self.identifier) 3411 if self.step_if is not None: 3412 result["if"] = from_union([from_str, from_none], self.step_if) 3413 if self.key is not None: 3414 result["key"] = from_union([from_str, from_none], self.key) 3415 if self.label is not None: 3416 result["label"] = from_union([from_none, from_str], self.label) 3417 if self.name is not None: 3418 result["name"] = from_union([from_none, from_str], self.name) 3419 if self.prompt is not None: 3420 result["prompt"] = from_union([from_str, from_none], self.prompt) 3421 if self.type is not None: 3422 result["type"] = from_union( 3423 [lambda x: to_enum(BlockStepType, x), from_none], self.type 3424 ) 3425 if self.input is not None: 3426 result["input"] = from_union( 3427 [from_str, lambda x: to_class(InputStep, x), from_none], self.input 3428 ) 3429 if self.agents is not None: 3430 result["agents"] = from_union( 3431 [ 3432 lambda x: from_dict(lambda x: x, x), 3433 lambda x: from_list(from_str, x), 3434 from_none, 3435 ], 3436 self.agents, 3437 ) 3438 if self.artifact_paths is not None: 3439 result["artifact_paths"] = from_union( 3440 [lambda x: from_list(from_str, x), from_str, from_none], 3441 self.artifact_paths, 3442 ) 3443 if self.cache is not None: 3444 result["cache"] = from_union( 3445 [ 3446 lambda x: from_list(from_str, x), 3447 lambda x: to_class(CacheClass, x), 3448 from_str, 3449 from_none, 3450 ], 3451 self.cache, 3452 ) 3453 if self.cancel_on_build_failing is not None: 3454 result["cancel_on_build_failing"] = from_union( 3455 [ 3456 from_bool, 3457 lambda x: to_enum(AllowDependencyFailureEnum, x), 3458 from_none, 3459 ], 3460 self.cancel_on_build_failing, 3461 ) 3462 if self.command is not None: 3463 result["command"] = from_union( 3464 [ 3465 lambda x: from_list(from_str, x), 3466 lambda x: to_class(CommandStep, x), 3467 from_str, 3468 from_none, 3469 ], 3470 self.command, 3471 ) 3472 if self.commands is not None: 3473 result["commands"] = from_union( 3474 [ 3475 lambda x: from_list(from_str, x), 3476 lambda x: to_class(CommandStep, x), 3477 from_str, 3478 from_none, 3479 ], 3480 self.commands, 3481 ) 3482 if self.concurrency is not None: 3483 result["concurrency"] = from_union([from_int, from_none], self.concurrency) 3484 if self.concurrency_group is not None: 3485 result["concurrency_group"] = from_union( 3486 [from_str, from_none], self.concurrency_group 3487 ) 3488 if self.concurrency_method is not None: 3489 result["concurrency_method"] = from_union( 3490 [lambda x: to_enum(ConcurrencyMethod, x), from_none], 3491 self.concurrency_method, 3492 ) 3493 if self.env is not None: 3494 result["env"] = from_union( 3495 [lambda x: from_dict(lambda x: x, x), from_none], self.env 3496 ) 3497 if self.matrix is not None: 3498 result["matrix"] = from_union( 3499 [ 3500 lambda x: from_list( 3501 lambda x: from_union([from_int, from_bool, from_str], x), x 3502 ), 3503 lambda x: to_class(MatrixClass, x), 3504 from_none, 3505 ], 3506 self.matrix, 3507 ) 3508 if self.notify is not None: 3509 result["notify"] = from_union( 3510 [ 3511 lambda x: from_list( 3512 lambda x: from_union( 3513 [ 3514 lambda x: to_class(FluffyBuildNotify, x), 3515 lambda x: to_enum(NotifyEnum, x), 3516 ], 3517 x, 3518 ), 3519 x, 3520 ), 3521 from_none, 3522 ], 3523 self.notify, 3524 ) 3525 if self.parallelism is not None: 3526 result["parallelism"] = from_union([from_int, from_none], self.parallelism) 3527 if self.plugins is not None: 3528 result["plugins"] = from_union( 3529 [ 3530 lambda x: from_list( 3531 lambda x: from_union( 3532 [lambda x: from_dict(lambda x: x, x), from_str], x 3533 ), 3534 x, 3535 ), 3536 lambda x: from_dict(lambda x: x, x), 3537 from_none, 3538 ], 3539 self.plugins, 3540 ) 3541 if self.priority is not None: 3542 result["priority"] = from_union([from_int, from_none], self.priority) 3543 if self.retry is not None: 3544 result["retry"] = from_union( 3545 [lambda x: to_class(Retry, x), from_none], self.retry 3546 ) 3547 if self.signature is not None: 3548 result["signature"] = from_union( 3549 [lambda x: to_class(Signature, x), from_none], self.signature 3550 ) 3551 if self.skip is not None: 3552 result["skip"] = from_union([from_bool, from_str, from_none], self.skip) 3553 if self.soft_fail is not None: 3554 result["soft_fail"] = from_union( 3555 [ 3556 from_bool, 3557 lambda x: from_list(lambda x: to_class(SoftFailElement, x), x), 3558 lambda x: to_enum(AllowDependencyFailureEnum, x), 3559 from_none, 3560 ], 3561 self.soft_fail, 3562 ) 3563 if self.timeout_in_minutes is not None: 3564 result["timeout_in_minutes"] = from_union( 3565 [from_int, from_none], self.timeout_in_minutes 3566 ) 3567 if self.script is not None: 3568 result["script"] = from_union( 3569 [lambda x: to_class(CommandStep, x), from_none], self.script 3570 ) 3571 if self.continue_on_failure is not None: 3572 result["continue_on_failure"] = from_union( 3573 [ 3574 from_bool, 3575 lambda x: to_enum(AllowDependencyFailureEnum, x), 3576 from_none, 3577 ], 3578 self.continue_on_failure, 3579 ) 3580 if self.wait is not None: 3581 result["wait"] = from_union( 3582 [from_none, lambda x: to_class(WaitStep, x), from_str], self.wait 3583 ) 3584 if self.waiter is not None: 3585 result["waiter"] = from_union( 3586 [lambda x: to_class(WaitStep, x), from_none], self.waiter 3587 ) 3588 if self.step_async is not None: 3589 result["async"] = from_union( 3590 [ 3591 from_bool, 3592 lambda x: to_enum(AllowDependencyFailureEnum, x), 3593 from_none, 3594 ], 3595 self.step_async, 3596 ) 3597 if self.build is not None: 3598 result["build"] = from_union( 3599 [lambda x: to_class(Build, x), from_none], self.build 3600 ) 3601 if self.trigger is not None: 3602 result["trigger"] = from_union( 3603 [from_str, lambda x: to_class(TriggerStep, x), from_none], self.trigger 3604 ) 3605 if self.group is not None: 3606 result["group"] = from_union([from_none, from_str], self.group) 3607 if self.steps is not None: 3608 result["steps"] = from_union( 3609 [ 3610 lambda x: from_list( 3611 lambda x: from_union( 3612 [ 3613 lambda x: to_class(PurpleStep, x), 3614 lambda x: to_enum(StringStep, x), 3615 ], 3616 x, 3617 ), 3618 x, 3619 ), 3620 from_none, 3621 ], 3622 self.steps, 3623 ) 3624 return result
3627class Schema: 3628 agents: Optional[Union[Dict[str, Any], List[str]]] 3629 env: Optional[Dict[str, Any]] 3630 notify: Optional[List[Union[PurpleBuildNotify, NotifyEnum]]] 3631 steps: List[Union[GroupStepClass, StringStep]] 3632 """A list of steps""" 3633 3634 def __init__( 3635 self, 3636 agents: Optional[Union[Dict[str, Any], List[str]]], 3637 env: Optional[Dict[str, Any]], 3638 notify: Optional[List[Union[PurpleBuildNotify, NotifyEnum]]], 3639 steps: List[Union[GroupStepClass, StringStep]], 3640 ) -> None: 3641 self.agents = agents 3642 self.env = env 3643 self.notify = notify 3644 self.steps = steps 3645 3646 @staticmethod 3647 def from_dict(obj: Any) -> "Schema": 3648 assert isinstance(obj, dict) 3649 agents = from_union( 3650 [ 3651 lambda x: from_dict(lambda x: x, x), 3652 lambda x: from_list(from_str, x), 3653 from_none, 3654 ], 3655 obj.get("agents"), 3656 ) 3657 env = from_union( 3658 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 3659 ) 3660 notify = from_union( 3661 [ 3662 lambda x: from_list( 3663 lambda x: from_union([PurpleBuildNotify.from_dict, NotifyEnum], x), 3664 x, 3665 ), 3666 from_none, 3667 ], 3668 obj.get("notify"), 3669 ) 3670 steps = from_list( 3671 lambda x: from_union([GroupStepClass.from_dict, StringStep], x), 3672 obj.get("steps"), 3673 ) 3674 return Schema(agents, env, notify, steps) 3675 3676 def to_dict(self) -> dict: 3677 result: dict = {} 3678 if self.agents is not None: 3679 result["agents"] = from_union( 3680 [ 3681 lambda x: from_dict(lambda x: x, x), 3682 lambda x: from_list(from_str, x), 3683 from_none, 3684 ], 3685 self.agents, 3686 ) 3687 if self.env is not None: 3688 result["env"] = from_union( 3689 [lambda x: from_dict(lambda x: x, x), from_none], self.env 3690 ) 3691 if self.notify is not None: 3692 result["notify"] = from_union( 3693 [ 3694 lambda x: from_list( 3695 lambda x: from_union( 3696 [ 3697 lambda x: to_class(PurpleBuildNotify, x), 3698 lambda x: to_enum(NotifyEnum, x), 3699 ], 3700 x, 3701 ), 3702 x, 3703 ), 3704 from_none, 3705 ], 3706 self.notify, 3707 ) 3708 result["steps"] = from_list( 3709 lambda x: from_union( 3710 [ 3711 lambda x: to_class(GroupStepClass, x), 3712 lambda x: to_enum(StringStep, x), 3713 ], 3714 x, 3715 ), 3716 self.steps, 3717 ) 3718 return result
3634 def __init__( 3635 self, 3636 agents: Optional[Union[Dict[str, Any], List[str]]], 3637 env: Optional[Dict[str, Any]], 3638 notify: Optional[List[Union[PurpleBuildNotify, NotifyEnum]]], 3639 steps: List[Union[GroupStepClass, StringStep]], 3640 ) -> None: 3641 self.agents = agents 3642 self.env = env 3643 self.notify = notify 3644 self.steps = steps
3646 @staticmethod 3647 def from_dict(obj: Any) -> "Schema": 3648 assert isinstance(obj, dict) 3649 agents = from_union( 3650 [ 3651 lambda x: from_dict(lambda x: x, x), 3652 lambda x: from_list(from_str, x), 3653 from_none, 3654 ], 3655 obj.get("agents"), 3656 ) 3657 env = from_union( 3658 [lambda x: from_dict(lambda x: x, x), from_none], obj.get("env") 3659 ) 3660 notify = from_union( 3661 [ 3662 lambda x: from_list( 3663 lambda x: from_union([PurpleBuildNotify.from_dict, NotifyEnum], x), 3664 x, 3665 ), 3666 from_none, 3667 ], 3668 obj.get("notify"), 3669 ) 3670 steps = from_list( 3671 lambda x: from_union([GroupStepClass.from_dict, StringStep], x), 3672 obj.get("steps"), 3673 ) 3674 return Schema(agents, env, notify, steps)
3676 def to_dict(self) -> dict: 3677 result: dict = {} 3678 if self.agents is not None: 3679 result["agents"] = from_union( 3680 [ 3681 lambda x: from_dict(lambda x: x, x), 3682 lambda x: from_list(from_str, x), 3683 from_none, 3684 ], 3685 self.agents, 3686 ) 3687 if self.env is not None: 3688 result["env"] = from_union( 3689 [lambda x: from_dict(lambda x: x, x), from_none], self.env 3690 ) 3691 if self.notify is not None: 3692 result["notify"] = from_union( 3693 [ 3694 lambda x: from_list( 3695 lambda x: from_union( 3696 [ 3697 lambda x: to_class(PurpleBuildNotify, x), 3698 lambda x: to_enum(NotifyEnum, x), 3699 ], 3700 x, 3701 ), 3702 x, 3703 ), 3704 from_none, 3705 ], 3706 self.notify, 3707 ) 3708 result["steps"] = from_list( 3709 lambda x: from_union( 3710 [ 3711 lambda x: to_class(GroupStepClass, x), 3712 lambda x: to_enum(StringStep, x), 3713 ], 3714 x, 3715 ), 3716 self.steps, 3717 ) 3718 return result