-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add clearer directions for custom test suite vars in Makefile. #6764
Add clearer directions for custom test suite vars in Makefile. #6764
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
For testing this, I made sure with
@dsillman2000, do take a look and let me know if you dis/like this behavior and whether the comments are now un/clear. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today I Learned
Reading here, it looks like the make
command allows for overriding variables!
Consider a Makefile
defined like:
DBT_TEST_USER_1 := "dbt_test_user_1"
DBT_TEST_USER_2 := "dbt_test_user_2"
DBT_TEST_USER_3 := "dbt_test_user_3"
RUSTFLAGS := "-D warnings"
LOG_DIR := "./logs"
DBT_LOG_FORMAT := "json"
CI_FLAGS =\
DBT_TEST_USER_1=$(DBT_TEST_USER_1)\
DBT_TEST_USER_2=$(DBT_TEST_USER_2)\
DBT_TEST_USER_3=$(DBT_TEST_USER_3)\
RUSTFLAGS=$(RUSTFLAGS)\
LOG_DIR=$(LOG_DIR)\
DBT_LOG_FORMAT=$(DBT_LOG_FORMAT)
test:
@echo $(CI_FLAGS)
Then run:
make test
The output is:
DBT_TEST_USER_1=dbt_test_user_1 DBT_TEST_USER_2=dbt_test_user_2 DBT_TEST_USER_3=dbt_test_user_3 RUSTFLAGS=-D warnings LOG_DIR=./logs DBT_LOG_FORMAT=json
Then run this instead:
make test LOG_DIR=/tmp DBT_LOG_FORMAT=text
The output changes accordingly:
DBT_TEST_USER_1=dbt_test_user_1 DBT_TEST_USER_2=dbt_test_user_2 DBT_TEST_USER_3=dbt_test_user_3 RUSTFLAGS=-D warnings LOG_DIR=/tmp DBT_LOG_FORMAT=text
Suggestion
If we use the variable definitions from the Makefile
above, then we can just use the following in both places where it is relevant (without if statements or a filter or a new USE_DEFAULT_CI_FLAGS
variable):
$(CI_FLAGS) $(DOCKER_CMD) tox -e py-integration -- -nauto
This would allow the user to override any variables when desired without needing to make any edits within the Makefile
.
Interested to hear your feedback on this suggestion!
Yeah, that's one (of 4 lol) way(s) to do it 😉 With so many though, and thinking how unix environment variable overriding might not be the most intuitive thing, that dbt users might prefer a way to just load up their Makefile and forget about it rather than reconstructing the massive env_var string on the command line every time (or digging through history logs, or writing their own shortcut scripts, or whatever). 🤷♀️ Like what you said is true, and I wish I would have said in the PR originally that I had considered this. But suffice to say, my guess was that wasn't the right solution for here since we like to template out everything for users. If we trust that anyone using the Makefile is a power user who can be bothered to futz around with Bash and write their own scripts/aliases (not sure I'm confident about that), then sure, I'd prefer what you wrote. Also what you wrote uses tl;dr let's decide upon a use of syntax that is consistent across all tooling and whether we should encourage people to edit Makefile tooling or not. |
It probably makes sense not to encourage editing the Makefile on second thought, but I'm not convinced what you're suggestion is really the best solution for our users. Let me go back to the drawing board on this for just a sec. Something I want to try. |
@@ -6,18 +6,29 @@ ifeq ($(USE_DOCKER),true) | |||
DOCKER_CMD := docker-compose run --rm test | |||
endif | |||
|
|||
LOGS_DIR := ./logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collapsed this variable into the LOG_DIR
variable used in our CI
Alright @dbeatty10 what about this scheme? Trying for best of all worlds, no make expertise required to override variables; just make a When it's empty or not made, here's the result of Also, don't mind missing quotes. They are treated as a single string in bash/python jobs. No I don't understand why make insists displaying values this way 😭 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nonblocking comment on the contributing doc, otherwise nothing stands out. I'd recommend getting a 👍 from someone other than myself before merging as I am not familiar with our Makefile or CI flags.
e5aa627
to
7e2cbb9
Compare
@@ -6,18 +6,26 @@ ifeq ($(USE_DOCKER),true) | |||
DOCKER_CMD := docker-compose run --rm test | |||
endif | |||
|
|||
LOGS_DIR := ./logs | |||
# | |||
# To override CI_flags, create a file at this repo's root dir named `makefile.test.env`. Fill it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doug and I decided for now it's better to just have this note here, since anyone interested in overriding the Makefile would be the type of person who needs this information. Better not to clutter the CONTRIBUTING.md
with very specific information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Thanks for your work on this @VersusFacit !
resolves #6689
Description
The makefile is being used by community members after all! Hooray! Except, it's unclear how to use it. Booo.
Fixing that up:
History
I remember now! We did it this way because at the time it was super unclear how to inline an if-else in 1976's GNU Make. Well, I found a jacked up way to do it with
filter
!Checklist
changie new
to create a changelog entry