aws_codeseeder.services.codebuild

Module Contents

Classes

BuildCloudWatchLogs

Typed version of namedtuple.

BuildInfo

Typed version of namedtuple.

BuildPhase

Typed version of namedtuple.

BuildPhaseContext

Typed version of namedtuple.

BuildPhaseStatus

Generic enumeration.

BuildPhaseType

Generic enumeration.

BuildStatus

Generic enumeration.

Functions

fetch_build_info(→ BuildInfo)

Fetch info on a CodeBuild execution

generate_spec(→ Dict[str, Any])

Generate a BuildSpec for a CodeBuild execution

start(→ str)

Start a CodeBuild Project execution

wait(→ Iterable[BuildInfo])

Wait for completion of a CodeBuild execution

class aws_codeseeder.services.codebuild.BuildCloudWatchLogs

Bases: NamedTuple

Typed version of namedtuple.

Usage in Python versions >= 3.6:

class Employee(NamedTuple):
    name: str
    id: int

This is equivalent to:

Employee = collections.namedtuple('Employee', ['name', 'id'])

The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:

Employee = NamedTuple('Employee', name=str, id=int)

In Python versions <= 3.5 use:

Employee = NamedTuple('Employee', [('name', str), ('id', int)])
enabled: bool
group_name: Optional[str]
stream_name: Optional[str]
class aws_codeseeder.services.codebuild.BuildInfo

Bases: NamedTuple

Typed version of namedtuple.

Usage in Python versions >= 3.6:

class Employee(NamedTuple):
    name: str
    id: int

This is equivalent to:

Employee = collections.namedtuple('Employee', ['name', 'id'])

The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:

Employee = NamedTuple('Employee', name=str, id=int)

In Python versions <= 3.5 use:

Employee = NamedTuple('Employee', [('name', str), ('id', int)])
build_id: str
current_phase: BuildPhaseType
duration_in_seconds: float
end_time: Optional[datetime.datetime]
exported_env_vars: Dict[str, str]
logs: BuildCloudWatchLogs
phases: List[BuildPhase]
start_time: datetime.datetime
status: BuildStatus
class aws_codeseeder.services.codebuild.BuildPhase

Bases: NamedTuple

Typed version of namedtuple.

Usage in Python versions >= 3.6:

class Employee(NamedTuple):
    name: str
    id: int

This is equivalent to:

Employee = collections.namedtuple('Employee', ['name', 'id'])

The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:

Employee = NamedTuple('Employee', name=str, id=int)

In Python versions <= 3.5 use:

Employee = NamedTuple('Employee', [('name', str), ('id', int)])
contexts: List[BuildPhaseContext]
duration_in_seconds: float
end_time: Optional[datetime.datetime]
phase_type: BuildPhaseType
start_time: datetime.datetime
status: Optional[BuildPhaseStatus]
class aws_codeseeder.services.codebuild.BuildPhaseContext

Bases: NamedTuple

Typed version of namedtuple.

Usage in Python versions >= 3.6:

class Employee(NamedTuple):
    name: str
    id: int

This is equivalent to:

Employee = collections.namedtuple('Employee', ['name', 'id'])

The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:

Employee = NamedTuple('Employee', name=str, id=int)

In Python versions <= 3.5 use:

Employee = NamedTuple('Employee', [('name', str), ('id', int)])
message: Optional[str]
status_code: Optional[str]
class aws_codeseeder.services.codebuild.BuildPhaseStatus

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

failed = 'FAILED'
fault = 'FAULT'
in_progress = 'IN_PROGRESS'
queued = 'QUEUED'
stopped = 'STOPPED'
succeeded = 'SUCCEEDED'
timed_out = 'TIMED_OUT'
class aws_codeseeder.services.codebuild.BuildPhaseType

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

build = 'BUILD'
completed = 'COMPLETED'
download_source = 'DOWNLOAD_SOURCE'
finalizing = 'FINALIZING'
install = 'INSTALL'
post_build = 'POST_BUILD'
pre_build = 'PRE_BUILD'
provisioning = 'PROVISIONING'
queued = 'QUEUED'
submitted = 'SUBMITTED'
upload_artifacts = 'UPLOAD_ARTIFACTS'
class aws_codeseeder.services.codebuild.BuildStatus

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

failed = 'FAILED'
fault = 'FAULT'
in_progress = 'IN_PROGRESS'
stopped = 'STOPPED'
succeeded = 'SUCCEEDED'
timed_out = 'TIMED_OUT'
aws_codeseeder.services.codebuild.fetch_build_info(build_id: str, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) BuildInfo

Fetch info on a CodeBuild execution

Parameters
  • build_id (str) – CodeBuild Execution/Build Id

  • session (Optional[Union[Callable[[], Session], Session]], optional) – Optional Session or function returning a Session to use for all boto3 operations, by default None

Returns

Info on the CodeBuild execution

Return type

BuildInfo

Raises

RuntimeError – If the Build Id is not found

aws_codeseeder.services.codebuild.generate_spec(stack_outputs: Dict[str, str], cmds_install: Optional[List[str]] = None, cmds_pre: Optional[List[str]] = None, cmds_build: Optional[List[str]] = None, cmds_post: Optional[List[str]] = None, env_vars: Optional[Dict[str, str]] = None, exported_env_vars: Optional[List[str]] = None, runtime_versions: Optional[Dict[str, str]] = None, abort_phases_on_failure: bool = True, pypi_mirror: Optional[str] = None, npm_mirror: Optional[str] = None) Dict[str, Any]

Generate a BuildSpec for a CodeBuild execution

Parameters
  • stack_outputs (Dict[str, str]) – The CloudFormation Stack Outputs from the Seedkit Stack where the CodeBuild Project was created

  • cmds_install (Optional[List[str]], optional) – Additional commands to run during the Install phase of the CodeBuild execution, by default None

  • cmds_pre (Optional[List[str]], optional) – Additional commands to run during the PreBuild phase of the CodeBuild execution, by default None

  • cmds_build (Optional[List[str]], optional) – Additional commands to run during the Build phase of the CodeBuild execution, by default None

  • cmds_post (Optional[List[str]], optional) – Additional commands to run during the PostBuild phase of the CodeBuild execution, by default None

  • env_vars (Optional[Dict[str, str]], optional) – Environment variables to set in the CodeBuild execution, by default None

  • exported_env_vars (Optional[List[str]], optional) – Environment variables to export from the CodeBuild execution, by default None

  • pypi_mirror (Optional[str], optional) – Pypi mirror to use, by default None

  • npm_mirror (Optional[str], optional) – NPM mirror to use, by default None

Returns

A CodeBuild BuildSpec

Return type

Dict[str, Any]

aws_codeseeder.services.codebuild.start(project_name: str, stream_name: str, bundle_location: str, buildspec: Dict[str, Any], timeout: int, overrides: Optional[Dict[str, Any]] = None, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) str

Start a CodeBuild Project execution

Parameters
  • project_name (str) – Name of the CodeBuild Project

  • stream_name (str) – Name of the CloudWatch Logs Stream to read CodeBuild logs from

  • bundle_location (str) – S3 Location of the zip bundle to use as Source to the CodeBuild execution

  • buildspec (Dict[str, Any]) – BuildSpec to use for the CodeBuild execution

  • timeout (int) – Timeout of the CodeBuild execution

  • overrides (Optional[Dict[str, Any]], optional) – Additional overrides to set on the CodeBuild execution, by default None

  • session (Optional[Union[Callable[[], Session], Session]], optional) – Optional Session or function returning a Session to use for all boto3 operations, by default None

Returns

The CodeBuild Build/Exectuion Id

Return type

str

aws_codeseeder.services.codebuild.wait(build_id: str, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) Iterable[BuildInfo]

Wait for completion of a CodeBuild execution

Parameters
  • build_id (str) – The CodeBuild Execution/Build Id

  • session (Optional[Union[Callable[[], Session], Session]], optional) – Optional Session or function returning a Session to use for all boto3 operations, by default None

Returns

Info on the CodeBuild execution

Return type

Iterable[BuildInfo]

Yields

Iterator[Iterable[BuildInfo]] – Info on the CodeBuild execution

Raises

RuntimeError – If the CodeBuild doesn’t succeed