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

Cannot run Yaml validator multiple times #4275

Closed
hkorik opened this issue Nov 4, 2020 · 0 comments · Fixed by #4276
Closed

Cannot run Yaml validator multiple times #4275

hkorik opened this issue Nov 4, 2020 · 0 comments · Fixed by #4276
Labels
Bug Something isn't working

Comments

@hkorik
Copy link
Contributor

hkorik commented Nov 4, 2020

Describe the bug
Using the blt validate:yaml:lint:files iteratively as part of a Robo watch task the task fails to find obvious violations after an initial violation is found. The behavior can be reproduced outside of a watch task by calling the validation task in a loop.

Same issue has been reported in version 10.x 3015 and patch has been merged into 10.x #3470 . Code changes appear to not have been implemented in v12.x for YamlCommand and only for the TwigCommand.

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

  1. Create the following files:
  • docroot/themes/custom/test/one.yml:
one:
  - '
  • docroot/themes/custom/test/two.yml:
two:
  - '
  1. Create the following command function:
  /**
   * @command run:yaml:lint:files
   */
  public function testYamlLintFilesTask() {

    for ($i = 0; $i < 10; $i++) {

      try {
        $this->invokeBltCommand('validate:yaml:lint:files', ['file_list' => 'docroot/themes/custom/test/one.yml']);
      } catch (\Exception $exception) {
        // Do nothing.
      }

      try {
        $this->invokeBltCommand('validate:yaml:lint:files', ['file_list' => 'docroot/themes/custom/test/two.yml']);
      } catch (\Exception $exception) {
        // Do nothing.
      }

    }
  }
  1. When I run:
$ blt run:yaml:lint:file

I get the following output:

$ blt run:yaml:lint:files
[warning] The xDebug extension is loaded. This will significantly decrease performance.
> validate:yaml:lint:files
Linting YAML files...
Iterating over fileset files.yaml...
''/var/www/meyers/vendor/bin/yaml-cli' lint '/var/www/meyers/docroot/themes/custom/nyunursing/one.yml'' exited with code 1 

[error]  Executing `'/var/www/meyers/vendor/bin/yaml-cli' lint '%s'` against fileset(s) files.yaml returned a non-zero exit code.`
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.
Command `validate:yaml:lint:files 'docroot/themes/custom/nyunursing/one.yml'` exited with code 1.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/
                                                    
 `validate:yaml:lint:files` finished with an error. 
                                                    
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
`validate:yaml:lint:files` finished successfully.

And I expected that violations would be found in one.yml and two.yml during each invocation.

With verbose output, BLT reports that the fileset is inexplicably empty:

$ blt run:yaml:lint:files -vvv

> validate:yaml:lint:files
Linting YAML files...
[debug] Gathering filesets from annotated methods...
[debug] Calling getFilesetPhpCustomModules on Acquia\Blt\Robo\Filesets\Filesets object...
[debug] Calling getFilesetPhpCustomThemes on Acquia\Blt\Robo\Filesets\Filesets object...
[debug] Calling getFilesetPhpTests on Acquia\Blt\Robo\Filesets\Filesets object...
[debug] Calling getFilesetFrontend on Acquia\Blt\Robo\Filesets\Filesets object...
[debug] Calling getFilesetTwig on Acquia\Blt\Robo\Filesets\Filesets object...
[debug] Calling getFilesetYaml on Acquia\Blt\Robo\Filesets\Filesets object...
[debug] Calling getFilesetFrontend on Acquia\Blt\Custom\Blt\Plugin\Filesets\Filesets object...
[debug] Calling getFilesetYaml on Acquia\Blt\Custom\Blt\Plugin\Filesets\Filesets object...
[debug] Calling getFilesetPhpCustomModules on Acquia\Blt\Custom\Blt\Plugin\Filesets\Filesets object...
[debug] Calling getFilesetPhpCustomThemes on Acquia\Blt\Custom\Blt\Plugin\Filesets\Filesets object...
[debug] Calling getFilesetPhpTests on Acquia\Blt\Custom\Blt\Plugin\Filesets\Filesets object...
[debug] Calling getFilesetTwig on Acquia\Blt\Custom\Blt\Plugin\Filesets\Filesets object...
Iterating over fileset files.yaml...
[ParallelExec] '/var/www/meyers/vendor/bin/yaml-cli' lint '/var/www/meyers/docroot/themes/custom/nyunursing/one.yml'
[ParallelExec]  ''/var/www/meyers/vendor/bin/yaml-cli' lint '/var/www/meyers/docroot/themes/custom/nyunursing/one.yml'' exited with code 1 
  Time 0.101s
[ParallelExec]  Exit code 1  Time 0.101s
''/var/www/meyers/vendor/bin/yaml-cli' lint '/var/www/meyers/docroot/themes/custom/nyunursing/one.yml'' exited with code 1 

[error]  Executing `'/var/www/meyers/vendor/bin/yaml-cli' lint '%s'` against fileset(s) files.yaml returned a non-zero exit code.`
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.
Command `validate:yaml:lint:files 'docroot/themes/custom/nyunursing/one.yml'` exited with code 1.
For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/
                                                    
 `validate:yaml:lint:files` finished with an error. 
                                                    
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
> validate:yaml:lint:files
Linting YAML files...
[info] No files were found in fileset files.yaml. Skipped.
`validate:yaml:lint:files` finished successfully.
9.433s total time elapsed.
@hkorik hkorik added the Bug Something isn't working label Nov 4, 2020
hkorik added a commit to hkorik/blt that referenced this issue Nov 4, 2020
danepowell added a commit that referenced this issue Nov 5, 2020
Co-authored-by: Dane Powell <git@danepowell.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant