refactor: reduce audited source duplication

This commit is contained in:
2026-08-02 05:30:15 +02:00
parent 2c56a0fc11
commit f7a30682b3
3 changed files with 43 additions and 66 deletions
+26 -62
View File
@@ -484,31 +484,35 @@ def publish_catalog_candidate(
)
)
result_fields = {
"candidate_root": candidate_root,
"candidate_catalog": candidate_catalog,
"candidate_keyring": candidate_keyring,
"resolved_web_root": resolved_web_root,
"target_catalog": target_catalog,
"target_keyring": target_keyring,
"channel": channel,
"branch": effective_branch,
"tag_name": effective_tag_name,
"remote": remote,
"validation_valid": validation_valid,
"validation_error": validation_error,
"validation_warnings": validation_warnings,
"candidate_catalog_hash": candidate_catalog_hash,
"candidate_keyring_hash": candidate_keyring_hash,
"target_catalog_hash_before": target_catalog_hash_before,
"target_keyring_hash_before": target_keyring_hash_before,
"catalog_changed": catalog_changed,
"keyring_changed": keyring_changed,
}
if blockers:
return result(
status="blocked",
applied=False,
candidate_root=candidate_root,
candidate_catalog=candidate_catalog,
candidate_keyring=candidate_keyring,
resolved_web_root=resolved_web_root,
target_catalog=target_catalog,
target_keyring=target_keyring,
channel=channel,
branch=effective_branch,
tag_name=effective_tag_name,
remote=remote,
validation_valid=validation_valid,
validation_error=validation_error,
validation_warnings=validation_warnings,
candidate_catalog_hash=candidate_catalog_hash,
candidate_keyring_hash=candidate_keyring_hash,
target_catalog_hash_before=target_catalog_hash_before,
target_keyring_hash_before=target_keyring_hash_before,
catalog_changed=catalog_changed,
keyring_changed=keyring_changed,
steps=tuple(steps),
notes=tuple([*notes, *blockers]),
**result_fields,
)
if not apply:
@@ -518,27 +522,9 @@ def publish_catalog_candidate(
return result(
status="ready",
applied=False,
candidate_root=candidate_root,
candidate_catalog=candidate_catalog,
candidate_keyring=candidate_keyring,
resolved_web_root=resolved_web_root,
target_catalog=target_catalog,
target_keyring=target_keyring,
channel=channel,
branch=effective_branch,
tag_name=effective_tag_name,
remote=remote,
validation_valid=validation_valid,
validation_error=validation_error,
validation_warnings=validation_warnings,
candidate_catalog_hash=candidate_catalog_hash,
candidate_keyring_hash=candidate_keyring_hash,
target_catalog_hash_before=target_catalog_hash_before,
target_keyring_hash_before=target_keyring_hash_before,
catalog_changed=catalog_changed,
keyring_changed=keyring_changed,
steps=tuple(steps),
notes=tuple(notes),
**result_fields,
)
directory_payloads = module_directory_payloads(
@@ -615,11 +601,7 @@ def publish_catalog_candidate(
publication_commit,
)
_seal_git_metadata_file(
resolved_web_root
/ ".git"
/ "refs"
/ "tags"
/ effective_tag_name,
resolved_web_root / ".git" / "refs" / "tags" / effective_tag_name,
label="website publication tag reference",
)
publication_tag_object = git_text(
@@ -704,30 +686,12 @@ def publish_catalog_candidate(
return result(
status="published" if push else "applied",
applied=True,
candidate_root=candidate_root,
candidate_catalog=candidate_catalog,
candidate_keyring=candidate_keyring,
resolved_web_root=resolved_web_root,
target_catalog=target_catalog,
target_keyring=target_keyring,
channel=channel,
branch=effective_branch,
tag_name=effective_tag_name,
remote=remote,
validation_valid=validation_valid,
validation_error=validation_error,
validation_warnings=validation_warnings,
candidate_catalog_hash=candidate_catalog_hash,
candidate_keyring_hash=candidate_keyring_hash,
target_catalog_hash_before=target_catalog_hash_before,
target_keyring_hash_before=target_keyring_hash_before,
catalog_changed=catalog_changed,
keyring_changed=keyring_changed,
publication_commit_sha=publication_commit,
publication_tag_object_sha=publication_tag_object,
publication_tag_commit_sha=publication_tag_commit,
steps=tuple(completed_steps),
notes=tuple(notes),
**result_fields,
)