Add 'zypper' to the valid container.os_packages options (#36681)

Signed-off-by: Egbert Eich <eich@suse.com>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
Co-authored-by: e4t <e4t@users.noreply.github.com>
This commit is contained in:
Egbert Eich 2023-05-03 13:05:14 +02:00 committed by GitHub
parent 03d1841385
commit 1491d8471d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 2 deletions

View File

@ -616,7 +616,7 @@ to customize the generation of container recipes:
- No
* - ``os_packages:command``
- Tool used to manage system packages
- ``apt``, ``yum``
- ``apt``, ``yum``, ``zypper``, ``apk``, ``yum_amazon``
- Only with custom base images
* - ``os_packages:update``
- Whether or not to update the list of available packages

View File

@ -54,7 +54,10 @@
"os_packages": {
"type": "object",
"properties": {
"command": {"type": "string", "enum": ["apt", "yum"]},
"command": {
"type": "string",
"enum": ["apt", "yum", "zypper", "apk", "yum_amazon"],
},
"update": {"type": "boolean"},
"build": _list_of_packages,
"final": _list_of_packages,

View File

@ -43,6 +43,28 @@ def test_packages(minimal_configuration):
assert p.list == pkgs
def test_container_os_packages_command(minimal_configuration):
# In this minimal configuration we don't have packages
writer = writers.create(minimal_configuration)
assert writer.os_packages_build is None
assert writer.os_packages_final is None
# If we add them a list should be returned
minimal_configuration["spack"]["container"]["images"] = {
"build": "custom-build:latest",
"final": "custom-final:latest",
}
minimal_configuration["spack"]["container"]["os_packages"] = {
"command": "zypper",
"final": ["libgomp1"],
}
writer = writers.create(minimal_configuration)
p = writer.os_packages_final
assert "zypper update -y" in p.update
assert "zypper install -y" in p.install
assert "zypper clean -a" in p.clean
def test_ensure_render_works(minimal_configuration, default_config):
# Here we just want to ensure that nothing is raised
writer = writers.create(minimal_configuration)