Allow setting CTS parent_compose_ids using --parent-compose-id option.
This is needed to track dependencies between composes in the Compose Tracking Service. Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
parent
7a6d8303dc
commit
2657a12c96
@ -57,6 +57,7 @@ def get_compose_info(
|
|||||||
compose_date=None,
|
compose_date=None,
|
||||||
compose_respin=None,
|
compose_respin=None,
|
||||||
compose_label=None,
|
compose_label=None,
|
||||||
|
parent_compose_ids=None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Creates inncomplete ComposeInfo to generate Compose ID
|
Creates inncomplete ComposeInfo to generate Compose ID
|
||||||
@ -100,7 +101,10 @@ def get_compose_info(
|
|||||||
# Create compose in CTS and get the reserved compose ID.
|
# Create compose in CTS and get the reserved compose ID.
|
||||||
ci.compose.id = ci.create_compose_id()
|
ci.compose.id = ci.create_compose_id()
|
||||||
url = os.path.join(cts_url, "api/1/composes/")
|
url = os.path.join(cts_url, "api/1/composes/")
|
||||||
data = {"compose_info": json.loads(ci.dumps())}
|
data = {
|
||||||
|
"compose_info": json.loads(ci.dumps()),
|
||||||
|
"parent_compose_ids": parent_compose_ids,
|
||||||
|
}
|
||||||
rv = requests.post(url, json=data, auth=HTTPKerberosAuth())
|
rv = requests.post(url, json=data, auth=HTTPKerberosAuth())
|
||||||
rv.raise_for_status()
|
rv.raise_for_status()
|
||||||
finally:
|
finally:
|
||||||
|
@ -158,6 +158,13 @@ def main():
|
|||||||
default=-1,
|
default=-1,
|
||||||
help="number of product version components used when creating latest symlink", # noqa: E501
|
help="number of product version components used when creating latest symlink", # noqa: E501
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--parent-compose-id",
|
||||||
|
action="append",
|
||||||
|
default=[],
|
||||||
|
help="List of compose IDs which should be marked as parents of this "
|
||||||
|
"compose in Compose Tracking Service",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--print-output-dir",
|
"--print-output-dir",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
@ -282,7 +289,10 @@ def main():
|
|||||||
ci_path = os.path.join(compose_dir, "work", "global", "composeinfo-base.json")
|
ci_path = os.path.join(compose_dir, "work", "global", "composeinfo-base.json")
|
||||||
if not os.path.exists(ci_path):
|
if not os.path.exists(ci_path):
|
||||||
ci = Compose.get_compose_info(
|
ci = Compose.get_compose_info(
|
||||||
conf, compose_type=compose_type, compose_label=opts.label
|
conf,
|
||||||
|
compose_type=compose_type,
|
||||||
|
compose_label=opts.label,
|
||||||
|
parent_compose_ids=opts.parent_compose_id,
|
||||||
)
|
)
|
||||||
Compose.write_compose_info(compose_dir, ci)
|
Compose.write_compose_info(compose_dir, ci)
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ class ComposeTestCase(unittest.TestCase):
|
|||||||
mocked_requests.post.assert_called_once_with(
|
mocked_requests.post.assert_called_once_with(
|
||||||
"https://cts.localhost.tld/api/1/composes/",
|
"https://cts.localhost.tld/api/1/composes/",
|
||||||
auth=mock.ANY,
|
auth=mock.ANY,
|
||||||
json={"compose_info": self.ci_json},
|
json={"compose_info": self.ci_json, "parent_compose_ids": None},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user