:py:mod:`aws_codeseeder.services.codebuild` =========================================== .. py:module:: aws_codeseeder.services.codebuild Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: aws_codeseeder.services.codebuild.BuildCloudWatchLogs aws_codeseeder.services.codebuild.BuildInfo aws_codeseeder.services.codebuild.BuildPhase aws_codeseeder.services.codebuild.BuildPhaseContext aws_codeseeder.services.codebuild.BuildPhaseStatus aws_codeseeder.services.codebuild.BuildPhaseType aws_codeseeder.services.codebuild.BuildStatus Functions ~~~~~~~~~ .. autoapisummary:: aws_codeseeder.services.codebuild.fetch_build_info aws_codeseeder.services.codebuild.generate_spec aws_codeseeder.services.codebuild.start aws_codeseeder.services.codebuild.wait .. py:class:: BuildCloudWatchLogs Bases: :py:obj:`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)]) .. py:attribute:: enabled :type: bool .. py:attribute:: group_name :type: Optional[str] .. py:attribute:: stream_name :type: Optional[str] .. py:class:: BuildInfo Bases: :py:obj:`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)]) .. py:attribute:: build_id :type: str .. py:attribute:: current_phase :type: BuildPhaseType .. py:attribute:: duration_in_seconds :type: float .. py:attribute:: end_time :type: Optional[datetime.datetime] .. py:attribute:: exported_env_vars :type: Dict[str, str] .. py:attribute:: logs :type: BuildCloudWatchLogs .. py:attribute:: phases :type: List[BuildPhase] .. py:attribute:: start_time :type: datetime.datetime .. py:attribute:: status :type: BuildStatus .. py:class:: BuildPhase Bases: :py:obj:`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)]) .. py:attribute:: contexts :type: List[BuildPhaseContext] .. py:attribute:: duration_in_seconds :type: float .. py:attribute:: end_time :type: Optional[datetime.datetime] .. py:attribute:: phase_type :type: BuildPhaseType .. py:attribute:: start_time :type: datetime.datetime .. py:attribute:: status :type: Optional[BuildPhaseStatus] .. py:class:: BuildPhaseContext Bases: :py:obj:`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)]) .. py:attribute:: message :type: Optional[str] .. py:attribute:: status_code :type: Optional[str] .. py:class:: BuildPhaseStatus Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: failed :value: 'FAILED' .. py:attribute:: fault :value: 'FAULT' .. py:attribute:: in_progress :value: 'IN_PROGRESS' .. py:attribute:: queued :value: 'QUEUED' .. py:attribute:: stopped :value: 'STOPPED' .. py:attribute:: succeeded :value: 'SUCCEEDED' .. py:attribute:: timed_out :value: 'TIMED_OUT' .. py:class:: BuildPhaseType Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: build :value: 'BUILD' .. py:attribute:: completed :value: 'COMPLETED' .. py:attribute:: download_source :value: 'DOWNLOAD_SOURCE' .. py:attribute:: finalizing :value: 'FINALIZING' .. py:attribute:: install :value: 'INSTALL' .. py:attribute:: post_build :value: 'POST_BUILD' .. py:attribute:: pre_build :value: 'PRE_BUILD' .. py:attribute:: provisioning :value: 'PROVISIONING' .. py:attribute:: queued :value: 'QUEUED' .. py:attribute:: submitted :value: 'SUBMITTED' .. py:attribute:: upload_artifacts :value: 'UPLOAD_ARTIFACTS' .. py:class:: BuildStatus Bases: :py:obj:`enum.Enum` Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: failed :value: 'FAILED' .. py:attribute:: fault :value: 'FAULT' .. py:attribute:: in_progress :value: 'IN_PROGRESS' .. py:attribute:: stopped :value: 'STOPPED' .. py:attribute:: succeeded :value: 'SUCCEEDED' .. py:attribute:: timed_out :value: 'TIMED_OUT' .. py:function:: fetch_build_info(build_id: str, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) -> BuildInfo Fetch info on a CodeBuild execution :param build_id: CodeBuild Execution/Build Id :type build_id: str :param session: Optional Session or function returning a Session to use for all boto3 operations, by default None :type session: Optional[Union[Callable[[], Session], Session]], optional :returns: Info on the CodeBuild execution :rtype: BuildInfo :raises RuntimeError: If the Build Id is not found .. py:function:: 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 :param stack_outputs: The CloudFormation Stack Outputs from the Seedkit Stack where the CodeBuild Project was created :type stack_outputs: Dict[str, str] :param cmds_install: Additional commands to run during the Install phase of the CodeBuild execution, by default None :type cmds_install: Optional[List[str]], optional :param cmds_pre: Additional commands to run during the PreBuild phase of the CodeBuild execution, by default None :type cmds_pre: Optional[List[str]], optional :param cmds_build: Additional commands to run during the Build phase of the CodeBuild execution, by default None :type cmds_build: Optional[List[str]], optional :param cmds_post: Additional commands to run during the PostBuild phase of the CodeBuild execution, by default None :type cmds_post: Optional[List[str]], optional :param env_vars: Environment variables to set in the CodeBuild execution, by default None :type env_vars: Optional[Dict[str, str]], optional :param exported_env_vars: Environment variables to export from the CodeBuild execution, by default None :type exported_env_vars: Optional[List[str]], optional :param pypi_mirror: Pypi mirror to use, by default None :type pypi_mirror: Optional[str], optional :param npm_mirror: NPM mirror to use, by default None :type npm_mirror: Optional[str], optional :returns: A CodeBuild BuildSpec :rtype: Dict[str, Any] .. py:function:: 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 :param project_name: Name of the CodeBuild Project :type project_name: str :param stream_name: Name of the CloudWatch Logs Stream to read CodeBuild logs from :type stream_name: str :param bundle_location: S3 Location of the zip bundle to use as Source to the CodeBuild execution :type bundle_location: str :param buildspec: BuildSpec to use for the CodeBuild execution :type buildspec: Dict[str, Any] :param timeout: Timeout of the CodeBuild execution :type timeout: int :param overrides: Additional overrides to set on the CodeBuild execution, by default None :type overrides: Optional[Dict[str, Any]], optional :param session: Optional Session or function returning a Session to use for all boto3 operations, by default None :type session: Optional[Union[Callable[[], Session], Session]], optional :returns: The CodeBuild Build/Exectuion Id :rtype: str .. py:function:: wait(build_id: str, session: Optional[Union[Callable[[], boto3.Session], boto3.Session]] = None) -> Iterable[BuildInfo] Wait for completion of a CodeBuild execution :param build_id: The CodeBuild Execution/Build Id :type build_id: str :param session: Optional Session or function returning a Session to use for all boto3 operations, by default None :type session: Optional[Union[Callable[[], Session], Session]], optional :returns: Info on the CodeBuild execution :rtype: Iterable[BuildInfo] :Yields: *Iterator[Iterable[BuildInfo]]* -- Info on the CodeBuild execution :raises RuntimeError: If the CodeBuild doesn't succeed