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

Improve postinstall script resilience #69

Merged
merged 21 commits into from
Nov 7, 2024
Merged

Conversation

ncoghlan
Copy link
Collaborator

@ncoghlan ncoghlan commented Nov 5, 2024

  • Allow postinstall scripts to be executed with any Python interpreter (not just the deployed base runtime interpreter)
  • Generate layer config file as part of layers
  • Use a common postinstall script in all layers
  • Generate the deployed sitecustomize.py file from the layer config in the postinstall script
  • Add unit tests for the common postinstall script

Closes #66. Implements initial steps towards #19.

* Allow postinstall scripts to be executed with
  any Python interpreter (not just the deployed
  base runtime interpreter)
* Generate layer config file as part of layers
* Use a common postinstall script in all layers
* Generate the deployed `sitecustomize.py` file
  from the layer config in the postinstall script
* Add unit tests for the common postinstall script

Closes #66. Implements initial steps towards #19.
@ncoghlan ncoghlan closed this Nov 5, 2024
@ncoghlan ncoghlan reopened this Nov 5, 2024
@ncoghlan ncoghlan closed this Nov 5, 2024
@ncoghlan ncoghlan reopened this Nov 5, 2024
@ncoghlan ncoghlan closed this Nov 5, 2024
@ncoghlan ncoghlan reopened this Nov 5, 2024
@ncoghlan ncoghlan closed this Nov 5, 2024
@ncoghlan ncoghlan reopened this Nov 5, 2024
github-actions bot added a commit that referenced this pull request Nov 5, 2024
Update expected test output files from automated/expected-output/20241105-113208-d995f3c (source PR: #69)
@ncoghlan
Copy link
Collaborator Author

ncoghlan commented Nov 5, 2024

Need to avoid dependency on walk_up parameter to relative_to for Python 3.11:

src/venvstacks/stacks.py:1060: error: Unexpected keyword argument "walk_up" for "relative_to" of "PurePath" [call-arg]

@ncoghlan ncoghlan closed this Nov 5, 2024
@ncoghlan ncoghlan reopened this Nov 5, 2024
@ncoghlan ncoghlan closed this Nov 5, 2024
@ncoghlan ncoghlan reopened this Nov 5, 2024
@ncoghlan
Copy link
Collaborator Author

ncoghlan commented Nov 7, 2024

Latest Windows failures are due to the fake "absolute" paths in the postinstall tests lacking a drive letter, so they're not considered absolute on Windows.

I also worked out some new checks to add to the check_deployed_environment helper methods in the test suite that would have helped catch these problems earlier:

  • Change the get_exported_python callback to report the full environment path (not just its name)
  • Require that all reported sys.path entries by located within the parent of the environment path
  • The environment path must not be a child of the current working directory
  • The environment path must not be a child of the build environment's build path

@ncoghlan ncoghlan closed this Nov 7, 2024
@ncoghlan ncoghlan reopened this Nov 7, 2024
github-actions bot added a commit that referenced this pull request Nov 7, 2024
Update expected test output files from automated/expected-output/20241107-075720-9b79f96 (source PR: #69)
@ncoghlan
Copy link
Collaborator Author

ncoghlan commented Nov 7, 2024

Even with the new build and deployed environment sys.path checks passing, there appears to still be a problem with the layered environments not correctly picking up the items that are already installed in the lower layers.

@ncoghlan
Copy link
Collaborator Author

ncoghlan commented Nov 7, 2024

There are some relative paths that are not being correctly resolved (they're being resolved relative to the environment path rather than the base build path)

@ncoghlan ncoghlan closed this Nov 7, 2024
@ncoghlan ncoghlan reopened this Nov 7, 2024
github-actions bot added a commit that referenced this pull request Nov 7, 2024
Update expected test output files from automated/expected-output/20241107-105447-a10d4bc (source PR: #69)
Update expected test output files from automated/expected-output/20241107-105447-a10d4bc (source PR: #69)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@ncoghlan ncoghlan merged commit b960f32 into main Nov 7, 2024
13 checks passed
@ncoghlan ncoghlan deleted the more-resilient-postinstall branch November 7, 2024 11:21
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 this pull request may close these issues.

Postinstall scripts can fail silently when executed incorrectly
1 participant