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

(pipelines): Need a way to get Stack Outputs as file artifact if they are > 1000 chars #17067

Open
fab-mindflow opened this issue Oct 20, 2021 · 9 comments
Labels
@aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@fab-mindflow
Copy link

What is the problem?

It looks like CodeBuildStep.envFromCfnOutputs property is limited to 1-1000 characters. When injecting variables, it can quickly reaches this limit and the CodePipeline build fails with:

8:35:20 AM | CREATE_FAILED        | AWS::CodePipeline::Pipeline                  | ##############
ActionConfiguration Map value must satisfy constraint: [Member must have length less than or equal to 1000, Member must have length greater than or equal to 1] (Service: AWSCodePipeline; Status Code: 400; Error Code: ValidationException; Request ID: ############; Proxy: null)

Reproduction Steps

Include many environment variables from CloudFormation output in CodeBuildStep.envFromCfnOutputs.

What did you expect to happen?

CodeBuildStep successful.

What actually happened?

CodeBuildStep failure with too vague error message.

CDK CLI Version

1.127.0

Framework Version

No response

Node.js Version

14.x

OS

macOS 11.6

Language

Typescript

Language Version

No response

Other information

No response

@fab-mindflow fab-mindflow added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 20, 2021
@github-actions github-actions bot added the @aws-cdk/aws-codepipeline Related to AWS CodePipeline label Oct 20, 2021
@fab-mindflow
Copy link
Author

fab-mindflow commented Oct 20, 2021

Any known workaround?

This seems to be more or less related to the same limit as: #12747

@ryparker ryparker added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Oct 20, 2021
@skinny85 skinny85 added @aws-cdk/pipelines CDK Pipelines library and removed @aws-cdk/aws-codepipeline Related to AWS CodePipeline labels Oct 22, 2021
@skinny85 skinny85 assigned rix0rrr and unassigned skinny85 Oct 22, 2021
@brennadotdev
Copy link

I've run in to this as well, but only in one specific AWS account. I use the same CDK code in other accounts and it works as expected. I'm not sure what the difference is yet since they all have the same number of variables in the build step and reference SSM params of the same names.

@fab-mindflow
Copy link
Author

fab-mindflow commented Oct 28, 2021

For now, I've used a workaround to dump half of my environment variables in a file within a preliminary CodeBuildStep and read it in the next one.

Unfortunately, the #17074 has broken this workaround from CDK 1.129.0. See my #17074 (comment)

@fab-mindflow
Copy link
Author

fab-mindflow commented Nov 20, 2021

@skinny85 @rix0rrr Any news on this?
We are totally stuck to upgrade our CDK pipeline to latest release (and take benefit of awesome cdk watch :-)

@rix0rrr
Copy link
Contributor

rix0rrr commented Nov 22, 2021

This is unfortunate. I'm not sure it's fixable, this is a limitation imposed by CodePipeline.

I guess an alternative would be to make the outputs available as a JSON file which you can consume in CodeBuild as you desire.

@fab-mindflow
Copy link
Author

fab-mindflow commented Nov 23, 2021

@rix0rrr OK got it, thanks. That's what I did, dumping in multiple steps to an environment file.
However, it cannot work on latest CDK because of this:

Unfortunately, the #17074 has broken this workaround from CDK 1.129.0. See my #17074 (comment)

Edit: actually, this has already been fixed. See update in #17074 (comment)

@rix0rrr rix0rrr changed the title @aws-cdk/pipelines: CodeBuildStep.envFromCfnOutputs limited to 1000 chars (pipelines): Need a way to get Stack Outputs as file artifact if they are > 1000 chars Nov 23, 2021
@rix0rrr rix0rrr added p1 and removed p2 labels Nov 23, 2021
@rix0rrr rix0rrr removed their assignment Nov 23, 2021
@rix0rrr rix0rrr removed their assignment Nov 23, 2021
@piotrekwitkowski
Copy link

I use the following workaround:

CodeBuildStep('StepId',
    commands=[
        'aws sts get-caller-identity', # you don't need this but it prints out the role for debugging purposes
        'export MY_VAR=$(aws cloudformation describe-stacks --query "Stacks[?StackName==\'stack-name\'][].Outputs[?OutputKey==\'my-output-key\'].OutputValue" --output text)',
        'echo $MY_VAR'
    ],
    role_policy_statements=[
        PolicyStatement(
            actions=['cloudFormation:DescribeStacks'],
            resources=['*'],
        ),
    ]
)

@github-actions
Copy link

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label May 18, 2023
@sthuber90
Copy link

sthuber90 commented May 23, 2023

Is there any specific reason this hasn't been resolved yet? What's the reason to limit the evaluation to 1000 characters?

For my pipeline I have a workaround but that's all it is, a workaround

@github-actions github-actions bot removed the closing-soon This issue will automatically close in 4 days unless further comments are made. label May 23, 2023
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 bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

No branches or pull requests

7 participants