cdk-pipelines-github icon indicating copy to clipboard operation
cdk-pipelines-github copied to clipboard

allow for escape hatching

Open kaizencc opened this issue 3 years ago • 1 comments

This library is modeled after CDK Pipelines, and is meant to be feature complete compared to that library. There is one difference however -- CDK Pipelines is a CDK construct that is compiled down to a CloudFormation template, which allows for the escape-hatching mechanism that unlocks any and all out-of-bound changes to the underlying CloudFormation template. As of right now, CDK Pipelines GitHub does not have this feature (since it compiles to a GitHub Workflow) and is thus less customizable than its counterpart.

CDK Pipelines GitHub needs a way of escape hatching to the GitHub Workflow.

kaizencc avatar Aug 09 '22 14:08 kaizencc

Could this be done by providing access to the workflow data structure somehow? https://github.com/cdklabs/cdk-pipelines-github/blob/main/src/pipeline.ts#L283

Possibly by passing a callback function or something into the pipeline, so that users can manipulate the workflow data after synthesis, but before writing?

danieljamesscott avatar Aug 19 '22 15:08 danieljamesscott

I think the way to go about this will be similar to how projen supports escape hatching (since they also are modifying json and yaml files): https://github.com/projen/projen/blob/main/docs/escape-hatches.md

In my mind, this will look something like this:

const workflow = new GitHubWorkflow(...);

workflow.patch(YamlPatch.add('/steps/0/env/VAR', 'VAL'));

Hopefully I have the time to implement this in the coming weeks. +1s would help me prioritize this, and a contribution would certainly help here, but be prepared to add plenty of tests to make sure that the APIs we add correctly modify the yaml files in ways we expect (no snapshot tests :) ).

kaizencc avatar Aug 29 '22 21:08 kaizencc