Skip to content
v2.273.0

EcrBuildAndPublishActionProps Struct ​

Construction properties of the EcrBuildAndPublishAction.

Example ​

ts
import * as ecr from 'aws-cdk-lib/aws-ecr';

declare const pipeline: codepipeline.Pipeline;
declare const repository: ecr.IRepository;

const sourceOutput = new codepipeline.Artifact();
// your source repository
const sourceAction = new codepipeline_actions.CodeStarConnectionsSourceAction({
  actionName: 'CodeStarConnectionsSourceAction',
  output: sourceOutput,
  connectionArn: 'your-connection-arn',
  owner: 'your-owner',
  repo: 'your-repo',
});

const buildAction = new codepipeline_actions.EcrBuildAndPublishAction({
  actionName: 'EcrBuildAndPublishAction',
  repositoryName: repository.repositoryName,
  registryType: codepipeline_actions.RegistryType.PRIVATE,
  dockerfileDirectoryPath: './my-dir', // The path indicates ./my-dir/Dockerfile in the source repository
  imageTags: ['my-tag-1', 'my-tag-2'],
  input: sourceOutput,
});

pipeline.addStage({
  stageName: 'Source',
  actions: [sourceAction],
});
pipeline.addStage({
  stageName: 'Build',
  actions: [buildAction],
});

Properties ​

actionNamestringaction_namestractionNameStringActionNamestringActionName*stringrequired#
The physical, human-readable name of the Action.

Note that Action names must be unique within a single Stage.

dockerfileDirectoryPathstringdockerfile_directory_pathstrdockerfileDirectoryPathStringDockerfileDirectoryPathstringDockerfileDirectoryPath*string= the source repository root level#
The directory path of Dockerfile used to build the image.

Optionally, you can provide an alternate directory path if Dockerfile is not at the root level.

imageTagsstring[]image_tagstyping.List[str]imageTagsList<String>ImageTagsstring[]ImageTags*[]*string= latest#
The tags used for the image.
inputArtifactinputArtifactinputArtifactInputArtifactInputArtifactrequired#
The artifact produced by the source action that contains the Dockerfile needed to build the image.
registryTypeRegistryTyperegistry_typeRegistryTyperegistryTypeRegistryTypeRegistryTypeRegistryTypeRegistryTypeRegistryType= RegistryType.PRIVATE#
Specifies whether the repository is public or private.
repositoryNamestringrepository_namestrrepositoryNameStringRepositoryNamestringRepositoryName*stringrequired#
The name of the ECR repository where the image is pushed.
roleIRoleroleIRoleroleIRoleRoleIRoleRoleIRole= a new Role will be generated#
The Role in which context's this Action will be executing in.
notes

The Pipeline's Role will assume this Role (the required permissions for that will be granted automatically) right before executing this Action. This Action will be passed into your IAction.bind method in the ActionBindOptions.role property.

runOrdernumberrun_orderint | floatrunOrderNumberRunOrderdoubleRunOrder*float64= 1#
The runOrder property for this Action.

RunOrder determines the relative order in which multiple Actions in the same Stage execute.

variablesNamespacestringvariables_namespacestrvariablesNamespaceStringVariablesNamespacestringVariablesNamespace*string= a name will be generated, based …#
The name of the namespace to use for variables emitted by this action.
default

Default: a name will be generated, based on the stage and action names, if any of the action's variables were referenced - otherwise, no namespace will be set

Used as props by ​