Skip to content

Conversation

@ASuciuX
Copy link

@ASuciuX ASuciuX commented Dec 3, 2025

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

  • New feature

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).

Copy link
Contributor

@BowTiedRadone BowTiedRadone left a comment

Choose a reason for hiding this comment

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

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 \
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we re-add @ and remove all the nested \s? It's visually better.

Copy link
Author

Choose a reason for hiding this comment

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

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.

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; \
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this addition needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

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; \
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here regarding \.

Copy link
Contributor

@BowTiedRadone BowTiedRadone Dec 4, 2025

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

makefile linter would be great! i think it would be challenging since we use a "shell-ified" makefile though

Comment on lines 13 to 19
# 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
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this a lot! 💯

Copy link
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Author

Choose a reason for hiding this comment

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

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.

Copy link
Author

@ASuciuX ASuciuX left a comment

Choose a reason for hiding this comment

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

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 \
Copy link
Author

Choose a reason for hiding this comment

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

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>
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.

3 participants