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

Support concurrent access to shared PLATFORMIO_PACKAGES_DIR and PLATFORMIO_PLATFORMS_DIR for CI builds #4911

Open
1 task done
nomis opened this issue May 1, 2024 · 0 comments

Comments

@nomis
Copy link
Contributor

nomis commented May 1, 2024

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

Configuration

Operating system: Debian Testing

PlatformIO Version (platformio --version): 6.1.x

Description of problem

To avoid unnecessary HTTP downloads and package extractions on every CI build, I have shared the following directories across builds (which may run concurrently for different projects):

  • PLATFORMIO_CACHE_DIR
  • PLATFORMIO_PACKAGES_DIR
  • PLATFORMIO_PLATFORMS_DIR

The problem with this approach is that PlatformIO uses unversioned directory names for platforms and packages by default, and under some conditions it will only keep one unversioned name of a package (e.g. tool-scons), so concurrent builds will fail if the unversioned directory name is renamed or replaced with a different version while the build is running. This can happen if different projects use different versions of the same dependencies, or one or more projects use a version range and a new version becomes available.

I'd like to be able to configure PlatformIO to:

  • Always use versioned directory names so that concurrent builds won't interfere with each other
  • Keep old versions of platforms and packages indefinitely (I think check_prune_system_threshold will do some of this, but I observe it immediately deleting tool-scons when changing PlatformIO version)

I'm assuming the HTTP cache is already safe for concurrent access?

I realise that there may not be 100% compatibility between different versions of PlatformIO using the same unpacked files, but the content appears to be mostly read-only (and Python cache files are already versioned and should support concurrent access).

Additional info

The directories are shared in containers as bind mounts on Linux so locking of concurrent modifications using files inside the directories will work as expected.

Projects are never built concurrently with the same project directory, Jenkins will make a copy of the workspace for this, so the PLATFORMIO_WORKSPACE_DIR directory is always used sequentially.

I feel like there's a downside to caching HTTP downloads in that the registry will consider the content "unused" because it's not being downloaded on every build and some kind of opt-in "cache hit" notification may help mitigate this.

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

No branches or pull requests

2 participants