This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gen-payload: Support weekly kernel tagging convention
This feature will only be enabled if `rpm_deliveries` key is defined in group config. e.g. ``` rpm_deliveries: - packages: # Enable support for "Weekly" kernel delivery through OCP - kernel - kernel-rt integration_tag: early-kernel-integration-8.6 stop_ship_tag: early-kernel-stop-ship ship_ok_tag: early-kernel-ship-ok ``` With this config, gen-payload will do additional checks on packages (kernel and kernel-rt) to ensure they follow the following policy: 1. If any package is tagged into `early-kernel-stop-ship`, build-sync will generate an `IMPERMISSIBLE` assembly issue. 2. When running for a `standard` assembly (GA release), build-sync will generate an `IMPERMISSIBLE` assembly issue if any package doesn't have `early-kernel-ship-ok` tag. `RHCOSBuildInspector.get_package_build_objects` is optimized to use multicall to increase the performance. `asynctest` is replaced with `unittest.IsolatedAsyncioTestCase` for python 3.11 compatibility.
- Loading branch information
Showing
14 changed files
with
222 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
asynctest | ||
autopep8 | ||
coverage | ||
flake8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
from unittest import IsolatedAsyncioTestCase | ||
from unittest.mock import MagicMock | ||
from doozerlib.assembly import AssemblyTypes | ||
|
||
from doozerlib.assembly_inspector import AssemblyInspector | ||
from doozerlib.model import Model | ||
|
||
|
||
class TestAssemblyInspector(IsolatedAsyncioTestCase): | ||
def test_check_installed_packages_for_rpm_delivery(self): | ||
# Test a standard release with a package tagged into my-ship-ok-tag | ||
rt = MagicMock(mode="both", group_config=Model({ | ||
"rpm_deliveries": [ | ||
{ | ||
"packages": ["kernel", "kernel-rt"], | ||
"integration_tag": "my-integration-tag", | ||
"ship_ok_tag": "my-ship-ok-tag", | ||
"stop_ship_tag": "my-stop-ship-tag" | ||
} | ||
] | ||
})) | ||
brew_session = MagicMock() | ||
brew_session.listTags.return_value = [ | ||
{"name": "tag-a"}, | ||
{"name": "my-integration-tag"}, | ||
{"name": "my-ship-ok-tag"}, | ||
] | ||
ai = AssemblyInspector(rt, brew_session) | ||
ai.assembly_type = AssemblyTypes.STANDARD | ||
rpm_packages = { | ||
"kernel": {"nvr": "kernel-1.2.3-1", "id": 1} | ||
} | ||
issues = ai._check_installed_packages_for_rpm_delivery("foo", "foo-1.2.3-1", rpm_packages) | ||
self.assertEqual(issues, []) | ||
|
||
# Test a standard release with a package not tagged into my-ship-ok-tag | ||
brew_session.listTags.return_value = [ | ||
{"name": "tag-a"}, | ||
{"name": "my-integration-tag"}, | ||
] | ||
issues = ai._check_installed_packages_for_rpm_delivery("foo", "foo-1.2.3-1", rpm_packages) | ||
self.assertEqual(len(issues), 1) | ||
|
||
# Test a stream "release" with a package not tagged into my-ship-ok-tag | ||
ai.assembly_type = AssemblyTypes.STREAM | ||
issues = ai._check_installed_packages_for_rpm_delivery("foo", "foo-1.2.3-1", rpm_packages) | ||
self.assertEqual(len(issues), 0) | ||
|
||
# Test a stream "release" with a package not tagged into my-stop-ship-tag | ||
brew_session.listTags.return_value = [ | ||
{"name": "tag-a"}, | ||
{"name": "my-integration-tag"}, | ||
{"name": "my-ship-ok-tag"}, | ||
{"name": "my-stop-ship-tag"}, | ||
] | ||
issues = ai._check_installed_packages_for_rpm_delivery("foo", "foo-1.2.3-1", rpm_packages) | ||
self.assertEqual(len(issues), 1) | ||
|
||
def test_check_installed_rpms_in_image(self): | ||
rt = MagicMock(mode="both", group_config=Model({ | ||
"rpm_deliveries": [ | ||
{ | ||
"packages": ["kernel", "kernel-rt"], | ||
"integration_tag": "my-integration-tag", | ||
"ship_ok_tag": "my-ship-ok-tag", | ||
"stop_ship_tag": "my-stop-ship-tag" | ||
} | ||
] | ||
})) | ||
brew_session = MagicMock() | ||
brew_session.listTags.return_value = [ | ||
{"name": "tag-a"}, | ||
{"name": "my-integration-tag"}, | ||
{"name": "my-ship-ok-tag"}, | ||
] | ||
ai = AssemblyInspector(rt, brew_session) | ||
ai.assembly_type = AssemblyTypes.STANDARD | ||
build_inspector = MagicMock() | ||
build_inspector.get_all_installed_package_build_dicts.return_value = { | ||
"kernel": {"nvr": "kernel-1.2.3-1", "id": 1} | ||
} | ||
issues = ai.check_installed_rpms_in_image("foo", build_inspector) | ||
self.assertEqual(issues, []) | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.