acquia / blt

Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
https://docs.acquia.com/blt/
GNU General Public License v2.0
442 stars 394 forks source link

BLT-5216: drupal:sync:default:site requires --no-interaction during ci on pipelines #4683

Closed loopy3025 closed 1 year ago

loopy3025 commented 1 year ago

Describe the bug During our Drupal 10 upgrade, BLT upgraded from 13.7.0 to 13.7.1. when this happened, we got the following on blt source:build:composer druing acquia pipelines ci run:

Updating BLT template files...

 > blt blt:update --ansi --no-interaction

+ source ${BLT_DIR}/scripts/pipelines/setup_env

export PATH=${COMPOSER_BIN}:$PATH

# Set git info.
git config --global user.name "Acquia Cloud"

git config --global user.email "no-reply@example.com"

# Create MySQL DB.
mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS drupal"

mysql: [Warning] Using a password on the command line interface can be insecure.

set +v

+ blt drupal:sync:default:site

> source:build:composer

 [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:composer ` exited with code 1.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/ 

+ blt drupal:sync:default:site

I have confirmed this issue on multiple sites.

Here is our build:setup-env:script:

            - echo 'STARTED'
            - export PIPELINE_SSH_KEY=~/.ssh/my-key
            - git ls-remote git@github.com:our-github-org/our-org-base-theme.git
            - echo 'Steps (git operations) will be successful which are dependent on my-key'
            - "eval `ssh-agent -s`" # start the ssh agent
            - "ssh-add ~/.ssh/my-key" # add a key
            - composer validate --no-check-all --ansi
            - composer install --no-dev --ansi
            - source ${BLT_DIR}/scripts/pipelines/setup_env
            - blt drupal:sync:default:site
            - nvm install 16
            - cd ${THEME_DIR} && npm install --global yarn && yarn cache clean && yarn
            - source ${BLT_DIR}/scripts/pipelines/tests
            - unset PIPELINE_SSH_KEY
            - echo 'Step executed with default ssh keys'
            - echo 'FINISHED'

It seems like it is getting hung up at the blt drupal:sync:default:site step, specifically on source:build:composer. Our sites have passed through this step without complaint on 13.7.0.

I had hoped that running the sync default site command with --no-interaction would be the ticket like in the old #4251 issue, but that only resulted in the pipelines run starting, but never responding after several minutes of running. pipelines logs --application-id=8d8223fe-c9c6-4dce-80b1-15e2d2e10f2c --job-id=32dff02c-e797-4d45-abc8-c15b0058ab05 --tail results in Failed to retrieve logs. for a very long time after. I honestly just gave up on it after 10 minutes of no response.

Simultaneously, it also upgraded drush from 11 to 12 and we did try pinning drush to ^11.0 in case that was somehow the problem. It was a shot in the dark, anyways, and it didn't help.

Could it be the changes to .github/workflows/automerge.yml?

To Reproduce

Run blt drupal:sync:default:site with acquia pipelines during blt:setup-env. I suspect that it's important to also use an ssh key. Use blt 13.7.1 and PHP 8.1 with a Drupal 10 site.

Expected behavior The command passes without complaint.

Detailed error output

set +v

+ blt drupal:sync:default:site -vvv

> source:build:composer

 [Exec] Running export COMPOSER_EXIT_ON_PATCH_FAILURE=1 &&
 composer install --ansi --no-interaction in /mnt/tmp/local.prod/source

 [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:composer ` exited with code 1.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/ 

0.162s total time elapsed.

+ blt drupal:sync:default:site -vvv

System information

loopy3025 commented 1 year ago

Well, I just tried it again with the --no-interaction and after 16 minutes, it passed.

I can't imagine why.