Skip to content

Commit

Permalink
feat(aws-codebuild): rename the Project methods for adding Actions to…
Browse files Browse the repository at this point in the history
… CodePipeline. (#1254)

BREAKING CHANGE: `addBuildToPipeline` was renamed to `addToPipeline` 
and `addTestToPipeline` was renamed to `addPipelineToTest` in order to align 
with naming conventions.

Fixes #1211
  • Loading branch information
skinny85 authored Nov 28, 2018
1 parent edc9a21 commit 825e448
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-codebuild/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ You can also add the Project to the Pipeline directly:
```ts
// equivalent to the code above:
const buildAction = project.addBuildToPipeline(buildStage, 'CodeBuild');
const buildAction = project.addToPipeline(buildStage, 'CodeBuild');
```
In addition to the build Action,
Expand All @@ -100,7 +100,7 @@ new codebuild.PipelineTestAction(this, 'IntegrationTest', {
});

// equivalent to the code above:
project.addTestToPipeline(buildStage, 'IntegrationTest', {
project.addToPipelineAsTest(buildStage, 'IntegrationTest', {
// of course, this property is optional here as well
outputArtifactName: 'IntegrationTestOutput',
});
Expand Down Expand Up @@ -206,7 +206,7 @@ const sourceAction2 = repository2.addToPipeline(sourceStage, 'Source2', {
});

const buildStage = pipeline.addStage('Build');
const buildAction = project.addBuildToPipeline(buildStage, 'Build', {
const buildAction = project.addToPipeline(buildStage, 'Build', {
inputArtifact: sourceAction1.outputArtifact,
outputArtifactName: 'artifact1', // for better buildspec readability - see below
additionalInputArtifacts: [
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codebuild/lib/pipeline-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface CommonCodeBuildActionProps {
/**
* Common properties for creating {@link PipelineBuildAction} -
* either directly, through its constructor,
* or through {@link ProjectRef#addBuildToPipeline}.
* or through {@link ProjectRef#addToPipeline}.
*/
export interface CommonPipelineBuildActionProps extends CommonCodeBuildActionProps,
codepipeline.CommonActionProps {
Expand Down Expand Up @@ -109,7 +109,7 @@ export class PipelineBuildAction extends codepipeline.BuildAction {
/**
* Common properties for creating {@link PipelineTestAction} -
* either directly, through its constructor,
* or through {@link ProjectRef#addTestToPipeline}.
* or through {@link ProjectRef#addToPipelineAsTest}.
*/
export interface CommonPipelineTestActionProps extends CommonCodeBuildActionProps,
codepipeline.CommonActionProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codebuild/lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export abstract class ProjectRef extends cdk.Construct implements events.IEventR
* @param props the properties of the new Action
* @returns the newly created {@link PipelineBuildAction} build Action
*/
public addBuildToPipeline(stage: codepipeline.IStage, name: string, props: CommonPipelineBuildActionProps = {}): PipelineBuildAction {
public addToPipeline(stage: codepipeline.IStage, name: string, props: CommonPipelineBuildActionProps = {}): PipelineBuildAction {
return new PipelineBuildAction(this, name, {
stage,
project: this,
Expand All @@ -109,7 +109,7 @@ export abstract class ProjectRef extends cdk.Construct implements events.IEventR
* @param props the properties of the new Action
* @returns the newly created {@link PipelineBuildAction} test Action
*/
public addTestToPipeline(stage: codepipeline.IStage, name: string, props: CommonPipelineTestActionProps = {}): PipelineTestAction {
public addToPipelineAsTest(stage: codepipeline.IStage, name: string, props: CommonPipelineTestActionProps = {}): PipelineTestAction {
return new PipelineTestAction(this, name, {
stage,
project: this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const sourceAction2 = bucket.addToPipeline(sourceStage, 'Source2', {

const project = new codebuild.PipelineProject(stack, 'MyBuildProject');
const buildStage = pipeline.addStage('Build');
const buildAction = project.addBuildToPipeline(buildStage, 'Build1', {
const buildAction = project.addToPipeline(buildStage, 'Build1', {
inputArtifact: sourceAction1.outputArtifact,
additionalInputArtifacts: [
sourceAction2.outputArtifact,
Expand All @@ -36,7 +36,7 @@ const buildAction = project.addBuildToPipeline(buildStage, 'Build1', {
'CustomOutput1',
],
});
const testAction = project.addTestToPipeline(buildStage, 'Build2', {
const testAction = project.addToPipelineAsTest(buildStage, 'Build2', {
inputArtifact: sourceAction2.outputArtifact,
additionalInputArtifacts: [
sourceAction1.outputArtifact,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const project = new codebuild.Project(stack, 'MyBuildProject', {
});

const buildStage = new codepipeline.Stage(pipeline, 'build', { pipeline });
project.addBuildToPipeline(buildStage, 'build');
project.addTestToPipeline(buildStage, 'test');
project.addToPipeline(buildStage, 'build');
project.addToPipelineAsTest(buildStage, 'test');

app.run();
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codepipeline/test/test.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export = {

const project = new codebuild.PipelineProject(stack, 'Project');
const buildStage = pipeline.addStage('Build');
project.addBuildToPipeline(buildStage, 'CodeBuild');
project.addToPipeline(buildStage, 'CodeBuild');

expect(stack).to(haveResource('AWS::CodePipeline::Pipeline', {
"Stages": [
Expand Down

0 comments on commit 825e448

Please sign in to comment.