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

codepipeline: GitHubSourceAction should allow setup without polling or webhook #1652

Closed
jesterhazy opened this issue Jan 31, 2019 · 12 comments · Fixed by #2332
Closed

codepipeline: GitHubSourceAction should allow setup without polling or webhook #1652

jesterhazy opened this issue Jan 31, 2019 · 12 comments · Fixed by #2332
Assignees
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline feature-request A feature should be added or improved. p0

Comments

@jesterhazy
Copy link
Contributor

codepipeline.GitHubSourceAction takes a 'pollForSourceChanges' setting. If it is true, codepipeline will poll github for changes. If it is false, then cdk will automatically create a webhook and configure the pipeline use it as a trigger.

This is almost always the right thing to do.

But if you want to trigger a pipeline on a schedule, it would be great to be able to create a pipeline with both of these triggers disable.

There is a workaround to achieve this:

new codepipeline.GitHubSourceAction(this, construct_base_name + 'GitHubSource', {
    ... other settings ...
    // this is needed to prevent webhook creation, but we'll disable it later
    pollForSourceChanges: true
})

const cfnPipeline = pipeline.node.findChild('Resource') as codepipeline.CfnPipeline  		      cfnPipeline.addPropertyOverride('Stages.0.Actions.0.Configuration.PollForSourceChanges', false)
@eladb
Copy link
Contributor

eladb commented Feb 4, 2019

@skinny85 that's a good point. Is this possible to set up in Pipelines at all? I think the use case makes sense.

@eladb eladb added the @aws-cdk/aws-codepipeline Related to AWS CodePipeline label Feb 4, 2019
@eladb eladb added the feature-request A feature should be added or improved. label Feb 4, 2019
@jesterhazy
Copy link
Contributor Author

Yes this is possible to set up in CP. It works. I have a setup where Cloudwatch scheduled events parameterized by pipeline name trigger a Lambda that triggers the pipeline.

@eladb
Copy link
Contributor

eladb commented Feb 4, 2019

@jesterhazy that's cool. good to know

@skinny85
Copy link
Contributor

skinny85 commented Feb 4, 2019

@eladb we can easily add another optional parameter to GitHubActionProps like createWebhook?: boolean that's true by default. If pollForSourceChanges is false (the default) and createWebhook is also false, it will result in a Pipeline that can only be triggered explicitly (it will not trigger simply from pushing to the GitHub repo).

My only worry is that it's such an edge case, I'm almost not sure if it's worth to have a separate property for it, and perhaps @jesterhazy's workaround is 'good enough' in those rare situations when you do need it...

Thoughts?

@eladb
Copy link
Contributor

eladb commented Feb 4, 2019

Sounds like this should be an enum

@skinny85
Copy link
Contributor

skinny85 commented Feb 4, 2019

What should be an enum?

@eladb
Copy link
Contributor

eladb commented Feb 4, 2019

Instead of pollForSourceChanges we could use an enum that allows users to pick one of the three options:

enum Trigger {
  None,
  Poll,
  WebHook,
}

@skinny85
Copy link
Contributor

skinny85 commented Feb 4, 2019

That's giving even more visibility to that edge case, which is the exact opposite of my intention here...

@eladb
Copy link
Contributor

eladb commented Feb 4, 2019

What's wrong with making this option visible? I think it's a perfectly viable option for people. We should obvsiouly default to the preferred option, but I don't see any reason to be opinionated about which options are more "visible" as long as the API is clear

@fulghum fulghum added the p0 label Mar 7, 2019
@abrooksv
Copy link

abrooksv commented Apr 3, 2019

What is the status of this?

@jesterhazy
Copy link
Contributor Author

no idea. we are still using the workaround I mentioned in the issue description above.

@SanderKnape
Copy link

I'm also interested in this. We have some pipelines that only trigger on a schedule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline feature-request A feature should be added or improved. p0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants