Open jaswanthm opened 3 years ago
@jaswanthm in the meantime, you can unlock yourself like this:
const amplifyApp = new amplify.App(this, 'App', {
// other props here
sourceCodeProvider: {
bind() {
return {
repository: 'https://...', // your bitbucket repo here
oauthToken: SecretValue.secretsManager('my-token'), // with a token stored in Secrets Manager
};
},
},
});
@jaswanthm in the meantime, you can unlock yourself like this:
const amplifyApp = new amplify.App(this, 'App', { // other props here sourceCodeProvider: { bind() { return { repository: 'https://...', // your bitbucket repo here oauthToken: SecretValue.secretsManager('my-token'), // with a token stored in Secrets Manager }; }, }, });
I can't get this to work for Bitbucket Cloud. (works for Github) I tried both with App Passwords, which looks similar to the Github setup, and with OAuth2 key&secret combination. I'm getting "Access token expired" error when CDK tries to deploy the Amplify App.
Any idea what I'm doing wrong?
Same issue here. Any idea how hard it this to implement it?
In Python, I managed to do something like:
@jsii.implements(amplify.ISourceCodeProvider)
class BitbucketSourceProvider:
def __init__(
self,
*,
repository: str,
access_key: str,
secret_key: str,
) -> None:
self._repo = repository
self._access_key = access_key
self._secret_key = secret_key
def bind(self, app: amplify.App) -> amplify.SourceCodeProviderConfig:
token = requests.post(
'https://bitbucket.org/site/oauth2/access_token',
auth=(self._access_key, self._secret_key),
data={
'grant_type': 'client_credentials',
},
).json()['access_token']
return amplify.SourceCodeProviderConfig(
repository=self._repo,
oauth_token=cdk.SecretValue.plain_text(token),
)
This makes it possible to create an app with bitbucket as source provider.
+1
I am trying to setup a cdk pipeline to deploy a react app on AWS Amplify. Although, I am unable to use bitbucket as a source code provider.
Use Case
Setting up a new project on amplify through bitbucket is possible using the AWS console. But cdk doesn't have support for this.
Currently, as a workaround, I had to revert back to using CodePipeline and S3 bucket to deploy my react app through cdk, which isn't ideal.
Proposed Solution
Create a new source code provider for bitbucket like the one that already exists for Github, Gitlab and CodeCommit - https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-amplify.GitHubSourceCodeProvider.html
This is a :rocket: Feature Request