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): CodeBuild projects are hard to tell apart #18492

Merged
merged 2 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export class CodeBuildFactory implements ICodePipelineActionFactory {

const project = new codebuild.PipelineProject(projectScope, this.constructId, {
projectName: this.props.projectName,
description: `Pipeline step ${options.pipeline.pipeline.pipelineName}/${stage.stageName}/${actionName}`,
environment,
vpc: projectOptions.vpc,
subnetSelection: projectOptions.subnetSelection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ test('additionalinputs creates the right commands', () => {
});
});

test('CodeBuild projects have a description', () => {
new cdkp.CodePipeline(pipelineStack, 'Pipeline', {
synth: new cdkp.CodeBuildStep('Synth', {
commands: ['/bin/true'],
input: cdkp.CodePipelineSource.gitHub('test/test', 'main'),
}),
});

// THEN
Template.fromStack(pipelineStack).hasResourceProperties(
'AWS::CodeBuild::Project',
{
Description: {
'Fn::Join': [
'',
['Pipeline step ', { Ref: 'Pipeline9850B417' }, '/Build/Synth'],
],
},
},
);
});

test('long duration steps are supported', () => {
// WHEN
new cdkp.CodePipeline(pipelineStack, 'Pipeline', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,18 @@
"Cache": {
"Type": "NO_CACHE"
},
"Description": {
"Fn::Join": [
"",
[
"Pipeline step ",
{
"Ref": "Pipeline9850B417"
},
"/Build/Synth"
]
]
},
"EncryptionKey": "alias/aws/s3",
"VpcConfig": {
"SecurityGroupIds": [
Expand Down Expand Up @@ -1942,6 +1954,18 @@
"Cache": {
"Type": "NO_CACHE"
},
"Description": {
"Fn::Join": [
"",
[
"Pipeline step ",
{
"Ref": "Pipeline9850B417"
},
"/UpdatePipeline/SelfMutate"
]
]
},
"EncryptionKey": "alias/aws/s3",
"VpcConfig": {
"SecurityGroupIds": [
Expand Down Expand Up @@ -2284,6 +2308,18 @@
"Cache": {
"Type": "NO_CACHE"
},
"Description": {
"Fn::Join": [
"",
[
"Pipeline step ",
{
"Ref": "Pipeline9850B417"
},
"/Assets/FileAsset1"
]
]
},
"EncryptionKey": "alias/aws/s3",
"VpcConfig": {
"SecurityGroupIds": [
Expand Down Expand Up @@ -2385,6 +2421,18 @@
"Cache": {
"Type": "NO_CACHE"
},
"Description": {
"Fn::Join": [
"",
[
"Pipeline step ",
{
"Ref": "Pipeline9850B417"
},
"/Assets/FileAsset2"
]
]
},
"EncryptionKey": "alias/aws/s3",
"VpcConfig": {
"SecurityGroupIds": [
Expand Down
24 changes: 24 additions & 0 deletions packages/@aws-cdk/pipelines/test/integ.newpipeline.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,18 @@
"Cache": {
"Type": "NO_CACHE"
},
"Description": {
"Fn::Join": [
"",
[
"Pipeline step ",
{
"Ref": "Pipeline9850B417"
},
"/Build/Synth"
]
]
},
"EncryptionKey": "alias/aws/s3"
}
},
Expand Down Expand Up @@ -2335,6 +2347,18 @@
"Cache": {
"Type": "NO_CACHE"
},
"Description": {
"Fn::Join": [
"",
[
"Pipeline step ",
{
"Ref": "Pipeline9850B417"
},
"/UpdatePipeline/SelfMutate"
]
]
},
"EncryptionKey": "alias/aws/s3"
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/pipelines/test/testhelpers/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class StringLike extends Matcher {

public test(actual: any): MatchResult {
if (typeof(actual) !== 'string') {
throw new Error(`Expected string but found ${typeof(actual)}`);
throw new Error(`Expected string but found ${typeof(actual)} ${JSON.stringify(actual)}`);
}
const re = new RegExp(`^${this.pattern.split('*').map(escapeRegex).join('.*')}$`);

Expand Down