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

Terminal size is 0 on CI and so diff and deploy throws exception when trying to create table of changes #2253

Closed
CSmither opened this issue Apr 12, 2019 · 5 comments · Fixed by #2355 · May be fixed by MechanicalRock/account-reaper#6
Labels
bug This issue is a bug.

Comments

@CSmither
Copy link

CSmither commented Apr 12, 2019

Describe the bug
In some CI setups (CircleCI and Jenkins), process.stdout.column can return 0 and so when the cdk uses the table library to create the table of resources to print to logs it throws an exception as terminal width cannot be 0.

To Reproduce
Run any cdk diff or cdk deploy command on a terminal with 0 width or on a CI setup where process.stdout.column returns 0

CI Logs
https://circleci.com/gh/CSmither/aws-cdk-demo/30

> [email protected] cdk /home/circleci/repo/stack
> cdk "deploy"

COLUMN WIDTH ===> 0
This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
Please confirm you intend to make the following modifications:

IAM Statement Changes
Column width must be greater than 0.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] cdk: `cdk "deploy"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] cdk script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2019-04-12T07_25_54_317Z-debug.log
Exited with code 1

Expected behavior
Print a table of the stack to logs and continue on to either describe diff or deploy stack

Version:

  • OS: Linux host with docker image (circleci/node:11.9.0-stretch)
  • Language: Node Typescript
  • CDK Version: 0.28.0 from npm

Notes
Stack overflow post just to link them

@CSmither CSmither added the bug This issue is a bug. label Apr 12, 2019
@CSmither
Copy link
Author

This isn't really an issue with cdk it is an issue with combining the library that cdk uses with certain CI environments. The CI environment reports process.stdout.columns as 0 which causes the tables library to throw an exception.

@eladb
Copy link
Contributor

eladb commented Apr 14, 2019

Still feels like a bug m

@eladb eladb reopened this Apr 14, 2019
@CSmither
Copy link
Author

Fair enough. Shout if you need any logs, configs, etc.

@eladb
Copy link
Contributor

eladb commented Apr 14, 2019

Thanks for reporting!

rix0rrr added a commit that referenced this issue Apr 23, 2019
On some CI systems the terminal width is reported as 0 (instead of
"unknown"), which causes table formatting to fail.

Enforce a minimum terminal width.

Fixes #2253.
rix0rrr added a commit that referenced this issue Apr 23, 2019
On some CI systems the terminal width is reported as 0 (instead of
"unknown"), which causes table formatting to fail.

Enforce a minimum terminal width.

Fixes #2253.
piradeepk pushed a commit to piradeepk/aws-cdk that referenced this issue Apr 25, 2019
On some CI systems the terminal width is reported as 0 (instead of
"unknown"), which causes table formatting to fail.

Enforce a minimum terminal width.

Fixes aws#2253.
SanderKnape pushed a commit to SanderKnape/aws-cdk that referenced this issue May 14, 2019
On some CI systems the terminal width is reported as 0 (instead of
"unknown"), which causes table formatting to fail.

Enforce a minimum terminal width.

Fixes aws#2253.
@mt-yohei-koyama
Copy link

mt-yohei-koyama commented Nov 9, 2020

I use stty rows ROW_NUMBER cols COLUMN_NUMBER as a workaround for CircleCI.
Example:

- run:
    name: diff
    command: |
      stty rows 64 cols 204
      npx cdk diff --app "npx ts-node bin/A.ts"

Just FYI for CircleCI and cdk user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
3 participants