Fixes for system containers generate RPM#949
Fixes for system containers generate RPM#949giuseppe wants to merge 17 commits intoprojectatomic:masterfrom
Conversation
26003cb to
f7dba93
Compare
f7dba93 to
6c8d925
Compare
|
bot, retest this please |
8efd4a3 to
2cbfd7c
Compare
|
Great work. LGTM |
|
I am adding some more cleanups @TomasTomecek would like to use the same feature for Docker containers, so I am moving the RPM generator in its own file. |
|
@TomasTomecek I have added some more patches to move the code to a new file. It is not the nicest API, but it is a starting point from what I refactored out from syscontainers.py. We can clean it up incrementally with your feedbacks. The entrypoint is Beside that, it makes sense to share the same structure |
|
@giuseppe Thank you!
Absolutely. I want to reuse as much code as possible. Unfortunately there is some further refactoring required: if I want to use functionality from I'm not sure how to refactor it -- likely |
|
@TomasTomecek should the Docker code be added somewhere else? I think Do you think it makes sense? |
f06710b to
e3bb937
Compare
|
@TomasTomecek I pushed a small fixup patch that enables to do this: diff --git a/Atomic/install.py b/Atomic/install.py
index 855f137..8527b51 100644
--- a/Atomic/install.py
+++ b/Atomic/install.py
@@ -4,6 +4,11 @@ from . import util
from .util import add_opt
from .syscontainers import OSTREE_PRESENT
from Atomic.backendutils import BackendUtils
+import os
+import shutil
+from .mount import DockerMount
+from .rpm_host_install import RPMHostInstall, RPM_NAME_PREFIX
+import tempfile
try:
from . import Atomic
@@ -121,6 +126,23 @@ class Install(Atomic):
return self.syscontainers.install(self.image, self.name)
be.pull_image(self.args.image, remote_image_obj, debug=self.args.debug)
img_obj = be.has_image(self.image)
+
+
+ if self.args.system_package in ['build', 'yes']:
+ temp_dir = tempfile.mkdtemp()
+ os.makedirs(os.path.join(temp_dir, "root"))
+ m = DockerMount(os.path.join(temp_dir, "root"))
+ m.mount(self.image)
+ try:
+ origin_name, path = RPMHostInstall.generate_rpm("test", self.image, img_obj.labels, os.path.join(temp_dir, "root/rootfs/exports"), temp_dir)
+ shutil.move(path, origin_name)
+ finally:
+ m.unmount()
+ shutil.rmtree(temp_dir)
+ sys.exit(0)
+
install_args = img_obj.get_label('INSTALL')
if not install_args:
return 0Of course, this is just a proof of concept and cannot be used as it is (also should not probably stay here in install.py). Just wanted to show what we can do with the new code in common. |
306df1b to
6a909f7
Compare
|
There are a few fixes that are nice to have as soon as possible and would be nice to have before #952. Is this ready to 🚢? |
|
@TomasTomecek thanks for the feedback. I saw the |
3b988a0 to
5db5263
Compare
|
☔ The latest upstream changes (presumably 1b216a4) made this pull request unmergeable. Please resolve the merge conflicts. |
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
5db5263 to
8b20eff
Compare
|
looks like we need a rebase and to pass tests still ? |
|
I rebased and now I get some weird errors, taking a look... |
8b20eff to
a5fd3cb
Compare
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
c646683 to
a22fda4
Compare
|
@baude tests are passing again |
|
lgtm |
Fixes this error: AttributeError: 'bool' object has no attribute 'replace' Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
return immediately once the rpm is uninstalled as there is nothing left on the host. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Sometimes I don't want to wait for pylint to complete. Add a new makefile rule that launches directly the tests suite. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Generate the RPM from the checkout of the container without requiring a separate one. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
This let us control the IMAGE_ID from tests so we can test upgrade/rollback more easily. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
This bug doesn't depend from the RPM generator. Just spotted it as I was testing install failures. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
and move it to `generate_rpm`. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Test that auto behaves like yes. Fixed with the in place RPM build. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Refactor the RPM generation code for system containers in a new file so that it can be shared with the Docker backend. For fully supporting the same /exports structure we will need to add the support for reading the manifest.json file as well, but since the Docker backend doesn't use --set for settings of the container, preprocessing files won't be very useful. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #949 Approved by: baude
|
☀️ Test successful - status-redhatci |
Add some tests for the generate RPM feature of system containers and fix some issues that I've found while using these tests.