Feat(support): mac os + stacks node from commit#29
Feat(support): mac os + stacks node from commit#29ASuciuX wants to merge 3 commits intostacks-network:masterfrom
Conversation
BowTiedRadone
left a comment
There was a problem hiding this comment.
Thank you for opening the PR! I believe it brings much value. Left a few comments, but I'd also wait for @wileyj to check as well 🙏
| $(CHAINSTATE_DIR): | ||
| @if [ ! -d "$(CHAINSTATE_DIR)" ]; then \ | ||
| mkdir -p $(CHAINSTATE_DIR); \ | ||
| if [ "$(TARGET)" = "up" ]; then \ |
There was a problem hiding this comment.
Can we re-add @ and remove all the nested \s? It's visually better.
There was a problem hiding this comment.
I added the backslashes manually because they make the intent explicit by defining how multi-line commands are interpreted. I've followed the documented convention https://www.gnu.org/software/make/manual/html_node/Splitting-Recipe-Lines.html
The previous implementation was functioning correctly, so we can keep it as it was if you prefer.
There was a problem hiding this comment.
I'd say let's keep as it was before (only to minimize the current PR's diff), and eventually consider making Makefile more explicit in a separate issue.
| docker compose -f docker/docker-compose.yml --profile default -p $(PROJECT) down | ||
| @if [ -f .current-chainstate-dir ]; then \ | ||
| rm -f .current-chainstate-dir | ||
| rm -f .current-chainstate-dir; \ |
There was a problem hiding this comment.
Is this addition needed?
There was a problem hiding this comment.
technically no, since it's the end of the conditional
| docker compose -f docker/docker-compose.yml --profile default -p $(PROJECT) down | ||
| @if [ -f .current-chainstate-dir ]; then \ | ||
| rm -f .current-chainstate-dir | ||
| rm -f .current-chainstate-dir; \ |
There was a problem hiding this comment.
Same here regarding \.
There was a problem hiding this comment.
I guess all these side changes were created by a formatter. I'm curious what's the formatter, maybe we can take it into account for our CI. We're currently using dclint for docker-compose related files, but one for Makefile would be a great idea.
There was a problem hiding this comment.
makefile linter would be great! i think it would be challenging since we use a "shell-ified" makefile though
| # Clone efficiently: shallow for branches/tags, targeted fetch for commits | ||
| # This avoids downloading the full 2GB+ history | ||
| RUN git init /code/stacks-core && \ | ||
| cd /code/stacks-core && \ | ||
| git remote add origin https://github.com/stacks-network/stacks-core.git && \ | ||
| git fetch --depth=1 origin $STACKS_CORE_BASE_BRANCH && \ | ||
| git checkout FETCH_HEAD |
There was a problem hiding this comment.
alternatively, what about cloning a single branch and then checkout? this will work, but wouldn't git clone --single-branch work and use less lines?
There was a problem hiding this comment.
I think this would require in the setup to specify for a wanted commit both the commit and the branch where the commit can be found, as otherwise it would not have it locally to checkout to.
ASuciuX
left a comment
There was a problem hiding this comment.
I can restore the format for the shell lines, as you think it would make more sense.
Also, I've seen that .ONESHELL can be used and that would mean that '' would not be used, it would treat all indented lines below as a single shell script, but I haven't used it before.
| $(CHAINSTATE_DIR): | ||
| @if [ ! -d "$(CHAINSTATE_DIR)" ]; then \ | ||
| mkdir -p $(CHAINSTATE_DIR); \ | ||
| if [ "$(TARGET)" = "up" ]; then \ |
There was a problem hiding this comment.
I added the backslashes manually because they make the intent explicit by defining how multi-line commands are interpreted. I've followed the documented convention https://www.gnu.org/software/make/manual/html_node/Splitting-Recipe-Lines.html
The previous implementation was functioning correctly, so we can keep it as it was if you prefer.
Co-authored-by: Radu Bahmata <92028479+BowTiedRadone@users.noreply.github.com>
BowTiedRadone
left a comment
There was a problem hiding this comment.
Just wrapped up another round of review. If you agree to rebase on top of latest from master, I can then easily use it to test locally on both macOS and Debian. For now, let's minimize the diff by removing backslashes (but keep the comment fixes).
| - &REWARD_RECIPIENT_2 ${REWARD_RECIPIENT_2:-ST2FW15NGB4H76FMVXKHYYSM865YVS6V3SA1GNABC} # priv: fe3087801196d8027008146b13e6d365920c2e4b7bc9969729ec2f0f22ef74fc01 | ||
| - &REWARD_RECIPIENT_3 ${REWARD_RECIPIENT_3:-ST2MES40ZEXTX9M4YXW9QSWHRVC9HYT419S198VPM} # priv: ed7eb063c61b8e892987228f1fcfb74eab5009568861613dc4b074b708a7893701 | ||
| - &STACKS_CORE_BASE_BRANCH ${STACKS_CORE_BASE_BRANCH:-3.3.0.0.1} | ||
| - &STACKS_CORE_BASE_BRANCH ${STACKS_CORE_BASE_BRANCH:-7ff75a23439879a1316b1423587bfd0dac17a44f} # branch, tag, or commit SHA |
There was a problem hiding this comment.
Do you want to rebase the branch on top of latest from master, keep the existing tag and keep the "branch, tag, commit" comment at the end?
| $(CHAINSTATE_DIR): | ||
| @if [ ! -d "$(CHAINSTATE_DIR)" ]; then \ | ||
| mkdir -p $(CHAINSTATE_DIR); \ | ||
| if [ "$(TARGET)" = "up" ]; then \ |
There was a problem hiding this comment.
I'd say let's keep as it was before (only to minimize the current PR's diff), and eventually consider making Makefile more explicit in a separate issue.
| docker compose -f docker/docker-compose.yml --profile default -p $(PROJECT) down | ||
| @if [ -f .current-chainstate-dir ]; then \ | ||
| rm -f .current-chainstate-dir | ||
| rm -f .current-chainstate-dir; \ |
Description
This PR adds support for running this environment on mac os.
It also adds support to run the nodes from a given commit, as until now it was only working with branches and github tags.
Type of Change
Does this introduce a breaking change?
It shouldn't break anything.
Testing information
Provide context on how tests should be performed.
Run each functionality on both linux and mac os and check the environment is behaving as it was before(on linux).