-1

"Since there is no proper way to configure push filter using cdk for aws codepipeline, I've tried the below. But it gives me an error which is posted below. Tried multiple things but non of them worked. Anybody has a clue on this?

Code:

const cfnPipeline = pipeline.node.defaultChild as codepipeline.CfnPipeline;
cfnPipeline.addPropertyOverride("Triggers.0.GitConfiguration.Push.0.Branches", {
  Includes: ["main", "dev"],
});

Error:

Properties validation failed for resource PipelineABCD5664GGD with message: [#/Triggers/0/GitConfiguration/Push: expected type: JSONArray, found: JSONObject]
4
  • 1
    The closing " is missing after dev Commented Nov 4, 2024 at 19:20
  • Try cfnPipeline.addPropertyOverride('Triggers.0.GitConfiguration.Push.0.Branches.Includes', ['main','dev']). Commented Nov 5, 2024 at 3:02
  • tried but still the same Commented Nov 5, 2024 at 14:51
  • My updated answer should solve the issue. Commented Mar 17 at 11:31

1 Answer 1

1

Seems like the Triggers.0.Gitconfiguration.Push array is missing - set the entire array instead of just the first element:

const cfnPipeline = pipeline.node.defaultChild as codepipeline.CfnPipeline;
cfnPipeline.addPropertyOverride("Triggers.0.GitConfiguration.Push", [
  { Branches: { Includes: ["main", "dev"] } },
]);
Sign up to request clarification or add additional context in comments.

4 Comments

Tried but not worked
@ShanWave007 what's the error?
I this it actually needs to specify Branches instead of Branch
@Phil you're right, corrected the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.