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

build-artifact step in Pipelines Causes dev/tty Write Errors #4251

Closed
mikemadison13 opened this issue Sep 29, 2020 · 6 comments · Fixed by #4255
Closed

build-artifact step in Pipelines Causes dev/tty Write Errors #4251

mikemadison13 opened this issue Sep 29, 2020 · 6 comments · Fixed by #4255
Labels
12.x Affects or applies to 12.x Bug Something isn't working

Comments

@mikemadison13
Copy link
Contributor

mikemadison13 commented Sep 29, 2020

This is related to #4195.

Describe the bug
After updating to Drupal 9 and BLT 12, my builds are failing in the artifact build stage in Pipelines (not locally) with:

[error]  TTY mode requires /dev/tty to be read/writable. 

This is notable for a few reasons:

  1. this wasn't a problem prior to updating to BLT 12 / Drupal 9
  2. this isn't a problem earlier in the build where I am running the exact same command in the setup-app script (but it is in the build-artifact script)

After some experimentation, I was able to find this in Robo: https://github.com/consolidation/Robo/blob/3.x/src/Common/ExecTrait.php#L354

if ($this->interactive && $this->isPrinted) {
  $this->process->setTty(true);
}

I'm thinking that something about our invokeHooks may be setting something as interactive. When I force the following to FALSE my build passes w/o issue: https://github.com/acquia/blt/blob/12.x/src/Robo/BltTasks.php#L181

-        ->interactive($this->input()->isInteractive())
+        ->interactive(FALSE)

To Reproduce
Steps to reproduce the behavior, ideally starting from a fresh install of BLT:

  1. have a look at the PR from govcon: DGC-000: updating to Drupal 9.x. Drupal4Gov/Drupal-GovCon-2017#905

Expected behavior
Either both the artifact and source both fail or both pass (not one of each)

Detailed error output

> source:build:frontend-reqs

Executing frontend-reqs target hook...

[ExecStack] npm install

[ExecStack] Running npm install in /mnt/tmp/local.prod/source/docroot/themes/custom/twentynineteen

[error]  TTY mode requires /dev/tty to be read/writable. 

The command failed. This often indicates a problem with your configuration. Review the command output above for more detailed errors, and consider re-running with verbose output for more information.

[error]  Command `source:build:frontend-reqs ` exited with code 1.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/ 
The command failed. This often indicates a problem with your configuration. Review the command output above for more detailed errors, and consider re-running with verbose output for more information.

[error]  Command `source:build:frontend ` exited with code 1.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/ 

0.512s total time elapsed.

System information

  • Operating system type: Lando / Ubuntu
  • BLT version: 12.3.x
@mikemadison13 mikemadison13 added Bug Something isn't working 12.x Affects or applies to 12.x labels Sep 29, 2020
@mikemadison13 mikemadison13 changed the title Hook Invocation Differs from Command Invocation, Causes dev/tty Write Errors Source:Build Causes dev/tty Write Errors Sep 29, 2020
@mikemadison13 mikemadison13 changed the title Source:Build Causes dev/tty Write Errors build-artifact step in Pipelines Causes dev/tty Write Errors Sep 29, 2020
@mikemadison13
Copy link
Contributor Author

mikemadison13 commented Sep 29, 2020

FWIW I poked at this extensively and as far as I can tell, the npm ci command doesn't actually run. I've tried putting several other commands in its place and they fail with similar output.

@danepowell
Copy link
Contributor

Does [error] TTY mode requires /dev/tty to be read/writable. come from npm, or symfony?

I doubt BLT is doing anything wrong here because our canary builds are running fine in Pipelines, and I know that Symfony has a lot of TTY detection logic that would fall over if we were calling it incorrectly. But I also know that Robo / Symfony changed this recently, and it's definitely conceivable that upgrading Symfony (as for Drupal 9) would break something.

@danepowell
Copy link
Contributor

I added an npm install command to our canary build and reproduced this. Looks like it only happens in Pipelines, not Travis, which is not surprising, Symfony and Robo haven't been very consistent about detecting TTY in the past in Pipelines.

@bkosborne
Copy link
Contributor

I ran into this as well with a Probo.ci environment. It started thinking it was in an interactive shell after updating to BLT 12 and Drupal 9. I also fixed it by explicitly telling it was not an interactive shell.

@dhaggman
Copy link

@bkosborne How did you specify it to be non interactive?

I'm updating from Drupal 8.9 -> 9.0 (so also BLT 11 -> 12)
I started facing the same issue with Bitbucket pipelines with my frontend build-script

> source:build:frontend-assets
Executing frontend-assets target hook...
[ExecStack] /opt/atlassian/pipelines/agent/build/blt/scripts/frontend-build.sh
[ExecStack] Running /opt/atlassian/pipelines/agent/build/blt/scripts/frontend-build.sh in /opt/atlassian/pipelines/agent/build/docroot
[error]  TTY mode requires /dev/tty to be read/writable

BLT version: 12.8.2.0

@bkosborne
Copy link
Contributor

@dhaggman Just pass --no-interaction to the BLT command that's invoked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
12.x Affects or applies to 12.x Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants