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

docs(pipelines): clarify integration with existing pipelines #24029

Merged
merged 2 commits into from
Feb 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions packages/@aws-cdk/pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -907,21 +907,37 @@ If you wish to use an existing `CodePipeline.Pipeline` while using the modern AP
methods and classes, you can pass in the existing `CodePipeline.Pipeline` to be built upon
instead of having the `pipelines.CodePipeline` construct create a new `CodePipeline.Pipeline`.
This also gives you more direct control over the underlying `CodePipeline.Pipeline` construct
if the way the modern API creates it doesn't allow for desired configurations.
if the way the modern API creates it doesn't allow for desired configurations. Use `CodePipelineFileset` to convert CodePipeline **artifacts** into CDK Pipelines **file sets**,
that can be used everywhere a file set or file set producer is expected.

Here's an example of passing in an existing pipeline:
Here's an example of passing in an existing pipeline and using a *source* that's already
in the pipeline:

```ts
declare const codePipeline: codepipeline.Pipeline;

const sourceArtifact = new codepipeline.Artifact('MySourceArtifact');

const pipeline = new pipelines.CodePipeline(this, 'Pipeline', {
codePipeline: codePipeline,
synth: new pipelines.ShellStep('Synth', {
input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', {
connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });',
}),
input: pipelines.CodePipelineFileSet.fromArtifact(sourceArtifact),
commands: ['npm ci','npm run build','npx cdk synth'],
}),
});
```

If your existing pipeline already provides a synth step, pass the existing
artifact in place of the `synth` step:

```ts
declare const codePipeline: codepipeline.Pipeline;

const buildArtifact = new codepipeline.Artifact('MyBuildArtifact');

const pipeline = new pipelines.CodePipeline(this, 'Pipeline', {
codePipeline: codePipeline,
synth: pipelines.CodePipelineFileSet.fromArtifact(buildArtifact),
});
```

Expand Down