Created
March 23, 2022 14:23
-
-
Save markilott/94a66308b339aa7565d9441ec703a93c to your computer and use it in GitHub Desktop.
AWS CDK Pipelines GitHub Connections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Connecting to GitHub as source in a CDK Pipeline | |
// Method 1 - Personal Access Token and Secret. | |
// Create a Personal Access Token in GitHub. | |
// Store the Token in a Secrets Manager Secret, then: | |
new CodePipeline(this, 'DemoPipeline', { | |
synth: new ShellStep('Synth', { | |
input: CodePipelineSource.gitHub('owner/reponame', 'branchname', { | |
authentication: SecretValue.secretsManager('SecretName', { jsonField: 'TOKEN_FIELD' }), | |
trigger: GitHubTrigger.WEBHOOK, | |
}), | |
commands: [ | |
'npm ci', | |
'npm run build', | |
'npx cdk synth', | |
], | |
}), | |
}); | |
// Method 2 - AWS Connector for GitHub (recommended) | |
// Create a Connector in your Pipeline Account, then: | |
new CodePipeline(this, 'DemoPipeline', { | |
synth: new ShellStep('Synth', { | |
input: CodePipelineSource.connection('owner/reponame', 'branchname', { | |
connectionArn, | |
}), | |
commands: [ | |
'npm ci', | |
'npm run build', | |
'npx cdk synth', | |
], | |
}), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment