Skip to content

Commit 557eebc

Browse files
committed
Fix: Update index.js
1 parent 2765b5f commit 557eebc

File tree

6 files changed

+22
-33
lines changed
  • packages

6 files changed

+22
-33
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-stage-conditions.js.snapshot/asset.97484721f29e34bf38d7a459804dd2d2a8dea6f8c27d7531e215bf4274fbc895.bundle/index.js

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/aws-cdk-lib/aws-codepipeline/lib/pipeline.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,16 +1002,21 @@ export class Pipeline extends PipelineBase {
10021002
* @param action the action to return/create a role for
10031003
* @param actionScope the scope, unique to the action, to create new resources in
10041004
*/
1005+
10051006
private getRoleForAction(stage: Stage, action: RichAction, actionScope: Construct): iam.IRole | undefined {
10061007
const pipelineStack = Stack.of(this);
10071008

10081009
let actionRole = this.getRoleFromActionPropsOrGenerateIfCrossAccount(stage, action);
10091010

10101011
if (!actionRole && this.isAwsOwned(action)) {
10111012
// generate a Role for this specific Action
1012-
actionRole = new iam.Role(actionScope, 'CodePipelineActionRole', {
1013+
const isRemoveRootPrincipal = FeatureFlags.of(this).isEnabled(cxapi.PIPELINE_REDUCE_STAGE_ROLE_TRUST_SCOPE);
1014+
const roleProps = isRemoveRootPrincipal? {
1015+
assumedBy: new iam.ArnPrincipal(this.role.roleArn), // Allow only the pipeline execution role
1016+
} : {
10131017
assumedBy: new iam.AccountPrincipal(pipelineStack.account),
1014-
});
1018+
};
1019+
actionRole = new iam.Role(actionScope, 'CodePipelineActionRole', roleProps);
10151020
}
10161021

10171022
// the pipeline role needs assumeRole permissions to the action role

packages/aws-cdk-lib/aws-codepipeline/lib/private/stage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export class Stage implements IStage {
2424
public readonly stageName: string;
2525
public readonly transitionToEnabled: boolean;
2626
public readonly transitionDisabledReason: string;
27-
public readonly beforeEntry?: Conditions;
28-
public readonly onSuccess?: Conditions;
29-
public readonly onFailure?: FailureConditions;
27+
private readonly beforeEntry?: Conditions;
28+
private readonly onSuccess?: Conditions;
29+
private readonly onFailure?: FailureConditions;
3030
private readonly scope: Construct;
3131
private readonly _pipeline: Pipeline;
3232
private readonly _actions = new Array<FullActionDescriptor>();

packages/aws-cdk-lib/aws-codepipeline/lib/rule.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ export interface RuleProps {
5858
*/
5959
readonly role?: iam.Role;
6060

61-
/**
62-
* A category defines what kind of rule can be run in the stage.
63-
* Constrains the provider type for the rule.
64-
*
65-
* @default 'Rule'
66-
*/
67-
readonly category?: string;
68-
6961
/**
7062
* The rule provider that implements the rule's functionality.
7163
*

packages/aws-cdk-lib/aws-codepipeline/test/rules.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,7 @@ describe('Rule', () => {
5959
actionName: 'dummyAction',
6060
input: sourceArtifact,
6161
}));
62-
// --
6362

64-
// eslint-disable-next-line no-console
65-
console.log(Template.fromStack(stack).findResources('AWS::CodePipeline::Pipeline'));
66-
// eslint-disable-next-line no-console
6763
Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', {
6864
Stages: [
6965
{ Name: 'FirstStage' },

packages/aws-cdk-lib/aws-codepipeline/test/stages.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,7 @@ describe('stages', () => {
245245
actionName: 'dummyAction',
246246
input: sourceArtifact,
247247
}));
248-
// --
249248

250-
// eslint-disable-next-line no-console
251-
console.log(Template.fromStack(stack).findResources('AWS::CodePipeline::Pipeline'));
252-
// eslint-disable-next-line no-console
253249
Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', {
254250
Stages: [
255251
{ Name: 'FirstStage' },

0 commit comments

Comments
 (0)