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

Drupal-check reports errors when running multiple instances #207

Closed
manarth opened this issue Feb 15, 2021 · 2 comments
Closed

Drupal-check reports errors when running multiple instances #207

manarth opened this issue Feb 15, 2021 · 2 comments

Comments

@manarth
Copy link

manarth commented Feb 15, 2021

How is drupal-check installed?
drupal-check is installed as a dependency to my project

Environment:

  • OS: Linux Ubuntu VM
  • PHP Version: 7.3
  • Drupal core: 8.9.11

Describe the bug
I have a Jenkins pipeline job which runs a series of tests in parallel. I would like to run drupal-check separately against contrib and custom, to generate two distinct reports.

At the end of the contrib check, this error was reported:

PHP Warning:  unlink(/tmp/drupal_check_phpstan_1613376054.neon): No such file or directory in /var/lib/jenkins/workspace/Tests/app/vendor/mglaman/drupal-check/src/Command/CheckCommand.php on line 265

Jenkins starts both tests simultaneously. Drupal-check creates a run-time configuration file with the name defined as: sys_get_temp_dir() . '/drupal_check_phpstan_' . time() . '.neon';. This means that two instances of drupal-check which start simultaneously will have the same configuration filename.

Jenkins custom-code job

sh '"${COMPOSER_BIN_DIR}"/drupal-check \
    --drupal-root="${WORKSPACE}/app/docroot" \
    --format=junit \
    --no-progress \
    docroot/modules/custom \
    > ${WORKSPACE}/.test-results/drupal9-custom.xml'

Jenkins contrib-code job

sh '"${COMPOSER_BIN_DIR}"/drupal-check \
    --drupal-root="${WORKSPACE}/app/docroot" \
    --format=junit \
    --no-progress \
    docroot/modules/contrib \
    > ${WORKSPACE}/.test-results/drupal9-contrib.xml'
@mglaman
Copy link
Owner

mglaman commented Mar 17, 2021

Copying over feedback from the PR:

PHPStan generates the temp directory. We could silently @unlink. But, this seems like you need to configure the sys_temp_dir ini value for each job to be more isolated.

@mglaman
Copy link
Owner

mglaman commented Feb 2, 2022

:) Use PHPStan directly.

@mglaman mglaman closed this as completed Feb 2, 2022
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

Successfully merging a pull request may close this issue.

2 participants