Skip to content

[WIP] containerized build tools - #56711

Closed
phlogistonjohn wants to merge 12 commits into
ceph:mainfrom
phlogistonjohn:jjm-containerized-build
Closed

phlogistonjohn wants to merge 12 commits into
ceph:mainfrom
phlogistonjohn:jjm-containerized-build

Conversation

@phlogistonjohn

@phlogistonjohn phlogistonjohn commented Apr 4, 2024 •

Copy link
Copy Markdown
Contributor

This is a messy work-in-progress branch that provides tools for building ceph and running the tests within containers. This is NOT a tool to build container images for ceph. It either spits out binaries, packaged binaries, or executes test code.

Ideally, this has two use cases:

  1. Use on build nodes, isolating the build environment from the real host os. This allows builders to be homogeneous with the containers provding the build dependencies.
  2. Use on indvidual developer machines. Running Fedora and want to build ubuntu binaries, or centos packages? The included build script should help you do it.

The initial effort, started by Ernesto, was focused on use case 1. This was difficult for me to iterate on since I lack experience and access to Jenkins, so I mainly worked on use case 2.

The current state of the branch is a bit of a mess. I have a number of "hacks" and workarounds that have accumulated over time. Due to lack of time and focus on this task I have not been able to properly get real fixes into the project. But it's not a huge, insurmountable amount of changes either.

Finally, a quick mini-tutorial for the script:

./src/script/build-in-container.sh   -d centos8  -b _build_20240401  -x--user=0  -r configure-if-needed -r build

Breaking this example command down:

  • -d / --distro - what base distro to use. Supported values: centos8, centos9, ubuntu22.04
  • -b / --build-dir - a directory for build artifacts (bind mounted into container)
  • -x--user=0 - override container user, needed for bind mount
  • -r / --recipe - build task to perform, Examples include: configure-if-needed, build, build-tests, run-tests, make-srpm, rpmbuild

I last tested it on 2024-04-01 using the above command successfully, but it's very raw so YMMV.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@zmc

zmc commented Apr 4, 2024

Copy link
Copy Markdown
Member

This is really exciting John!

Sadly I wasn't able to make the infrastructure meeting today, but I've been doing some work that could potentially complement this. I'm also thinking about reliability and speed, but I'm experimenting with compiler caching and also distributed compilation and shared caching via sccache, a tool that Mozilla created to help with Firefox.

I'm hoping to set up a group of build servers that can be used at least by our build system, and making the shared cache available initially as read-only to all Ceph developers; that way, the build servers may be able to keep the shared cache relatively warm in a secure way. sccache does feature robust authentication, and if we wanted to open up read-write access to individuals we could look at that down the road.

I'm working on a Dockerfile that uses a multi-stage build, with the aim of building that image nightly and hosting it publicly, hoping it can shave some time off peoples' daily workflow by not having to build it. Its stages are currently:

  • Installing infrequently-changed dependencies
  • Running install-deps.sh
  • Installing sccache
  • Building ceph (as the container is run, like yours)

I'm aiming to enable the same image to be used by our build infrastructure and by individuals on their laptop. Using sccache would be optional.

Noting some differences I see between our WIPs:

  • I'm not currently using a Jenkinsfile
  • I'm not currently using the run-make-check.sh path (or running any tests)
  • I'm currently only trying to support Centos 9.Stream
  • I'm not currently adding any new scripts to ceph.git
  • sccache

I'd love to collaborate if any of this looks attractive to you!

@phlogistonjohn

Copy link
Copy Markdown
Contributor Author

Let's keep talking about this for sure. My time on this topic is a bit limited as my priority is smb but I have been tinkering with this well over a year. Using a distributed cache is interesting. I have not seen much of a benifit with ccache in the container and I have not had time to debug why - my suspicion is user id mapping.

@zmc

zmc commented Apr 4, 2024

Copy link
Copy Markdown
Member

Debugging caching can be tricky! I haven't had issues with uid mapping (yet), but another snag with many compiler cachers is that paths have to be identical in order to get cache hits. Building in a container happens to be a great way to ensure identical paths! I have seen rebuilds on main after wiping the build dir take ~8m, using a remote redis cache.

@phlogistonjohn

phlogistonjohn commented Apr 4, 2024 •

Copy link
Copy Markdown
Contributor Author

One other thought: I have a tendency to want to re-write complex shell scripts in python. The current shell script is complex enough that it's giving me that itch. However, I don't want to limit the number of users & possible contributors too much. So I'm ok leaving it in bash, but if there's no objection I think I might switch languages. Ceph uses python pretty thoroughly but I figure I would ask anyway.

@github-actions

github-actions Bot commented Apr 8, 2024

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@github-actions

github-actions Bot commented Jun 7, 2024

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

phlogistonjohn and others added 12 commits July 19, 2024 09:29
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Co-authored-by: Ernesto Puerta <[email protected]>
Co-authored-by: John Mulligan <[email protected]>
Signed-off-by: Ernesto Puerta <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
This helper script exists in order to create a build container and
execute the ceph build within that container on a system that has bash
and podman or docker installed. It is designed to supplement and help
test the containerized build jenkins integration.

Thanks-to: Xavi Hernandez - for helping me test this script

Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: Ernesto Puerta <[email protected]>

xxx: include-exclude lib-build.sh

Signed-off-by: John Mulligan <[email protected]>

xxx: include debian dir for installing debian deps

Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
Signed-off-by: John Mulligan <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions Bot added the stale label Sep 17, 2024
@phlogistonjohn phlogistonjohn mentioned this pull request Sep 17, 2024
4 of 14 tasks
@phlogistonjohn

Copy link
Copy Markdown
Contributor Author

Replaced with #59841

@phlogistonjohn
phlogistonjohn deleted the jjm-containerized-build branch February 7, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants