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

Adopt bzlmod to build the repository #77

Merged
merged 15 commits into from
Oct 7, 2024

Conversation

manuelnaranjo
Copy link
Contributor

@manuelnaranjo manuelnaranjo commented Jul 16, 2024

Introducing bzlmod support to the repo. For bzlmod we don't support Bazel < 6.

We expose a basic extension so others can start using bazeldnf. We provide a legacy mode that has a lot of RPM information on MODULE.bazel and exposes 1 bazel repository per RPM, then there's another non legacy mode where we provide a proxy repository to reduce some complexity out of MODULE.bazel and finally there's a mode with a json lock file to move all the RPM tracking into a non starlark file. We don't provide yet a way to generate such lock file. All this modes get an e2e test.

On top of this we also allow to use a prebuilt and non prebuilt bazeldnf binary. When building the binary if we're in bazel 7+ then we use a prebuilt protoc which speeds up the build considerably.

Here's a sample of the release CI artifacts pipeline

This builds on top of #76

@manuelnaranjo manuelnaranjo force-pushed the mnaranjo/repo-uses-bzlmod branch 7 times, most recently from b1cbf2e to 7917ec9 Compare July 22, 2024 10:00
@manuelnaranjo
Copy link
Contributor Author

@rmohr this is ready for a review, it looks bigger than it is because of all of the e2e tests with different mode and repetated files. I can split it into smaller PRs if you want, but I think it's worth to review as whole

@genert
Copy link

genert commented Jul 30, 2024

Ping @rmohr

@manuelnaranjo manuelnaranjo force-pushed the mnaranjo/repo-uses-bzlmod branch 2 times, most recently from 8cd688b to e8ad817 Compare August 27, 2024 06:37
The repository uses bzlmod to build, getting all it's external
dependencies through bzlmod instead of the WORKSPACE
Stop waisting valuable CI time in protoc building
Prebuilts are now handled differently and require a proper release
process, in order to allow forks to also release we need to consume
GITHUB_REPOSITORY while rendering the repo files.

To build our binary and provide a prebuilt for those consuming over
bzlmod, then we need a better repository structure.

Change the release process, which is now heaviliy inspired in
https://github.com/aspect-build/bazel-lib which also provides a few
prebuilt golang binaries
Adding a tag that allows to expose an rpm file, similar to the approach
we have in WORKSPACE mode
Adding the bzlmod to our CI tests
@manuelnaranjo manuelnaranjo force-pushed the mnaranjo/repo-uses-bzlmod branch from e8ad817 to f9fe1e4 Compare August 27, 2024 06:45
Adding tests that build the bazeldnf binary before doing it's work
Introducing a proxy repository to make it easier to consume rpms by not
polluting the public repository namespace
Adding a very basic lock file support, we don't generate the lock file
yet, this will come in the future. It allows reducing complexity from
MODULE.bazel though
Now gazelle can handle skylib targets, which are used by stardoc
Now we can generate the markdown files describing our interface from our
code
When consuming bazeldnf most of the time users don't want to build the
binary
The release script had a typo
CI was pulling the wrong binary name, artifacts have a version prefix
My version string had a v prefixed which was wrong
The release workflow is spending more time in updating the cache than
building, and there's no benefit as consecutive builds will get a
different cache anyway
@manuelnaranjo manuelnaranjo force-pushed the mnaranjo/repo-uses-bzlmod branch from f9fe1e4 to 57e5310 Compare August 27, 2024 06:49
@manuelnaranjo
Copy link
Contributor Author

@genert FYI I'm already using bazeldnf through bzlmod with:

bazel_dep(name = "bazeldnf", version = "0.6.0-rc15")

archive_override(
    module_name = "bazeldnf",
    integrity = "sha256-qiYE43sJTWcwBblzOXT41GzTdR6G26FVIrrx/Y8xMk0=",
    urls = [
        "https://github.com/bookingcom/bazeldnf/releases/download/v0.6.0-rc16/bazeldnf-v0.6.0-rc16.tar.gz"
    ],
    strip_prefix = "bazeldnf-v0.6.0-rc16",
)

This is enough to start getting it tested while we get Roman's attention again

@manuelnaranjo
Copy link
Contributor Author

ping @rmohr, maybe you're back from holidays now?

@rmohr
Copy link
Owner

rmohr commented Oct 7, 2024

Excellent! Thanks so much!

@rmohr rmohr merged commit 7fd6f51 into rmohr:main Oct 7, 2024
13 checks passed
This was referenced Oct 7, 2024
@manuelnaranjo manuelnaranjo deleted the mnaranjo/repo-uses-bzlmod branch October 8, 2024 01:20
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