UNPKG

aws-delivlib

Version:

A fabulous library for defining continuous pipelines for building, testing and releasing code libraries.

115 lines (114 loc) 3.45 kB
/** * Class to model a buildspec version 0.2 * * Artifact handling is a little special: CodeBuild will interpret the * 'artifacts' section differently depending on whether there are secondary * artifacts or not. * * If there is only one artifact, the single artifact must go into the top-level * 'artifacts' section. If there are multiple artifacts, all of them must go * into the 'secondary-artifacts' section. Upon rendering to JSON, the caller * must supply the name of the primary artifact (it's determined by * the CodePipeline Action that invokes the CodeBuild Project that uses this * buildspec). * * INVARIANT: in-memory, the BuildSpec will treat all artifacts the same (as * a bag of secondary artifacts). At the edges (construction or rendering), * if there's only a single artifact it will be rendered to the primary * artifact. */ export declare class BuildSpec { private readonly spec; static literal(struct: BuildSpecStruct): BuildSpec; static simple(props: SimpleBuildSpecProps): BuildSpec; static empty(): BuildSpec; private constructor(); get additionalArtifactNames(): string[]; merge(other: BuildSpec): BuildSpec; render(options?: BuildSpecRenderOptions): BuildSpecStruct; private renderArtifacts; } export interface SimpleBuildSpecProps { install?: string[]; preBuild?: string[]; build?: string[]; reports?: { [key: string]: ReportStruct; }; artifactDirectory?: string; /** * Where the directories for each artifact are * * Use special name PRIMARY to refer to the primary artifact. Will be * replaced with the actual artifact name when the build spec is synthesized. */ additionalArtifactDirectories?: { [id: string]: string; }; } export interface BuildSpecStruct { 'version': '0.2'; 'run-as'?: string; 'env'?: EnvStruct; 'phases'?: { install?: InstallPhaseStruct; pre_build?: PhaseStruct; build?: PhaseStruct; post_build?: PhaseStruct; }; 'artifacts'?: PrimaryArtifactStruct; 'cache'?: CacheStruct; 'reports'?: { [key: string]: ReportStruct; }; } export interface EnvStruct { 'variables'?: { [key: string]: string; }; 'parameter-store'?: { [key: string]: string; }; 'exported-variables'?: string[]; } export interface PhaseStruct { 'run-as'?: string; 'on-failure'?: string; 'commands': string[]; 'finally'?: string[]; } export interface InstallPhaseStruct extends PhaseStruct { 'runtime-versions'?: { [key: string]: string; }; } export interface ReportStruct { 'files'?: string[]; 'base-directory'?: string; 'discard-paths'?: 'yes' | 'no'; 'file-format'?: 'CucumberJson' | 'JunitXml' | 'NunitXml' | 'TestNGXml' | 'VisualStudioTrx'; } export interface ArtifactStruct { 'files'?: string[]; 'name'?: string; 'base-directory'?: string; 'discard-paths'?: 'yes' | 'no'; } export interface PrimaryArtifactStruct extends ArtifactStruct { 'secondary-artifacts'?: { [key: string]: ArtifactStruct; }; } export interface CacheStruct { paths: string[]; } export interface BuildSpecRenderOptions { /** * Replace PRIMARY artifact name with this * * Cannot use the special term PRIMARY if this is not supplied. * * @default Cannot use PRIMARY */ primaryArtifactName?: string; }