buildkite_sdk.types

  1from typing import Optional, Union, List, Dict, Any
  2from buildkite_sdk.schema import (
  3    Adjustment as _matrix_adjustment,
  4    AutomaticRetry as _automatic_retry,
  5    BlockedState as _blocked_state,
  6    Build as _build,
  7    CacheClass as _cache_class,
  8    ConcurrencyMethod as _concurrency_method,
  9    DependsOnClass as _depends_on_class,
 10    ExitStatusEnum as _exit_status_enum,
 11    Field as _field,
 12    FluffyBuildNotify as _fluffy_build_notify,
 13    ManualClass as _manual_retry,
 14    MatrixClass as _matrix_class,
 15    NotifyEnum as _notify_enum,
 16    Option as _select_option,
 17    PurpleBuildNotify as _purple_build_notify,
 18    PurpleGithubCommitStatus as _purple_github_commit_status,
 19    PurpleSlack as _purple_slack,
 20    Retry as _retry,
 21    SignalReason as _signal_reason,
 22    Signature as _signature,
 23    SoftFailElement as _soft_fail,
 24    TentacledSlack as _tentacled_slack,
 25)
 26
 27BlockedStateEnum = _blocked_state
 28ConcurrencyMethod = _concurrency_method
 29ExitStatusEnum = _exit_status_enum
 30NotifyEnum = _notify_enum
 31SignalReasonEnum = _signal_reason
 32
 33
 34class Cache(_cache_class):
 35    def __init__(
 36        self,
 37        paths: List[str],
 38        name: Optional[str] = None,
 39        size: Optional[str] = None,
 40    ):
 41        super().__init__(name, paths, size)
 42
 43
 44class DependsOn(_depends_on_class):
 45    def __init__(
 46        self,
 47        step: str,
 48        allow_failure: Optional[bool] = None,
 49    ) -> None:
 50        super.__init__(
 51            self,
 52            allow_failure,
 53            step,
 54        )
 55
 56
 57class TextField(_field):
 58    def __init__(
 59        self,
 60        key: str,
 61        default: Optional[str] = None,
 62        hint: Optional[str] = None,
 63        required: Optional[bool] = None,
 64        text: Optional[str] = None,
 65    ) -> None:
 66        super().__init__(
 67            default=default,
 68            hint=hint,
 69            key=key,
 70            required=required,
 71            text=text,
 72            multiple=None,
 73            options=None,
 74            select=None,
 75            format=None,
 76        )
 77
 78
 79class SelectFieldOption(_select_option):
 80    def __init__(
 81        self,
 82        label: str,
 83        value: str,
 84        hint: Optional[str] = None,
 85        required: Optional[bool] = None,
 86    ):
 87        super().__init__(hint, label, required, value)
 88
 89
 90class SelectField(_field):
 91    def __init__(
 92        self,
 93        name: str,
 94        key: str,
 95        options: List[SelectFieldOption],
 96        default: Optional[str] = None,
 97        hint: Optional[str] = None,
 98        required: Optional[bool] = None,
 99        multiple: Optional[bool] = None,
100    ) -> None:
101        super().__init__(
102            default,
103            hint,
104            key,
105            required,
106            multiple,
107            options,
108            select=name,
109        )
110
111
112class SoftFail(_soft_fail):
113    def __init__(self, exit_status: Union[str, int]):
114        super().__init__(exit_status)
115
116
117class NotifySlack(_tentacled_slack):
118    def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None:
119        super().__init__(channels, message)
120
121    def _to_pipeline_notify(self) -> _purple_slack:
122        return _purple_slack(
123            channels=self.channels,
124            message=self.message,
125        )
126
127
128class StepNotify(_fluffy_build_notify):
129    def __init__(
130        self,
131        slack: Optional[Union[NotifySlack, str]],
132    ) -> None:
133        super().__init__(
134            slack,
135            basecamp_campfire=None,
136            build_notify_if=None,
137            github_commit_status=None,
138            github_check=None,
139            email=None,
140            webhook=None,
141            pagerduty_change_event=None,
142        )
143
144
145class NotifyGitHubCommitStatus(_purple_github_commit_status):
146    def __init__(self, context: Optional[str]):
147        super().__init__(context=context)
148
149
150class PipelineNotify(_purple_build_notify):
151    def __init__(
152        self,
153        email: Optional[str],
154        build_notify_if: Optional[str],
155        basecamp_campfire: Optional[str],
156        slack: Optional[NotifySlack],
157        webhook: Optional[str],
158        pagerduty_change_event: Optional[str],
159        github_commit_status: Optional[NotifyGitHubCommitStatus],
160        github_check: Optional[Dict[str, Any]],
161    ) -> None:
162        super().__init__(
163            email=email,
164            build_notify_if=build_notify_if,
165            basecamp_campfire=basecamp_campfire,
166            slack=slack._to_pipeline_notify(),
167            webhook=webhook,
168            pagerduty_change_event=pagerduty_change_event,
169            github_commit_status=github_commit_status,
170            github_check=github_check,
171        )
172
173
174# Matrix
175class MatrixAdjustment(_matrix_adjustment):
176    def __init__(
177        self,
178        adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]],
179        skip: Optional[bool] = None,
180        soft_fail: Optional[Union[SoftFail, bool]] = None,
181    ) -> None:
182        super().__init__(skip, soft_fail, adjustment_with)
183
184
185class MatrixAdvanced(_matrix_class):
186    def __init__(
187        self,
188        setup: Union[
189            List[Union[int, bool, str]], Dict[str, List[Union[int, bool, str]]]
190        ],
191        adjustments: Optional[List[MatrixAdjustment]] = None,
192    ) -> None:
193        super().__init__(adjustments, setup)
194
195
196# Retry
197class AutomaticRetry(_automatic_retry):
198    def __init__(
199        self,
200        exit_status: Optional[Union[int, List[int], ExitStatusEnum]] = None,
201        limit: Optional[int] = None,
202        signal: Optional[str] = None,
203        signal_reason: Optional[SignalReasonEnum] = None,
204    ) -> None:
205        super().__init__(exit_status, limit, signal, signal_reason)
206
207
208class ManualRetry(_manual_retry):
209    def __init__(
210        self,
211        allowed: Optional[bool] = None,
212        permit_on_passed: Optional[bool] = None,
213        reason: Optional[str] = None,
214    ) -> None:
215        super().__init__(allowed, permit_on_passed, reason)
216
217
218class Retry(_retry):
219    def __init__(
220        self,
221        automatic: Optional[Union[bool, AutomaticRetry, List[AutomaticRetry]]],
222        manual: Optional[Union[bool, ManualRetry]] = None,
223    ) -> None:
224        super().__init__(automatic, manual)
225
226
227# Signature
228class Signature(_signature):
229    def __init__(
230        self,
231        algorithm: Optional[str],
232        signed_fields: Optional[List[str]],
233        value: Optional[str],
234    ) -> None:
235        super().__init__(algorithm, signed_fields, value)
236
237
238# Build
239class Build(_build):
240    def __init__(
241        self,
242        branch: Optional[str],
243        commit: Optional[str],
244        env: Optional[Dict[str, Any]],
245        message: Optional[str],
246        meta_data: Optional[Dict[str, Any]],
247    ) -> None:
248        super().__init__(branch, commit, env, message, meta_data)
BlockedStateEnum = <enum 'BlockedState'>
class ConcurrencyMethod(enum.Enum):
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.

EAGER = <ConcurrencyMethod.EAGER: 'eager'>
ORDERED = <ConcurrencyMethod.ORDERED: 'ordered'>
class ExitStatusEnum(enum.Enum):
698class ExitStatusEnum(Enum):
699    EMPTY = "*"
EMPTY = <ExitStatusEnum.EMPTY: '*'>
class NotifyEnum(enum.Enum):
202class NotifyEnum(Enum):
203    GITHUB_CHECK = "github_check"
204    GITHUB_COMMIT_STATUS = "github_commit_status"
GITHUB_CHECK = <NotifyEnum.GITHUB_CHECK: 'github_check'>
GITHUB_COMMIT_STATUS = <NotifyEnum.GITHUB_COMMIT_STATUS: 'github_commit_status'>
SignalReasonEnum = <enum 'SignalReason'>
class Cache(buildkite_sdk.schema.CacheClass):
35class Cache(_cache_class):
36    def __init__(
37        self,
38        paths: List[str],
39        name: Optional[str] = None,
40        size: Optional[str] = None,
41    ):
42        super().__init__(name, paths, size)
Cache( paths: List[str], name: Optional[str] = None, size: Optional[str] = None)
36    def __init__(
37        self,
38        paths: List[str],
39        name: Optional[str] = None,
40        size: Optional[str] = None,
41    ):
42        super().__init__(name, paths, size)
class DependsOn(buildkite_sdk.schema.DependsOnClass):
45class DependsOn(_depends_on_class):
46    def __init__(
47        self,
48        step: str,
49        allow_failure: Optional[bool] = None,
50    ) -> None:
51        super.__init__(
52            self,
53            allow_failure,
54            step,
55        )
DependsOn(step: str, allow_failure: Optional[bool] = None)
46    def __init__(
47        self,
48        step: str,
49        allow_failure: Optional[bool] = None,
50    ) -> None:
51        super.__init__(
52            self,
53            allow_failure,
54            step,
55        )
class TextField(buildkite_sdk.schema.Field):
58class TextField(_field):
59    def __init__(
60        self,
61        key: str,
62        default: Optional[str] = None,
63        hint: Optional[str] = None,
64        required: Optional[bool] = None,
65        text: Optional[str] = None,
66    ) -> None:
67        super().__init__(
68            default=default,
69            hint=hint,
70            key=key,
71            required=required,
72            text=text,
73            multiple=None,
74            options=None,
75            select=None,
76            format=None,
77        )

A list of input fields required to be filled out before unblocking the step

TextField( key: str, default: Optional[str] = None, hint: Optional[str] = None, required: Optional[bool] = None, text: Optional[str] = None)
59    def __init__(
60        self,
61        key: str,
62        default: Optional[str] = None,
63        hint: Optional[str] = None,
64        required: Optional[bool] = None,
65        text: Optional[str] = None,
66    ) -> None:
67        super().__init__(
68            default=default,
69            hint=hint,
70            key=key,
71            required=required,
72            text=text,
73            multiple=None,
74            options=None,
75            select=None,
76            format=None,
77        )
class SelectFieldOption(buildkite_sdk.schema.Option):
80class SelectFieldOption(_select_option):
81    def __init__(
82        self,
83        label: str,
84        value: str,
85        hint: Optional[str] = None,
86        required: Optional[bool] = None,
87    ):
88        super().__init__(hint, label, required, value)
SelectFieldOption( label: str, value: str, hint: Optional[str] = None, required: Optional[bool] = None)
81    def __init__(
82        self,
83        label: str,
84        value: str,
85        hint: Optional[str] = None,
86        required: Optional[bool] = None,
87    ):
88        super().__init__(hint, label, required, value)
class SelectField(buildkite_sdk.schema.Field):
 91class SelectField(_field):
 92    def __init__(
 93        self,
 94        name: str,
 95        key: str,
 96        options: List[SelectFieldOption],
 97        default: Optional[str] = None,
 98        hint: Optional[str] = None,
 99        required: Optional[bool] = None,
100        multiple: Optional[bool] = None,
101    ) -> None:
102        super().__init__(
103            default,
104            hint,
105            key,
106            required,
107            multiple,
108            options,
109            select=name,
110        )

A list of input fields required to be filled out before unblocking the step

SelectField( name: str, key: str, options: List[SelectFieldOption], default: Optional[str] = None, hint: Optional[str] = None, required: Optional[bool] = None, multiple: Optional[bool] = None)
 92    def __init__(
 93        self,
 94        name: str,
 95        key: str,
 96        options: List[SelectFieldOption],
 97        default: Optional[str] = None,
 98        hint: Optional[str] = None,
 99        required: Optional[bool] = None,
100        multiple: Optional[bool] = None,
101    ) -> None:
102        super().__init__(
103            default,
104            hint,
105            key,
106            required,
107            multiple,
108            options,
109            select=name,
110        )
class SoftFail(buildkite_sdk.schema.SoftFailElement):
113class SoftFail(_soft_fail):
114    def __init__(self, exit_status: Union[str, int]):
115        super().__init__(exit_status)
SoftFail(exit_status: Union[str, int])
114    def __init__(self, exit_status: Union[str, int]):
115        super().__init__(exit_status)
class NotifySlack(buildkite_sdk.schema.TentacledSlack):
118class NotifySlack(_tentacled_slack):
119    def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None:
120        super().__init__(channels, message)
121
122    def _to_pipeline_notify(self) -> _purple_slack:
123        return _purple_slack(
124            channels=self.channels,
125            message=self.message,
126        )
NotifySlack(channels: Optional[List[str]], message: Optional[str])
119    def __init__(self, channels: Optional[List[str]], message: Optional[str]) -> None:
120        super().__init__(channels, message)
class StepNotify(buildkite_sdk.schema.FluffyBuildNotify):
129class StepNotify(_fluffy_build_notify):
130    def __init__(
131        self,
132        slack: Optional[Union[NotifySlack, str]],
133    ) -> None:
134        super().__init__(
135            slack,
136            basecamp_campfire=None,
137            build_notify_if=None,
138            github_commit_status=None,
139            github_check=None,
140            email=None,
141            webhook=None,
142            pagerduty_change_event=None,
143        )
StepNotify(slack: Union[NotifySlack, str, NoneType])
130    def __init__(
131        self,
132        slack: Optional[Union[NotifySlack, str]],
133    ) -> None:
134        super().__init__(
135            slack,
136            basecamp_campfire=None,
137            build_notify_if=None,
138            github_commit_status=None,
139            github_check=None,
140            email=None,
141            webhook=None,
142            pagerduty_change_event=None,
143        )
class NotifyGitHubCommitStatus(buildkite_sdk.schema.PurpleGithubCommitStatus):
146class NotifyGitHubCommitStatus(_purple_github_commit_status):
147    def __init__(self, context: Optional[str]):
148        super().__init__(context=context)
NotifyGitHubCommitStatus(context: Optional[str])
147    def __init__(self, context: Optional[str]):
148        super().__init__(context=context)
class PipelineNotify(buildkite_sdk.schema.PurpleBuildNotify):
151class PipelineNotify(_purple_build_notify):
152    def __init__(
153        self,
154        email: Optional[str],
155        build_notify_if: Optional[str],
156        basecamp_campfire: Optional[str],
157        slack: Optional[NotifySlack],
158        webhook: Optional[str],
159        pagerduty_change_event: Optional[str],
160        github_commit_status: Optional[NotifyGitHubCommitStatus],
161        github_check: Optional[Dict[str, Any]],
162    ) -> None:
163        super().__init__(
164            email=email,
165            build_notify_if=build_notify_if,
166            basecamp_campfire=basecamp_campfire,
167            slack=slack._to_pipeline_notify(),
168            webhook=webhook,
169            pagerduty_change_event=pagerduty_change_event,
170            github_commit_status=github_commit_status,
171            github_check=github_check,
172        )
PipelineNotify( email: Optional[str], build_notify_if: Optional[str], basecamp_campfire: Optional[str], slack: Optional[NotifySlack], webhook: Optional[str], pagerduty_change_event: Optional[str], github_commit_status: Optional[NotifyGitHubCommitStatus], github_check: Optional[Dict[str, Any]])
152    def __init__(
153        self,
154        email: Optional[str],
155        build_notify_if: Optional[str],
156        basecamp_campfire: Optional[str],
157        slack: Optional[NotifySlack],
158        webhook: Optional[str],
159        pagerduty_change_event: Optional[str],
160        github_commit_status: Optional[NotifyGitHubCommitStatus],
161        github_check: Optional[Dict[str, Any]],
162    ) -> None:
163        super().__init__(
164            email=email,
165            build_notify_if=build_notify_if,
166            basecamp_campfire=basecamp_campfire,
167            slack=slack._to_pipeline_notify(),
168            webhook=webhook,
169            pagerduty_change_event=pagerduty_change_event,
170            github_commit_status=github_commit_status,
171            github_check=github_check,
172        )
class MatrixAdjustment(buildkite_sdk.schema.Adjustment):
176class MatrixAdjustment(_matrix_adjustment):
177    def __init__(
178        self,
179        adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]],
180        skip: Optional[bool] = None,
181        soft_fail: Optional[Union[SoftFail, bool]] = None,
182    ) -> None:
183        super().__init__(skip, soft_fail, adjustment_with)

An adjustment to a Build Matrix

MatrixAdjustment( adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]], skip: Optional[bool] = None, soft_fail: Union[SoftFail, bool, NoneType] = None)
177    def __init__(
178        self,
179        adjustment_with: Union[List[Union[int, bool, str]], Dict[str, str]],
180        skip: Optional[bool] = None,
181        soft_fail: Optional[Union[SoftFail, bool]] = None,
182    ) -> None:
183        super().__init__(skip, soft_fail, adjustment_with)
class MatrixAdvanced(buildkite_sdk.schema.MatrixClass):
186class MatrixAdvanced(_matrix_class):
187    def __init__(
188        self,
189        setup: Union[
190            List[Union[int, bool, str]], Dict[str, List[Union[int, bool, str]]]
191        ],
192        adjustments: Optional[List[MatrixAdjustment]] = None,
193    ) -> None:
194        super().__init__(adjustments, setup)

Configuration for multi-dimension Build Matrix

MatrixAdvanced( setup: Union[List[Union[int, bool, str]], Dict[str, List[Union[int, bool, str]]]], adjustments: Optional[List[MatrixAdjustment]] = None)
187    def __init__(
188        self,
189        setup: Union[
190            List[Union[int, bool, str]], Dict[str, List[Union[int, bool, str]]]
191        ],
192        adjustments: Optional[List[MatrixAdjustment]] = None,
193    ) -> None:
194        super().__init__(adjustments, setup)
class AutomaticRetry(buildkite_sdk.schema.AutomaticRetry):
198class AutomaticRetry(_automatic_retry):
199    def __init__(
200        self,
201        exit_status: Optional[Union[int, List[int], ExitStatusEnum]] = None,
202        limit: Optional[int] = None,
203        signal: Optional[str] = None,
204        signal_reason: Optional[SignalReasonEnum] = None,
205    ) -> None:
206        super().__init__(exit_status, limit, signal, signal_reason)
AutomaticRetry( exit_status: Union[int, List[int], ExitStatusEnum, NoneType] = None, limit: Optional[int] = None, signal: Optional[str] = None, signal_reason: Optional[buildkite_sdk.schema.SignalReason] = None)
199    def __init__(
200        self,
201        exit_status: Optional[Union[int, List[int], ExitStatusEnum]] = None,
202        limit: Optional[int] = None,
203        signal: Optional[str] = None,
204        signal_reason: Optional[SignalReasonEnum] = None,
205    ) -> None:
206        super().__init__(exit_status, limit, signal, signal_reason)
class ManualRetry(buildkite_sdk.schema.ManualClass):
209class ManualRetry(_manual_retry):
210    def __init__(
211        self,
212        allowed: Optional[bool] = None,
213        permit_on_passed: Optional[bool] = None,
214        reason: Optional[str] = None,
215    ) -> None:
216        super().__init__(allowed, permit_on_passed, reason)
ManualRetry( allowed: Optional[bool] = None, permit_on_passed: Optional[bool] = None, reason: Optional[str] = None)
210    def __init__(
211        self,
212        allowed: Optional[bool] = None,
213        permit_on_passed: Optional[bool] = None,
214        reason: Optional[str] = None,
215    ) -> None:
216        super().__init__(allowed, permit_on_passed, reason)
class Retry(buildkite_sdk.schema.Retry):
219class Retry(_retry):
220    def __init__(
221        self,
222        automatic: Optional[Union[bool, AutomaticRetry, List[AutomaticRetry]]],
223        manual: Optional[Union[bool, ManualRetry]] = None,
224    ) -> None:
225        super().__init__(automatic, manual)

The conditions for retrying this step.

Retry( automatic: Union[bool, AutomaticRetry, List[AutomaticRetry], NoneType], manual: Union[bool, ManualRetry, NoneType] = None)
220    def __init__(
221        self,
222        automatic: Optional[Union[bool, AutomaticRetry, List[AutomaticRetry]]],
223        manual: Optional[Union[bool, ManualRetry]] = None,
224    ) -> None:
225        super().__init__(automatic, manual)
class Signature(buildkite_sdk.schema.Signature):
229class Signature(_signature):
230    def __init__(
231        self,
232        algorithm: Optional[str],
233        signed_fields: Optional[List[str]],
234        value: Optional[str],
235    ) -> None:
236        super().__init__(algorithm, signed_fields, value)

The signature of the command step, generally injected by agents at pipeline upload

Signature( algorithm: Optional[str], signed_fields: Optional[List[str]], value: Optional[str])
230    def __init__(
231        self,
232        algorithm: Optional[str],
233        signed_fields: Optional[List[str]],
234        value: Optional[str],
235    ) -> None:
236        super().__init__(algorithm, signed_fields, value)
class Build(buildkite_sdk.schema.Build):
240class Build(_build):
241    def __init__(
242        self,
243        branch: Optional[str],
244        commit: Optional[str],
245        env: Optional[Dict[str, Any]],
246        message: Optional[str],
247        meta_data: Optional[Dict[str, Any]],
248    ) -> None:
249        super().__init__(branch, commit, env, message, meta_data)

Properties of the build that will be created when the step is triggered

Build( branch: Optional[str], commit: Optional[str], env: Optional[Dict[str, Any]], message: Optional[str], meta_data: Optional[Dict[str, Any]])
241    def __init__(
242        self,
243        branch: Optional[str],
244        commit: Optional[str],
245        env: Optional[Dict[str, Any]],
246        message: Optional[str],
247        meta_data: Optional[Dict[str, Any]],
248    ) -> None:
249        super().__init__(branch, commit, env, message, meta_data)