Skip to content

Commit

Permalink
Merge pull request #844 from aws-quickstart/feature/path-for-pipeline
Browse files Browse the repository at this point in the history
added path support to code pipeline:
  • Loading branch information
shapirov103 authored Oct 2, 2023
2 parents 51a81ff + af4df99 commit db0119e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 14 additions & 2 deletions docs/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,23 @@ const blueprint = blueprints.EksBlueprint.builder()
owner: "aws-samples",
repoUrl: 'cdk-eks-blueprints-patterns',
credentialsSecretName: 'github-token',
targetRevision: 'main' // optional, default is "main"
targetRevision: 'main' // optional, default is "main",
})
```

Note: the above code depends on the AWS secret `github-token` defined in the target account/region. The secret may be fined in one main region, and replicated to all target regions.
If you IaC code is located under a specific folder, for example `PROJECT_ROOT/infra/blueprints` you can specify that directory with the repository (applies to GitHub. CodeCommit and CodeStar repos).

```
blueprints.CodePipelineStack.builder()
.name("eks-blueprints-pipeline")
.repository({
owner: "aws-samples",
repoUrl: 'cdk-eks-blueprints-patterns',
credentialsSecretName: 'github-token',
path: "./infra/blueprints" // optional, default is './'
})```
Note: the above code depends on the AWS secret `github-token` defined in the target account/region. The secret may be defined in one main region, and replicated to all target regions.
### Using AWS CodeCommit as CodePipeline repository source.
Expand Down
6 changes: 4 additions & 2 deletions lib/pipelines/code-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,16 +433,18 @@ class CodePipeline {

const app = props.application ? `--app '${props.application}'` : "";

const path = props.repository.path ?? "./";

return new cdkpipelines.CodePipeline(scope, props.name, {
pipelineName: props.name,
synth: new cdkpipelines.ShellStep(`${props.name}-synth`, {
input: codePipelineSource,
installCommands: [
'n stable',
'npm install -g [email protected]',
'npm install',
`cd ${path} && npm install`,
],
commands: ['npm run build', 'npx cdk synth ' + app]
commands: [`cd ${path}`, 'npm run build', 'npx cdk synth ' + app]
}),
crossAccountKeys: props.crossAccountKeys,
codeBuildDefaults: {
Expand Down

0 comments on commit db0119e

Please sign in to comment.