aws-quickstart / cdk-eks-blueprints

AWS Quick Start Team
Apache License 2.0
454 stars 205 forks source link

pipelines: Ability to add synth stage #633

Closed jagadeeshmaneri closed 1 year ago

jagadeeshmaneri commented 1 year ago

Describe the bug

Currently, we take the approach of writing cdk code alongside the application code.

repository
  -- .github
  -- app
  -- cdk
  -- docs
  -- package.json
  -- package-lock.json
  -- .gitignore
  -- README.md
  -- tsconfig.json

The cdk code is organized to be a subfolder of the GitHub repository root folder, and all the /bin, /lib, cdk.json, etc., are actually not inside the root folder of the repo. With the synth step defined with an assumption of cdk.json to be the repository's root folder in EKS Blueprints, the build stage in the pipeline fails with issues like below

Expected Behavior

It will be a good option to let developers define the synth step behavior, so we write the commands that are required for the pipeline to execute (along with npx cdk synth) before getting into Assets or other stages.

Current Behavior

With default installCommands and commands already defined by the CodePipleine's build method, multiple issues (mentioned above) are encountered.

Reproduction Steps

Create a pipeline with CDK code that is part of the subfolder inside the repository's root folder.

Possible Solution

Update the build method to return the cdkpipelines.CodePipeline with developer-defined PipelineProps for the synth stage.

Additional Information/Context

No response

CDK CLI Version

2.64.0

EKS Blueprints Version

1.5.4

Node.js Version

16.16.0

Environment details (OS name and version, etc.)

MacOS, 13

Other information

No response

shapirov103 commented 1 year ago

@jagadeeshmaneri will it be sufficient to be able to specify path when passing the repo? E.g. see the path attribute below:

blueprints.CodePipelineStack.builder()
            .application("npx ts-node bin/pipeline.ts") // this is supported at the moment, you can override the app
            .name("blueprints-eks-pipeline")
            .owner("aws-samples")
            .codeBuildPolicies(blueprints.DEFAULT_BUILD_POLICIES)
            .repository({
                repoUrl: 'cdk-eks-blueprints-patterns',
                credentialsSecretName: 'github-token',
                targetRevision: 'main',
                path: 'infra/cdk'  // this attribute is supported now but ignored by CodePipeline at the moment. 
            })
elamaran11 commented 1 year ago

This is addressed, closing the issue.