diff --git a/Dockerfile b/Dockerfile index 7f78d57f..eff1a06b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,6 +52,7 @@ RUN ARCH=$(uname -m) && \ libxslt-devel \ make \ openssl-devel \ + podman \ python3-devel \ python3-pip \ python3-virtualenv \ diff --git a/bin/build.rb b/bin/build.rb index eb53d618..a803235e 100755 --- a/bin/build.rb +++ b/bin/build.rb @@ -46,6 +46,8 @@ puts "\n\nTARBALL BUILT SUCCESSFULLY" +ManageIQ::RPMBuild::BuildContainers.new.build + # Build RPMs release_name = build_type == "release" ? git_ref : "" ManageIQ::RPMBuild::BuildCopr.new(release_name).generate_rpm diff --git a/lib/manageiq/rpm_build.rb b/lib/manageiq/rpm_build.rb index df2b3829..38cbed92 100644 --- a/lib/manageiq/rpm_build.rb +++ b/lib/manageiq/rpm_build.rb @@ -11,6 +11,7 @@ class String require 'manageiq/rpm_build/helper' require 'manageiq/rpm_build/build_copr' +require 'manageiq/rpm_build/build_containers' require 'manageiq/rpm_build/build_hotfix' require 'manageiq/rpm_build/build_uploader' require 'manageiq/rpm_build/generate_ansible_venv' diff --git a/lib/manageiq/rpm_build/build_containers.rb b/lib/manageiq/rpm_build/build_containers.rb new file mode 100644 index 00000000..43379fb3 --- /dev/null +++ b/lib/manageiq/rpm_build/build_containers.rb @@ -0,0 +1,19 @@ +module ManageIQ + module RPMBuild + class BuildContainers + include Helper + + attr_reader :manifest_dir + + def initialize + where_am_i + + @manifest_dir = MANIFEST_DIR + end + + def build + where_am_i + end + end + end +end diff --git a/rpm_spec/manageiq.spec.in b/rpm_spec/manageiq.spec.in index 1d559fde..0eaa6935 100644 --- a/rpm_spec/manageiq.spec.in +++ b/rpm_spec/manageiq.spec.in @@ -158,5 +158,22 @@ ln -s ./python3 %{buildroot}%{ansible_venv_root}/venv/bin/python # Copy manifest %{__cp} %{ansible_venv_builddir}/ansible_venv_manifest.csv %{buildroot}%{manifest_root} +############################# +# Install docker containers # +############################# + +%{__mkdir} -p %{buildroot}%{_sharedstatedir}/manageiq/data/containers +for gem_dir in %{gemset_builddir}/bundler/gems/*; do + if [[ ! -L $gem_dir ]]; then + for container_image in $gem_dir/content/containers/*; do + echo $container_image + if [[ -d $container_image ]]; then + echo "Loading $container_image" + podman load --root=%{buildroot}%{_sharedstatedir}/manageiq/data/containers/storage --input $container_image + fi + done + fi +done + %clean rm -rf $RPM_BUILD_ROOT diff --git a/rpm_spec/subpackages/manageiq-containers b/rpm_spec/subpackages/manageiq-containers new file mode 100644 index 00000000..f8c3314e --- /dev/null +++ b/rpm_spec/subpackages/manageiq-containers @@ -0,0 +1,11 @@ +%package containers +Summary: %{product_summary} Containers + +%description containers +%{product_summary} Containers + +%files +%{_sharedstatedir}/manageiq/data/containers + +%post containers +# TODO podman image import --root=/var/lib/manageiq/data/containers/storage /tmp/opentofu-runner_latest.tar diff --git a/rpm_spec/subpackages/manageiq-gemset-services b/rpm_spec/subpackages/manageiq-gemset-services index d171d484..ccd9b17a 100644 --- a/rpm_spec/subpackages/manageiq-gemset-services +++ b/rpm_spec/subpackages/manageiq-gemset-services @@ -32,3 +32,4 @@ done %files gemset-services %{_prefix}/lib/systemd/system/manageiq-providers* +%{_prefix}/lib/systemd/system/opentofu-runner*