From bfed0c22f80bbef136f58c534b62f2ad9a287231 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Thu, 14 Mar 2024 13:06:02 -0400 Subject: [PATCH 1/3] Add opentofu-runner service --- rpm_spec/subpackages/manageiq-gemset-services | 1 + 1 file changed, 1 insertion(+) 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* From af8218087f8bd4851b78e2b58ec05c7a1b53a278 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Wed, 3 Apr 2024 13:52:08 -0400 Subject: [PATCH 2/3] Build Containers --- bin/build.rb | 2 ++ lib/manageiq/rpm_build/build_containers.rb | 19 +++++++++++++++++++ rpm_spec/subpackages/manageiq-containers | 8 ++++++++ 3 files changed, 29 insertions(+) create mode 100644 lib/manageiq/rpm_build/build_containers.rb create mode 100644 rpm_spec/subpackages/manageiq-containers 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/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/subpackages/manageiq-containers b/rpm_spec/subpackages/manageiq-containers new file mode 100644 index 00000000..446aaa1c --- /dev/null +++ b/rpm_spec/subpackages/manageiq-containers @@ -0,0 +1,8 @@ +%package containers +Summary: %{product_summary} Containers + +%description containers +%{product_summary} Containers + +%post containers +# TODO podman image import --root=/var/www/miq/vmdb/data/containers/storage /tmp/opentofu-runner_latest.tar From 0cc6f426a5603f12e3b22695a8cfd000ec3df752 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Thu, 4 Apr 2024 15:22:59 -0400 Subject: [PATCH 3/3] WIP --- Dockerfile | 1 + lib/manageiq/rpm_build.rb | 1 + rpm_spec/manageiq.spec.in | 17 +++++++++++++++++ rpm_spec/subpackages/manageiq-containers | 5 ++++- 4 files changed, 23 insertions(+), 1 deletion(-) 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/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/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 index 446aaa1c..f8c3314e 100644 --- a/rpm_spec/subpackages/manageiq-containers +++ b/rpm_spec/subpackages/manageiq-containers @@ -4,5 +4,8 @@ Summary: %{product_summary} Containers %description containers %{product_summary} Containers +%files +%{_sharedstatedir}/manageiq/data/containers + %post containers -# TODO podman image import --root=/var/www/miq/vmdb/data/containers/storage /tmp/opentofu-runner_latest.tar +# TODO podman image import --root=/var/lib/manageiq/data/containers/storage /tmp/opentofu-runner_latest.tar