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-cdk/pipelines): allow multiple source actions #14490

Closed
1 of 2 tasks
bodokaiser opened this issue May 2, 2021 · 2 comments
Closed
1 of 2 tasks

(@aws-cdk/pipelines): allow multiple source actions #14490

bodokaiser opened this issue May 2, 2021 · 2 comments
Assignees
Labels
@aws-cdk/pipelines CDK Pipelines library feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.

Comments

@bodokaiser
Copy link

Typically, we set up a CdkPipeline as

const pipeline = new CdkPipeline(this, 'Pipeline', {
      cloudAssemblyArtifact,
      sourceAction: new GitHubSourceAction({
        actionName: 'GitHub',
        output: sourceArtifact,
        oauthToken: SecretValue.secretsManager('GitHubToken'),
        owner: 'foobar',
        repo: 'cdk',
        branch: 'main',
      }),
      synthAction: SimpleSynthAction.standardYarnSynth({
        sourceArtifact,
        cloudAssemblyArtifact,
        buildCommand: 'yarn run build',
      }),
})

where there is a single sourceAction pulling the (aws-cdk) source code.

The blog article CDK Pipelines: Continuous delivery for AWS CDK applications as well as aws-cdk-rfc 0049 suggest that the application modules should be built inside the CdkPipeline and published as assets which in turn are referenced in the (cross-account) stack deployments.

Use Case

Having a multi-repo setup, for instance, foobar/cdk for the cdk code and foobar/lambda or foobar/web for a Lambda and web frontend is not possible with a single sourceAction.

If one uses go for the Lambda one requires a custom Pipeline, same is true for recent web apps.

Proposed Solution

Changing sourceAction to sourceActions allowing an array of sourceAction, e.g.,

const pipeline = new CdkPipeline(this, 'Pipeline', {
      cloudAssemblyArtifact,
      sourceActions: [
        new GitHubSourceAction({
          actionName: 'GitHub',
          output: sourceArtifact,
          oauthToken: SecretValue.secretsManager('GitHubToken'),
          owner: 'foobar',
          repo: 'cdk',
          branch: 'main',
        }),
        new GitHubSourceAction({
          actionName: 'GitHub',
          output: sourceArtifact,
          oauthToken: SecretValue.secretsManager('GitHubToken'),
          owner: 'foobar',
          repo: 'web',
          branch: 'main',
        }),
        new GitHubSourceAction({
          actionName: 'GitHub',
          output: sourceArtifact,
          oauthToken: SecretValue.secretsManager('GitHubToken'),
          owner: 'foobar',
          repo: 'lambda-in-go',
          branch: 'main',
        }),
        // ...
      ],
      synthAction: SimpleSynthAction.standardYarnSynth({
        sourceArtifact,
        cloudAssemblyArtifact,
        buildCommand: 'yarn run build',
      }),
})

we could then use

const buildStage = pipeline.addStage('Build')
buildStage.addActions(new CodeBuildAction({
  actionName: 'Web',
  input: sourceArtifact,
  outputs: [cloudAssemblyArtifact],
});)

I am not sure how to reference the build results inside cloudAssemblyArtifact using Asset.from(..) or the like, for example, when defining the lambda Function in the cdk code but I guess this is already somewhat inside the cdk assets.json.

Alternatively, one could define a CodePipelineStack which is deployed with each ApplicationStage. However, this would contradict the idea of building all assets in a central pipeline.

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

This is a 🚀 Feature Request

@bodokaiser bodokaiser added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 2, 2021
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label May 2, 2021
@yattoni
Copy link
Contributor

yattoni commented May 6, 2021

Related #10872

@github-actions
Copy link

github-actions bot commented May 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/pipelines CDK Pipelines library feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants