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

Error commenting stages: Error: Comment for stack foobar is too long, please report this as a bug #34

Open
mrgrain opened this issue Dec 22, 2023 · 4 comments

Comments

@mrgrain
Copy link

mrgrain commented Dec 22, 2023

#32 is fixed and works great, however we are still getting the following error for one of the stacks. Reporting this for completeness. FWIW I think we are getting this because the diff (incorrectly, but probably a configuration issue on my end) believes this is a new stack and so it just lists all changes which is very long.

Further ideas for fixing:

  • truncate if needed
  • maybe there's a way to give github extra long strings, just not as a comment?
  • The IAM change list is very long. It's obviously useful though.
Run corymhall/cdk-diff-action@e154417b2bd6f6c53234d7432043044d965e69d5
  
Error commenting stages:  Error: Comment for stack foobar is too long, please report this as a bug https://github.com/corymhall/cdk-diff-action/issues/new
Error: Comment for stack foobar is too long, please report this as a bug https://github.com/corymhall/cdk-diff-action/issues/new
    at StageProcessor.commentStacks (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/stage-processor.js:94:1)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at StageProcessor.commentStages (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/stage-processor.js:[12](https://github.com/cdklabs/cdk-ops/actions/runs/7299188526/job/19891550494?pr=3055#step:8:13)5:1)
    at run (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/action.js:61:1)
Error performing diff:  Error: Comment for stack foobar is too long, please report this as a bug https://github.com/corymhall/cdk-diff-action/issues/new
    at StageProcessor.commentStacks (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/stage-processor.js:94:1)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at StageProcessor.commentStages (/home/runner/work/_actions/corymhall/cdk-diff-action/e154417b2bd6f6c53234d7432043044d965e69d5/lib/stage-processor.js:125:1)
    at run (/home/runner/work/_actions/corymhall/cdk-diff-action/e[15](https://github.com/cdklabs/cdk-ops/actions/runs/7299188526/job/19891550494?pr=3055#step:8:16)44[17](https://github.com/cdklabs/cdk-ops/actions/runs/7299188526/job/19891550494?pr=3055#step:8:18)b2bd6f6c53234d743[20](https://github.com/cdklabs/cdk-ops/actions/runs/7299188526/job/19891550494?pr=3055#step:8:21)43044d965e69d5/lib/action.js:61:1)
@corymhall
Copy link
Owner

FWIW I think we are getting this because the diff (incorrectly, but probably a configuration issue on my end) believes this is a new stack

I have seen this issue before, but I don't remember exactly what the issue was. I think it was something to do with the credentials not being configured correctly (i've created a new issue #35). It might be:

  • The github action role is not allowed to assume the cdk lookup role in the stack account
  • The stack doesn't have a lookup role (maybe an old bootstrap version) so it just uses the github action role

For the actual issue of a single stack diff being too big, I'm not sure how to handle that. Maybe we can gradually remove parts of the diff starting with the security changes?

@mrgrain
Copy link
Author

mrgrain commented Dec 22, 2023

I'd have suggested adding it as an attachment, but seems like there is no API for that 😞

Gradually removing content seems like the best idea. Let's make sure to put a big fat warning in though.

@NiKlimenko
Copy link

@corymhall This current problem makes destructive changes in rather large stacks untraceable. Given that destructive changes is the main feature we are interested in, and it doesn't take up much space in the comment compared to a summary of stack changes, why not make the “Summary of stack changes” feature optional so that it can be disabled and free up a lot of space in the comment for the really important information? What do you think?

const writable = new StringWritable({});
formatDifferences(writable, diff);
output.push('');
output.push('```shell');
output.push(writable.data);
output.push('```');
output.push('</details>');
output.push('');

@corymhall
Copy link
Owner

That's actually a good idea. We can fallback to just commenting the destructive changes if the comment is too long 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants