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

[aws-codepipeline-actions] Support for CodeStar Connections in GitHubSourceAction #10632

Closed
2 tasks
akuma12 opened this issue Oct 1, 2020 · 15 comments · Fixed by #13781
Closed
2 tasks

[aws-codepipeline-actions] Support for CodeStar Connections in GitHubSourceAction #10632

akuma12 opened this issue Oct 1, 2020 · 15 comments · Fixed by #13781
Assignees
Labels
@aws-cdk/aws-codepipeline-actions effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@akuma12
Copy link

akuma12 commented Oct 1, 2020

CodePipeline is recommending the use of the new CodeStar Connections when creating GitHub source actions. The GitHubSourceAction class doesn't currently support passing in a CodeStar Connection ARN.

Use Case

This would allow us to create GitHub sources that utilize the AWS Github Connector app. We can set this up via CloudFormation, but currently not via CDK. This would also have the side effect of enabling GitHub Enterprise Server connections within CDK.

Proposed Solution

Implement a new CodeStarSourceConnectionAction that mimics the parameters defined inhttps://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html

Other

The current GitHubSourceAction is working for us, but the new CodeStar Connection system would be a nice option, and more secure than using a machine account with a personal OAuth token.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@akuma12 akuma12 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 1, 2020
@skinny85
Copy link
Contributor

skinny85 commented Oct 1, 2020

Hey @akuma12 ,

actually, you can try using the (poorly name) BitBucketSourceAction even for GitHub - it actually should work!

Let me know if it does. If it turns out it does, we might think of renaming it to make it more obvious it works for both.

Thanks,
Adam

@skinny85 skinny85 added effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Oct 1, 2020
@akuma12
Copy link
Author

akuma12 commented Oct 1, 2020

@skinny85 I never would have thought of that, I'll give it a whirl, thanks!

@akuma12
Copy link
Author

akuma12 commented Oct 1, 2020

@skinny85 That seems to work. I had an issue at first with the Source action getting triggered by a push, but then just hanging, but it started working after I did a little tear down and redeploy. Thank you so much!

@akuma12 akuma12 closed this as completed Oct 1, 2020
@skinny85
Copy link
Contributor

skinny85 commented Oct 1, 2020

Sure 🙂. Re-opening so we can track the re-naming work.

@skinny85 skinny85 reopened this Oct 1, 2020
@bryan-hunter
Copy link
Contributor

I started to migrate to using BitBucketSourceAction but noticed that AWS Codestar connections don't allow you to disable the trigger (ie: NONE, POLL, WEBHOOK that's available on the Github one).

I have a situation where I want to source a pipeline's code from Github, but I don't want to trigger the pipeline on a merge.

Is this a limitation of AWS Codestar or can anyone think of a fancy way to accomplish disabling the trigger without having to manage something like pushing code to S3 and sourcing from there?

@caedmon-polly
Copy link

If this is going to replace the GitHubSourceAction it would be nice if it would also emit the variables that are emitted by GitHubSourceAction.

@jmayergit
Copy link

Poorly named indeed XD

Thank you ! @skinny85

@jonathan-kosgei
Copy link

@skinny85 will this get renamed or should we just use BitBucketSourceAction?

@skinny85
Copy link
Contributor

skinny85 commented Feb 3, 2021

There will be a new Action class created, something like CodeStarConnectionsSourceAction, but we won't remove BitBucketSourceAction, so feel free to use it until that happens 🙂.

@bryan-hunter
Copy link
Contributor

I started to migrate to using BitBucketSourceAction but noticed that AWS Codestar connections don't allow you to disable the trigger (ie: NONE, POLL, WEBHOOK that's available on the Github one).

I have a situation where I want to source a pipeline's code from Github, but I don't want to trigger the pipeline on a merge.

Is this a limitation of AWS Codestar or can anyone think of a fancy way to accomplish disabling the trigger without having to manage something like pushing code to S3 and sourcing from there?

Updating in case someone finds this issue:

The Github Version 2 Source action now supports this via DetectChanges in CloudFormation. This PR adds this capability to BitBucketSourceAction (which is used for new GithubSource connection now too): #13656

skinny85 added a commit to skinny85/aws-cdk that referenced this issue Mar 25, 2021
…tion

At the same time, deprecate the unfortunately-named `BitBucketSourceAction`.

Fixes aws#10632
@danielwoerner
Copy link

any updates? if you know this PR will go through in the next few days, i can postpone development of our companies pipelines for until then. if not i guess i'll have to use the BitBucketSourceAction

@skinny85
Copy link
Contributor

skinny85 commented Apr 6, 2021

Go ahead and use BitBucketSourceAction. After this PR gets merged, it should just be a matter of "search + replace" BitBucketSourceAction to CodeStarConnectionsSourceAction (their APIs are identical).

skinny85 added a commit to skinny85/aws-cdk that referenced this issue Apr 7, 2021
…tion

At the same time, deprecate the unfortunately-named `BitBucketSourceAction`.

Fixes aws#10632
@mergify mergify bot closed this as completed in #13781 Apr 7, 2021
mergify bot pushed a commit that referenced this issue Apr 7, 2021
…tion (#13781)

At the same time, deprecate the unfortunately-named `BitBucketSourceAction`.

Fixes #10632

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Apr 7, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
…tion (aws#13781)

At the same time, deprecate the unfortunately-named `BitBucketSourceAction`.

Fixes aws#10632

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@contrapunctus-xv
Copy link

How do we access variables with this now?

@skinny85
Copy link
Contributor

@contrapunctus-xv we don't support variables on CodeStarConnectionsSourceAction today, even tough I see they are listed in the CodePipeline documentation. Would you mind opening us a Feature Request to add this capability?

In the meantime, you can work around this limitation by setting the variablesNamespace property of the Action:

          new codepipeline_actions.CodeStarConnectionsSourceAction({
            actionName: 'BitBucket',
            owner: 'aws',
            repo: 'aws-cdk',
            output: sourceOutput,
            connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh',
            variablesNamespace: 'MyNamespace',
          }),

And then using the '#{MyNamespace.VariableName}' notation, like so:

              new cpactions.CodeBuildAction({
                actionName: 'Build',
                project: new codebuild.PipelineProject(stack, 'MyProject'),
                input: sourceOutput,
                environmentVariables: {
                  AuthorDate: { value: '#{MyNamespace.AuthorDate}' },
                },
              }),

Hope this helps!

Thanks,
Adam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline-actions effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants