Bug #22958
closedBuild package build Docker images with Ansible
Description
Spun out of #22943. Do this after building the basic infrastructure in #22957.
- The big list of packages in
install-test-env.ymlcurrently has comments indicating what packages support what builds. Probably using variables, or maybe a group, provide a way to run the playbook so you only install the dependencies for a subset of tasks (e.g., building packages, building Python, building JavaScript, etc.). Extend the playbook to respect this list throughout.- We are going to want a general solution for this later to build test Docker images for specific components, so might as well build it now rather than a separate package build playbook.
- Extend
install-test-env.ymlto support Red Hat distros. Make sure every Debian-specific task has a Red Hat equivalent. (Hint: Use theansible_pkg_mgrfact which is either"apt"or"rpm".) - Extend
install-test-env.ymlto install gems likefpmto support package building. - Add definitions for package build Docker images to the inventory added in #22957.
- Update our package build scripts to use Ansible to build these images instead of
docker build. - Update
build/READMEto reflect how to add a new distribution to this system.
Updated by Brett Smith 10 months ago
22958-ansible-docker-package-builds @ 789804194674e671dddfb56cff5f124558da3780 - build-packages-rocky9: #3
- All agreed upon points are implemented / addressed. Describe changes from pre-implementation design.
- Yes. The branch splits up the big development playbook to assign different host groups to different dependecy tasks. The main groups in use now are
arvados_build_one_target(for building a packaging Docker image) andarvados_test_all(to install everything needed for Arvados development).
- Yes. The branch splits up the big development playbook to assign different host groups to different dependecy tasks. The main groups in use now are
- Anything not implemented (discovered or discussed during work) has a follow-up story.
- N/A
- Code is tested and passing, both automated and manual, what manual testing was done is described.
- See above. Manually tested ubuntu2004 and rocky8 targets.
- New or changed UI/UX and has gotten feedback from stakeholders.
- N/A
- Documentation has been updated.
- Yes.
- Behaves appropriately at the intended scale (describe intended scale).
- As before, this build is probably slower due to the overhead of Ansible, but we're paying that price for code deduplication.
- Considered backwards and forwards compatibility issues between client and server.
- This does rename the main playbook to better reflect its expanded scope. This change will need to be carried over to the Jenkins Ansible stuff. That's a straightforward search-and-replace.
- Follows our coding standards and GUI style guidelines.
- N/A
Updated by Lucas Di Pentima 9 months ago
Here're some questions & comments:
- File
tools/ansible/install-dev-tools.ymlLine 26: Trailing colon typo on the example comment. - File
tools/ansible/files/default-test-config.ymlstill mentions the old playbook nameinstall-test-env.yml - File
build/READMEmight need an update: Mentioning ansible as a prerequisite will be helpful. - Got the following error while trying run-build-test-package-one-target.sh:
- ModuleNotFoundError: No module named 'requests'
- Fixed by installing it manually via pip inside the ansible virtualenv
- (Only when using
--target ubuntu2204,rockyNor otherubuntuNNNNversions don't seem to have issues) cgo: C compiler "aarch64-linux-gnu-gcc" not found: exec: "aarch64-linux-gnu-gcc": executable file not found in $PATH- This happens when no
--arch=Xis used or when passing--arch=arm64, obviously. - The args help say that when no
--arch=Xis passed, it will build the packages in the native architecture, so maybe something got lost in the way (or this documentation was already wrong)
- This happens when no
Updated by Brett Smith 9 months ago
Lucas Di Pentima wrote in #note-5:
- File
tools/ansible/install-dev-tools.ymlLine 26: Trailing colon typo on the example comment.
No, that colon is important. Ansible expects hosts to be a hash where every key is a hostname and every value is a hash of host variables, which can optionally be null. The trailing colon is what makes the hostname a dictionary key and not a string. See the Ansible inventory documentation for examples, including exactly this.
- File
tools/ansible/files/default-test-config.ymlstill mentions the old playbook nameinstall-test-env.yml- File
build/READMEmight need an update: Mentioning ansible as a prerequisite will be helpful.
Done.
- Got the following error while trying run-build-test-package-one-target.sh:
- ModuleNotFoundError: No module named 'requests'
I can't reproduce if I follow the instructions in tools/ansible/README.md. Notice requests mentioned in the last line here:
arvdev % py -m venv ~/Scratch/venv arvdev % ~/Scratch/venv/bin/pip install -r tools/ansible/requirements.txt […] Successfully installed MarkupSafe-3.0.2 PyYAML-6.0.2 ansible-core-2.15.13 argcomplete-3.6.2 certifi-2025.4.26 cffi-1.17.1 charset_normalizer-3.4.2 cryptography-45.0.4 docker-7.1.0 idna-3.10 jinja2-3.1.6 packaging-25.0 pycparser-2.22 requests-2.32.4 resolvelib-1.0.1 tomlkit-0.13.3 urllib3-2.4.0 xmltodict-0.14.2 yq-3.4.3
Did you do the same? Hopefully the pointer in build/README will help with this.
- (Only when using
--target ubuntu2204,rockyNor otherubuntuNNNNversions don't seem to have issues) cgo: C compiler "aarch64-linux-gnu-gcc" not found: exec: "aarch64-linux-gnu-gcc": executable file not found in $PATH
We discussed at standup that we were okay dropping support for arm64 packages, since they've never been in production or fully baked. I have updated the documentation and build scripts to account for this change.
Now at 7058804ef5c767a1791f857efe632b682c815c06. build-packages-rocky9: #4
Updated by Lucas Di Pentima 9 months ago
Brett Smith wrote in #note-6:
- ModuleNotFoundError: No module named 'requests'
I can't reproduce if I follow the instructions in
tools/ansible/README.md. Notice requests mentioned in the last line here:[...]
Did you do the same? Hopefully the pointer in
build/READMEwill help with this.
Sorry, was using a previous virtualenv that hadn't all the dependencies installed.
Now at 7058804ef5c767a1791f857efe632b682c815c06. build-packages-rocky9: #4
This LGTM, thanks!
Updated by Brett Smith 9 months ago
- Status changed from In Progress to Resolved
It works: build-packages-multijob: #4684
Updated by Brett Smith 9 months ago
- Related to Bug #22921: Upgrade fpm in package-build-dockerfiles added