Fix Makefile Mac compatibility issues#221
Open
DovnarAlexander wants to merge 1 commit intoViktorUJ:masterfrom
Open
Fix Makefile Mac compatibility issues#221DovnarAlexander wants to merge 1 commit intoViktorUJ:masterfrom
DovnarAlexander wants to merge 1 commit intoViktorUJ:masterfrom
Conversation
The terragrint_run function had several shell syntax issues that prevented
it from working correctly on macOS:
1. Shell variable scoping problem:
- Each line with @ was executed in separate shell contexts
- Variables like run_type and commnand weren't persisting between commands
- Fixed by combining all commands into a single shell command using
line continuations (\) and semicolons
2. Variable expansion issues:
- Changed ${VAR} to $(VAR) for proper Make variable expansion
- Fixed shell variable references to use proper $$var syntax
3. Command execution problems:
- mkdir syntax: changed from 'mkdir $$dir -p' to 'mkdir -p "$$dir"'
- Added proper quoting around paths to handle spaces
- Fixed cp command path construction
4. Case statement syntax:
- Added proper line continuations to case statements
- Ensured all commands are part of the same shell context
These changes ensure the Makefile works identically on both Linux and macOS
while maintaining the same functionality. The terragrint_run function now
properly sets variables, creates directories, copies files, and executes
terragrunt commands as intended.
Tested with: USER_ID=test ENV_ID=01 TASK=01 make run_ckad_mock
Collaborator
|
Hi @DovnarAlexander ! GNU Make >= 4.2.1 On my mac with 26.0.1 default GNU Make version is 3.8.1 and it can be updated for example using homebrew. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The terragrint_run function had several shell syntax issues that prevented it from working correctly on macOS:
Shell variable scoping problem:
Variable expansion issues:
Command execution problems:
Case statement syntax:
These changes ensure the Makefile works identically on both Linux and macOS while maintaining the same functionality. The terragrint_run function now properly sets variables, creates directories, copies files, and executes terragrunt commands as intended.
Tested with: USER_ID=test ENV_ID=01 TASK=01 make run_cka_mock on both mac & linux (container)