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

ci: workflow to build and publish the stacks-node image used internally for integration tests #1497

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zone117x
Copy link
Member

@zone117x zone117x commented Dec 22, 2022

PR against master branch so that the github "run workflow" UI is available.

The API pulls a pre-built image for the stacks-node, used for both local development and in CI tests. Currently, it's pulling from another repo:

FROM --platform=linux/amd64 zone117x/stacks-api-e2e:stacks2.1-21295d3 as build

This PR creates a workflow dispatch to build and publish the testing stacks-node docker image. Once merged, a follow-up PR will change the above code to use the image produced by this repo.

Cross-compilation optimizations are implemented to build both x86 and arm64 images (without taking several hours).

Image tags use the short git commit hash -- this can be improved later once the stacks-blockchain next branch stabilizes (e.g. with an RC).

See demo run here: https://github.com/hirosystems/stacks-blockchain-api/actions/runs/3759601436/jobs/6389358450

@zone117x zone117x requested a review from CharlieC3 December 22, 2022 17:24
Copy link
Member

@CharlieC3 CharlieC3 left a comment

Choose a reason for hiding this comment

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

Can you clarify what the difference is between the docker image being built in this workflow compared to the image built in the stacks-blockchain repo for the desired branch? I may be missing some context, but they appear to be getting built the same way, with the only difference possibly being the supported platforms.

If the workflow in the stacks-blockchain repo does not currently fit your need, it may make more sense to modify it in the origin repo rather than maintain an orphaned build process in a separate repository. Additionally, if this is for integration testing we should try to use the same images built and published from the stacks-blockchain repo if possible for them to be considered valid.

What are your thoughts?

Comment on lines +18 to +19
- name: Checkout
uses: actions/checkout@v3
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this step can be used to checkout the stacks-blockchain repo instead of the api repo

Copy link
Member Author

Choose a reason for hiding this comment

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

It checks out the API repo to grab the dockerfile (in this repo) used in a job later down. That could be changed to pull the dockerfile via a git uri but the syntax isn't very nice.

@zone117x
Copy link
Member Author

the only difference possibly being the supported platforms.

Yep that's the primary difference (arm64 in particular).

If the workflow in the stacks-blockchain repo does not currently fit your need, it may make more sense to modify it in the origin repo rather than maintain an orphaned build process in a separate repository. Additionally, if this is for integration testing we should try to use the same images built and published from the stacks-blockchain repo if possible for them to be considered valid.

Yeah, I think that makes sense. One barrier here would be that even with the cross-arch compilation technique used in this PR, it still adds around 15 minutes to the build time for the image (and we'd still want it building imagines on each branch, at least for now). Perhaps the blockchain repo maintainers would be alright with that though. I'll try to get a PR out on that repo, then we can re-consider this PR if that doesn't pan out.

@CharlieC3
Copy link
Member

Perhaps the blockchain repo maintainers would be alright with that though. I'll try to get a PR out on that repo, then we can re-consider this PR if that doesn't pan out.

If I'm not mistaken, I think jwiley has already completed this work here: stacks-network/stacks-core#3199
I believe he's planning on merging it after 2.1 considering its size. If you're able to hold off until then, I believe it should work for you. If not, then I think this PR would be a good workaround in the short-term with the intention to switch over once jwiley's PR is merged.

@zone117x
Copy link
Member Author

We're still blocked on upstream adding ARM64 support. And we might also need this workflow for the upcoming Stacks v2.2 release. Leaving this PR as-is for now.

@zone117x
Copy link
Member Author

This should be re-addressed closer to Stacks 3.0 release to see if cross-platform stacks-node images are available from core repo

@smcclellan
Copy link
Contributor

@zone117x Are we still waiting for this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

3 participants