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

fix: Zip source directory should read from sh_work_dir #560

Merged
merged 4 commits into from
Apr 12, 2024

Conversation

ANGkeith
Copy link
Contributor

@ANGkeith ANGkeith commented Apr 10, 2024

fixes #557

Description

adding back the declaration of sh_work_dir that was removed in #534 because the variable is required and consumed here

Also, had to refactor to write to a tempfile instead of using the fd

because in systems where /bin/sh -> /bin/dash, it would throw the following error
image

@ANGkeith ANGkeith force-pushed the master branch 2 times, most recently from 9acecd0 to bfa1bde Compare April 10, 2024 07:21
Signed-off-by: ANGkeith <ANGkeith@hotmail.sg>
@ANGkeith ANGkeith marked this pull request as draft April 10, 2024 08:01
@ANGkeith ANGkeith changed the title fix: :zip:embedded source directory should read from sh_work_dir fix: zip source directory should read from sh_work_dir Apr 10, 2024
@ANGkeith ANGkeith changed the title fix: zip source directory should read from sh_work_dir fix: Zip source directory should read from sh_work_dir Apr 10, 2024
@ANGkeith ANGkeith marked this pull request as ready for review April 10, 2024 08:51
Copy link
Contributor

@pdecat pdecat left a comment

Choose a reason for hiding this comment

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

This looks good to me overall!

I'm just concerned it will cause issues for powershell users (I don't use that myself, so can't confirm). @antonbabenko is that actually a platform that is supposed to be supported by this module?

Apart from that, a few changes and it should be good IMO.

tests/test_package_toml.py Outdated Show resolved Hide resolved
)
with tempfile.NamedTemporaryFile(mode="w+t", delete=True) as temp_file:
path, script = action[1:]
script = f"{script} && pwd >{temp_file.name}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this will break for powershell users, isn't it?

Maybe add a note that the pwd executed is required to determine the working dir of the subprocess shell after having executed all other commands. I find it a bit brittle, but now I understand that was a supported use case before #534.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this will break for powershell users, isn't it?

Not a powershell user too 😅 but hopefully this means we do not need to support pwsh
image

package.py Show resolved Hide resolved
@antonbabenko
Copy link
Member

Thanks for the contribution and for the review. I agree, that this code will most likely break for Powershell users but I am still unsure if this module is even working for people who are not using Windows emulators like cygwin. Let's review this PR as for Mac/Linux usage, and fix/improve it if necessary for Windows later (unless someone wants to check it on Windows).

@pdecat
Copy link
Contributor

pdecat commented Apr 10, 2024

We probably want to remove the powershell mention from this comment then: https://github.com/terraform-aws-modules/terraform-aws-lambda/pull/534/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R442

Copy link
Contributor

@pdecat pdecat left a comment

Choose a reason for hiding this comment

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

LGTM!

@antonbabenko antonbabenko merged commit f786681 into terraform-aws-modules:master Apr 12, 2024
29 checks passed
antonbabenko pushed a commit that referenced this pull request Apr 12, 2024
## [7.2.6](v7.2.5...v7.2.6) (2024-04-12)

### Bug Fixes

* Zip source directory should read from sh_work_dir ([#560](#560)) ([f786681](f786681))
@antonbabenko
Copy link
Member

This PR is included in version 7.2.6 🎉

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip install --no-deps in commands does not work
3 participants