-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(codepipeline): allow creation of pipelines without source trigger #2332
feat(codepipeline): allow creation of pipelines without source trigger #2332
Conversation
b967299
to
b086c59
Compare
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.
Thanks a lot for the great contribution @SanderKnape! A few small comments (the most important is changing the enum name).
@@ -1,6 +1,12 @@ | |||
import codepipeline = require('@aws-cdk/aws-codepipeline'); | |||
import { SecretValue } from '@aws-cdk/cdk'; | |||
|
|||
export enum TriggerType { |
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.
-
Can you rename this
enum
toGitHubTrigger
? (there will be more triggers for other sources like CodeCommit, S3, etc.). -
Some JSDocs explaining what this is, and what's the default, would be great (especially
None
is important to explain).
* | ||
* @default false | ||
* @default "WebHook" |
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.
@default GitHubTrigger.WebHook
(it's not a string)
@@ -39,12 +45,11 @@ export interface GitHubSourceActionProps extends codepipeline.CommonActionProps | |||
readonly oauthToken: SecretValue; | |||
|
|||
/** | |||
* Whether AWS CodePipeline should poll for source changes. | |||
* If this is `false`, the Pipeline will use a webhook to detect source changes instead. |
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.
Leave the webhook comment (of course, adjust it to the current situation).
@@ -63,7 +68,7 @@ export class GitHubSourceAction extends codepipeline.SourceAction { | |||
Repo: props.repo, | |||
Branch: props.branch || "master", | |||
OAuthToken: props.oauthToken.toString(), | |||
PollForSourceChanges: props.pollForSourceChanges || false, | |||
PollForSourceChanges: (props.trigger && props.trigger === TriggerType.Poll) || false, |
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.
This entire expression should be simply: props.trigger === GitHubTrigger.Poll
.
"Name": "Two" | ||
} | ||
] | ||
})); |
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.
When you're using haveResourceLike
, you don't need all these extra properties. Focus on just the ones important for your test, something like:
expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', {
"Stages": [
{
"Actions": [
{
"Name": "GH",
"Configuration": {
"PollForSourceChanges": true
},
}
],
"Name": "Source"
},
{
"Actions": [
{
"Name": "Boo"
}
],
"Name": "Two"
}
]
}));
"Name": "Two" | ||
} | ||
] | ||
})); |
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.
Same comment here as above.
@@ -1,431 +1,431 @@ | |||
{ | |||
"program": { | |||
"fileInfos": { | |||
"/users/benisrae/code/cdk/aws-cdk-4/tools/cdk-build-tools/node_modules/typescript/lib/lib.es5.d.ts": { |
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.
This was committed accidentally, and should not be included in the PR.
b086c59
to
1d8310f
Compare
1d8310f
to
7b08676
Compare
Thanks for the feedback @skinny85. I have implemented your requested changes - let me know if there is anything else I need to change! |
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.
Thanks so much for the contribution @SanderKnape !
… trigger (aws#2332) BREAKING CHANGE: the `pollForSourceChanges` property in `GitHubSourceAction` has been renamed to `trigger`, and its type changed from a `boolean` to an enum.
Fixes #1652
Pull Request Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.
Notes
github action uses ThirdParty owner
test to verify that the default behaviour has remained the sameBREAKING CHANGE: this changes the GitHub source action
pollForSourceChanges
property to thetrigger
property that allowsWebhook
(default),Poll
andNone
(new)