Skip to content

Conversation

bbetter173
Copy link

This pull request refactors the _py_lambda_tar_impl function in aws/private/py_lambda.bzl to ensure all parent directories are explicitly created when generating the mtree specification.

Fixes #103

Key Changes:

Directory Management Enhancements:

  • Added a new helper function _get_parent_dirs to compute all parent directories of a given path. This ensures that directory hierarchies are correctly identified.
  • Introduced a created_dirs set to track already-created directories, preventing duplicate entries in the mtree list.
  • Replaced implicit directory creation with explicit calls to _ensure_parent_dirs, ensuring all parent directories for files and directories are correctly handled.

Changes are visible to end-users: no

Test plan

  • Manual testing; please provide instructions so we can reproduce:

Confirm that the resulting tar archive has all directories added using tar tf <tar_file>. Compare against previous versions.

Note: I am not experienced in Bazel and there may be better ways to achieve the same result. I'm happy to make some small changes if requested but not overly motivated to dig much further.

@CLAassistant
Copy link

CLAassistant commented Jul 14, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alexeagle
Copy link
Member

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.

[Bug]: Lambda Deployment fails with "InvalidImage: MissingParentDirectory: Parent directory does not exist for file: ..."
3 participants