Skip to content

Use longer option names in install_db() to avoid stalling CIs#255

Merged
schlessera merged 1 commit intowp-cli:masterfrom
stevegrunwell:fix/install-tests-with-empty-password
Apr 1, 2020
Merged

Use longer option names in install_db() to avoid stalling CIs#255
schlessera merged 1 commit intowp-cli:masterfrom
stevegrunwell:fix/install-tests-with-empty-password

Conversation

@stevegrunwell
Copy link
Contributor

Since some platforms (such as Travis CI) use empty passwords for the database user, passing an empty string for $DB_PASS can result in a TTY prompt, e.g.:

$ DB_USER=someuser DB_PASS="" mysql -u "$DB_USER" -p"$DB_PASS" -e 'show databases;'
Enter password:

In a CI environment, this can cause the entire pipeline to hang until cancelled.

This PR rewrites the call to use the longer option names (--user, --password, and --execute) to prevent empty passwords from being interpreted as "please ask me to provide my password in an interactive prompt."

Since some platforms (such as Travis CI) use empty passwords for the database user, passing an empty string for `$DB_PASS` can result in a TTY prompt, e.g.:

```
$ DB_USER=someuser DB_PASS="" mysql -u "$DB_USER" -p"$DB_PASS" -e 'show databases;'
Enter password:
```

This commit rewrites the call to use the longer option names (`--user`, `--password`, and `--execute`) to prevent empty passwords from being interpreted as "please ask me to provide my password in an interactive prompt."
@stevegrunwell stevegrunwell requested a review from a team as a code owner March 26, 2020 18:01
stevegrunwell added a commit to assertwell/wp-core-test-framework that referenced this pull request Mar 26, 2020
stevegrunwell added a commit to assertwell/wp-core-test-framework that referenced this pull request Mar 26, 2020
@schlessera schlessera added the command:scaffold-plugin-tests Related to 'scaffold plugin-tests' command label Apr 1, 2020
@schlessera schlessera changed the title Use the longer option names while creating the database Use longer option names in install_db() to avoid stalling CIs Apr 1, 2020
@schlessera schlessera changed the title Use longer option names in install_db() to avoid stalling CIs Use longer option names in install_db() to avoid stalling CIs Apr 1, 2020
@schlessera schlessera merged commit e52f050 into wp-cli:master Apr 1, 2020
@schlessera
Copy link
Member

Thanks for the PR, @stevegrunwell !

@schlessera schlessera added this to the 2.0.9 milestone Apr 1, 2020
@stevegrunwell stevegrunwell deleted the fix/install-tests-with-empty-password branch October 26, 2020 16:22
danielbachhuber pushed a commit that referenced this pull request Nov 18, 2022
…ty-password

Use longer option names in `install_db()` to avoid stalling CIs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:scaffold-plugin-tests Related to 'scaffold plugin-tests' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants