Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pipelines): wrong runOrder for manual approval when using extraRunOrderSpace #11511

Merged
merged 3 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/pipelines/lib/stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class CdkStage extends CoreConstruct {
// now is where we add a manual approval step, and we allocate 1 more runOrder
// for the execute.
if (options.manualApprovals) {
this.addManualApprovalAction({ runOrder: executeRunOrder });
this.addManualApprovalAction({ runOrder: runOrder + 1 });
executeRunOrder = this.nextSequentialRunOrder();
}

Expand Down
37 changes: 37 additions & 0 deletions packages/@aws-cdk/pipelines/test/stack-ordering.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,43 @@ test('extra space for sequential intermediary actions is reserved', () => {
});
});

test('combination of manual approval and extraRunOrderSpace', () => {
// WHEN
pipeline.addApplicationStage(new OneStackApp(app, 'MyApp'), {
extraRunOrderSpace: 1,
manualApprovals: true,
});

// THEN
expect(pipelineStack).toHaveResourceLike('AWS::CodePipeline::Pipeline', {
Stages: arrayWith({
Name: 'MyApp',
Actions: sortedByRunOrder([
objectLike({
Name: 'Stack1.Prepare',
RunOrder: 1,
}),
objectLike({
Name: 'ManualApproval',
RunOrder: 2,
}),
objectLike({
Name: 'Stack1.Deploy',
RunOrder: 4,
}),
]),
}),
});
});

class OneStackApp extends Stage {
constructor(scope: Construct, id: string, props?: StageProps) {
super(scope, id, props);

new BucketStack(this, 'Stack1');
}
}

class TwoStackApp extends Stage {
constructor(scope: Construct, id: string, props?: StageProps) {
super(scope, id, props);
Expand Down