Skip to content

Commit f72ab07

Browse files
committed
Removed extra_attrs manifest digest override in batch signer
Override causes manifest_digest to be inconsistent. Also make sure pipeline_run_id is always string
1 parent a20106b commit f72ab07

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/pubtools/sign/signers/msgsigner.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,9 @@ def _create_msg_batch_message(
694694
signing_keys.append(_signing_key)
695695

696696
extra_attrs = extra_attrs or {}
697-
headers = self._construct_headers(sig_type, extra_attrs=extra_attrs)
698-
if isinstance(operation, ContainerSignOperation):
699-
extra_attrs["manifest_digest"] = operation.digests
697+
extra_attrs_headers = extra_attrs.copy()
698+
extra_attrs_headers.pop("manifest_digest")
699+
headers = self._construct_headers(sig_type, extra_attrs=extra_attrs_headers)
700700
ret = MsgMessage(
701701
headers=headers,
702702
body=self._construct_signing_batch_message(
@@ -745,7 +745,7 @@ def _prepare_messages(self: Self, operation: ContainerSignOperation) -> List[Lis
745745
args=[claims, repo, operation, SignRequestType.BATCH],
746746
kwargs={
747747
"extra_attrs": {
748-
"pipeline_run_id": operation.task_id,
748+
"pipeline_run_id": str(operation.task_id),
749749
"manifest_digest": digests,
750750
}
751751
},
@@ -758,7 +758,7 @@ def _prepare_messages(self: Self, operation: ContainerSignOperation) -> List[Lis
758758
args=[claims, repo, operation, SignRequestType.BATCH],
759759
kwargs={
760760
"extra_attrs": {
761-
"pipeline_run_id": operation.task_id,
761+
"pipeline_run_id": str(operation.task_id),
762762
"manifest_digest": digests,
763763
}
764764
},

tests/test_msg_batch_signer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,13 @@ def test_create_msg_batch_message(f_config_msg_batch_signer_ok):
255255
task_id="1",
256256
)
257257
assert signer._create_msg_batch_message(
258-
data, "repo", operation, SignRequestType.BATCH
258+
data,
259+
"repo",
260+
operation,
261+
SignRequestType.BATCH,
262+
extra_attrs={
263+
"manifest_digest": ["some-digest-1", "some-digest-2", "some-digest-3"]
264+
},
259265
) == [
260266
MsgMessage(
261267
headers={

0 commit comments

Comments
 (0)