-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(cdk): fix a bug with CodePipelineSource to create nested repositories #27668
Changes from 2 commits
4ba68a5
3de98c6
1200929
cc78206
cebd303
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,11 +256,11 @@ class GitHubSource extends CodePipelineSource { | |
super(repoString); | ||
|
||
const parts = repoString.split('/'); | ||
if (Token.isUnresolved(repoString) || parts.length !== 2) { | ||
if (Token.isUnresolved(repoString) || parts.length < 2) { | ||
throw new Error(`GitHub repository name should be a resolved string like '<owner>/<repo>', got '${repoString}'`); | ||
} | ||
this.owner = parts[0]; | ||
this.repo = parts[1]; | ||
this.repo = parts.slice(1).join('/'); | ||
this.authentication = props.authentication ?? SecretValue.secretsManager('github-token'); | ||
this.configurePrimaryOutput(new FileSet('Source', this)); | ||
} | ||
|
@@ -425,11 +425,11 @@ class CodeStarConnectionSource extends CodePipelineSource { | |
super(`${repoString}-${branch}`); | ||
|
||
const parts = repoString.split('/'); | ||
if (Token.isUnresolved(repoString) || parts.length !== 2) { | ||
if (Token.isUnresolved(repoString) || parts.length < 2) { | ||
throw new Error(`CodeStar repository name should be a resolved string like '<owner>/<repo>', got '${repoString}'`); | ||
Comment on lines
+428
to
429
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might also consider changing the verbiage in the error message regarding the expected resolved string format. As an example, the same repository name field in the console expresses the format as group/subgroup/project. |
||
} | ||
this.owner = parts[0]; | ||
this.repo = parts[1]; | ||
this.repo = parts.slice(1).join('/'); | ||
this.configurePrimaryOutput(new FileSet('Source', this)); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets move this validation into a function. It should cover the edge case of a string such as 'owner/group1//repo' and give a specific error message.