Generate a build environment container image.
(ctx)
| 719 | |
| 720 | @Builder.set(Steps.BUILD_CONTAINER) |
| 721 | def build_container(ctx): |
| 722 | """Generate a build environment container image.""" |
| 723 | ctx.build.wants(Steps.DNF_CACHE, ctx) |
| 724 | cmd = [ |
| 725 | ctx.container_engine, |
| 726 | "build", |
| 727 | "--pull", |
| 728 | "-t", |
| 729 | ctx.image_name, |
| 730 | f"--label=io.ceph.build-with-container.src={_hash_sources()}", |
| 731 | f"--label=io.ceph.build-with-container.image-variant={ctx.variant()}", |
| 732 | f"--build-arg=CEPH_BASE_BRANCH={ctx.base_branch()}", |
| 733 | ] |
| 734 | if ctx.cli.distro: |
| 735 | cmd.append(f"--build-arg=DISTRO={ctx.from_image}") |
| 736 | if ctx.dnf_cache_dir and "docker" in ctx.container_engine: |
| 737 | log.warning( |
| 738 | "The --volume option is not supported by docker build/buildx. Skipping dnf cache dir mounts" |
| 739 | ) |
| 740 | elif ctx.dnf_cache_dir: |
| 741 | cmd += [ |
| 742 | f"--volume={ctx.dnf_cache_dir}/lib:/var/lib/dnf:Z", |
| 743 | f"--volume={ctx.dnf_cache_dir}:/var/cache/dnf:Z", |
| 744 | "--build-arg=CLEAN_DNF=no", |
| 745 | ] |
| 746 | if ctx.packages_build(): |
| 747 | cmd.append("--build-arg=FOR_MAKE_CHECK=false") |
| 748 | crimson_build = ctx.crimson_build() |
| 749 | if crimson_build is not None: |
| 750 | # the WITH_CRIMSON var is false only when empty (in install-deps) |
| 751 | with_crimson = '1' if crimson_build else '' |
| 752 | cmd.append(f"--build-arg=WITH_CRIMSON={with_crimson}") |
| 753 | if ctx.cli.build_args: |
| 754 | cmd.extend([f"--build-arg={v}" for v in ctx.cli.build_args]) |
| 755 | cmd += ["-f", ctx.cli.containerfile, ctx.cli.containerdir] |
| 756 | with ctx.user_command(): |
| 757 | _run(cmd, check=True, ctx=ctx) |
| 758 | |
| 759 | |
| 760 | def _check_cached_image(ctx): |
nothing calls this directly
no test coverage detected