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

PDK::Util::Bundler.ensure_bundle! causes parallel execution of pdk new test to fail #1074

Open
hsnodgrass opened this issue Apr 23, 2021 · 5 comments
Labels

Comments

@hsnodgrass
Copy link

Describe the bug
When running pdk new test --unit in PowerShell 7 via the ForEach-Object -Parallel cmdlet, the function PDK::Util::Bundler.ensure_bundle! causes failures due to the function moving the Gemfile.lock while the other executing parallel commands are checking for Gemfile.lock and attempting to move it.

To Reproduce

  • Using PowerShell 7, cd into a module directory
  • Run the following command Get-ChildItem -Path .\manifests\path\to\your\manifests\dir | ForEach-Object -Parallel { pdk new test --unit ('module::path::to::your::manifests::dir::' + $_.name -replace '.pp','') } -ThrottleLimit 20
    • The path and the namespace should reflect your module
  • Generating the tests will fail. You can verify that PDK::Util::Bundler.ensure_bundle! is the culprit by commenting out the following line in C:\Program Files\Puppet Labs\DevelopmentKit\private\ruby\<version>\lib\ruby\gems\<version>\gems\pdk-2.1.0\lib\pdk\cli\new:
    • # PDK::Util::Bundler.ensure_bundle!(puppet_env[:gemset]). Line 36 for me, may be different for you.
    • After commenting this line out, run the PowerShell command again and everything will work fine.

Expected behavior
Running pdk new test --unit in parallel should not fail. This would require either a command line flag to skip ensure_bundle! or alternate logic in ensure_bundle! that does not require moving Gemfile.lock.

Additional context

  • Your PDK installation method: installed via Chocolatey on Windows 10
  • Your PDK version: 2.1.0
  • Your operating system: Windows 10 build 19042 / PowerShell Core 7.1.3
@hsnodgrass hsnodgrass added bug needs-triage Newly created issue that has not been reviewed by a PDK contributor labels Apr 23, 2021
@jpogran
Copy link
Contributor

jpogran commented Apr 23, 2021

Thanks for the great bug report @hsnodgrass!

Unfortunately the ruby pdk internals were not designed to handle being executed in parallel. As you have found, there are a significant number of file system and gem operations that happen that expect to have exclusive access to files and folders during the operation. There isn't anything we can do at this time to help with this code path.

The good news is that we already have work in flight that address this kind of work with a new approach. We'll be communicating this approach in the coming weeks.

@jpogran
Copy link
Contributor

jpogran commented Jun 14, 2021

Hi @hsnodgrass I'd love to know if the new Puppet Content Templates can address this issue for you

@sanfrancrisko sanfrancrisko removed the needs-triage Newly created issue that has not been reviewed by a PDK contributor label Jun 21, 2021
@github-actions
Copy link

This issue has been marked stale because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete.

@github-actions
Copy link

This issue was closed because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete.

@chelnak chelnak reopened this Dec 14, 2022
@chelnak
Copy link
Contributor

chelnak commented Dec 14, 2022

Reopened. Should not have been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants