UNPKG

aws-delivlib

Version:

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

95 lines (94 loc) 3.21 kB
import { aws_codebuild as codebuild } from 'aws-cdk-lib'; import { Construct } from 'constructs'; export interface MirrorSourceBindOptions { /** * The target ECR registry */ readonly ecrRegistry: string; /** * The scope to attach any constructs that may also be needed. */ readonly scope: Construct; /** * The CodeBuild project that will run the synchronization between DockerHub and ECR. * @default - either no sync job is present or it's not defined yet. */ readonly syncJob?: codebuild.IProject; } export interface MirrorSourceConfig { /** * The commands to run to retrieve the docker image. * e.g. ['docker pull <image-id>'] */ readonly commands: string[]; /** * The name of the target ECR repository. */ readonly repositoryName: string; /** * The tag to be use for the target ECR image. */ readonly tag: string; } /** Additional options when configuring a Mirror Source from a local directory */ export interface MirrorSourceDirectoryOptions { /** * Tag of the built image. * @default 'latest' */ readonly tag?: string; /** * Build args to pass to the `docker build` command. * * @default - no build args are passed */ readonly buildArgs?: { [key: string]: string; }; } /** * Source of the image. */ export declare abstract class MirrorSource { protected readonly repositoryName: string; protected readonly tag: string; protected readonly directory?: string | undefined; protected readonly ecrRepositoryName: string; /** * Configure an image from DockerHub. * * @param image e.g jsii/superchain * @param tag optional, defaults to 'latest' * * @deprecated This method's name inaccurately expresses that the image comes * from DockerHub, when any publicly-accessible repository can be used. Prefer * using `fromImageName(string, string?)` instead, which is more aptly named. */ static fromDockerHub(image: string, tag?: string): MirrorSource; /** * Configure an image from DockerHub or a repository-qualified image name. * * @param image e.g public.ecr.aws/jsii/superchain * @param tag optional, defaults to 'latest' * @param ecrRepositoryName the name of the ECR Repository to use (e.g: jsii/superchain) */ static fromPublicImage(image: string, tag?: string, ecrRepositoryName?: string): MirrorSource; /** * DEPRECATED * @deprecated use fromDir() */ static fromDirectory(directory: string, repositoryName: string, tag?: string): MirrorSource; /** * Configure an image from a local directory. * * @param directory Path to directory containing the Dockerfile. * @param repositoryName Repository name of the built image. * @param options additional configuration options */ static fromDir(directory: string, repositoryName: string, opts?: MirrorSourceDirectoryOptions): MirrorSource; private constructor(); /** * Bind the source with the EcrMirror construct. */ abstract bind(options: MirrorSourceBindOptions): MirrorSourceConfig; }