Skip to content

Commit

Permalink
feat(aws-codepipeline): rename actionRole to role (breaking)
Browse files Browse the repository at this point in the history
Renames previously introduced actionRole to role,
as it’s more generic name.

This commit has been extracted, as during development
the existing `role` attribute present on some classes
has been renamed to `deploymentRole`. Splitting
change to two separate commits helped coding bugs
related to name clash.

BREAKING CHANGE: together with previous commits `role` has been refactored to
`deploymentRole`
  • Loading branch information
Radoslaw Smogura committed Jan 8, 2019
1 parent ebbcd65 commit 1b77cdc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codedeploy/test/test.pipeline-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export = {
_generateOutputArtifactName: () => 'DeployOut'
}
},
actionRole: iam.Role.import(app.stack, 'Role', {
role: iam.Role.import(app.stack, 'Role', {
roleArn: 'arn:aws:iam::123456789012:role/superUser'
}),
deploymentGroup: new ServerDeploymentGroup(app.stack, 'DeployGroup', {
Expand All @@ -50,7 +50,7 @@ export = {
});

test.equals(action.runOrder, 456);
test.equals(action.actionRole!.roleArn, 'arn:aws:iam::123456789012:role/superUser');
test.equals(action.role!.roleArn, 'arn:aws:iam::123456789012:role/superUser');
test.done();
}
};
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-codepipeline-api/lib/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export interface CommonActionProps {
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html
*/
actionRole?: iam.IRole;
role?: iam.IRole;
}

/**
Expand Down Expand Up @@ -221,7 +221,7 @@ export abstract class Action extends cdk.Construct {
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html
*/
public readonly actionRole?: iam.IRole;
public readonly role?: iam.IRole;

/**
* The order in which AWS CodePipeline runs this action.
Expand Down Expand Up @@ -254,7 +254,7 @@ export abstract class Action extends cdk.Construct {
this.artifactBounds = props.artifactBounds;
this.runOrder = props.runOrder === undefined ? 1 : props.runOrder;
this.stage = props.stage;
this.actionRole = props.actionRole;
this.role = props.role;

this.stage._internal._attachAction(this);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codepipeline/lib/stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class Stage extends cdk.Construct implements cpapi.IStage, cpapi.IInterna
configuration: action.configuration,
outputArtifacts: action._outputArtifacts.map(a => ({ name: a.name })),
runOrder: action.runOrder,
roleArn: action.actionRole ? action.actionRole.roleArn : undefined
roleArn: action.role ? action.role.roleArn : undefined
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ new cloudformation.PipelineCreateUpdateStackAction(stack, 'CFN_Deploy', {
stackName: 'aws-cdk-codepipeline-cross-region-deploy-stack',
templatePath: sourceAction.outputArtifact.atPath('template.yml'),
adminPermissions: false,
actionRole: role
role
});

pipeline.addToRolePolicy(new iam.PolicyStatement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,14 @@ export = {
});

new PipelineExecuteChangeSetAction(stack.pipeline, 'ImportedRoleAction', {
actionRole: importedRole,
role: importedRole,
changeSetName: 'magicSet',
stackName: 'magicStack',
stage: stack.deployStage
});

new PipelineExecuteChangeSetAction(stack.pipeline, 'FreshRoleAction', {
actionRole: freshRole,
role: freshRole,
changeSetName: 'magicSet',
stackName: 'magicStack',
stage: stack.deployStage
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export = {
oauthToken: secret.value,
owner: 'foo',
repo: 'bar',
actionRole: role
role
});

const s2 = new codepipeline.Stage(stack, 'Two', { pipeline: p });
Expand Down Expand Up @@ -304,7 +304,7 @@ export = {
stage,
lambda: lambdaFun,
userParameters: 'foo-bar/42',
actionRole: role,
role,
inputArtifacts: [
source2.outputArtifact,
source1.outputArtifact,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/lib/pipeline-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class PipelineInvokeAction extends codepipeline.Action {
constructor(scope: cdk.Construct, id: string, props: PipelineInvokeActionProps) {
super(scope, id, {
stage: props.stage,
actionRole: props.actionRole,
role: props.role,
runOrder: props.runOrder,
category: codepipeline.ActionCategory.Invoke,
provider: 'Lambda',
Expand Down

0 comments on commit 1b77cdc

Please sign in to comment.