-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
signing wrapper for cosign signer in pubtools-sign (#200)
* Added wrapper for Cosign signer in pubtools-sign
- Loading branch information
1 parent
95af534
commit 29ef105
Showing
7 changed files
with
362 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
import paramiko | ||
from shlex import quote | ||
|
||
|
||
LOG = logging.getLogger("pubtools.quay") | ||
|
||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import mock | ||
|
||
from pubtools._quay.signer_wrapper import CosignSignerWrapper | ||
|
||
|
||
def test_remove_signatures(cosign_signer_settings, fake_cert_key_paths): | ||
with mock.patch("pubtools._quay.signer_wrapper.run_entrypoint") as mock_run_entry_point: | ||
mock_run_entry_point.return_value = ( | ||
True, | ||
["quay.io/testing/repository:sha256-123456789.sig"], | ||
) | ||
sw = CosignSignerWrapper(config_file="fake-config-file", settings=cosign_signer_settings) | ||
with mock.patch( | ||
"pubtools._quay.signer_wrapper.QuayApiClient.delete_tag" | ||
) as mock_delete_tag: | ||
sw.remove_signatures([("sha256:123456789", "tag", "testing/repository")]) | ||
mock_delete_tag.assert_called_once_with( | ||
"testing/testing----repository", "sha256-123456789.sig" | ||
) | ||
|
||
|
||
def test_remove_signatures_failure(cosign_signer_settings, fake_cert_key_paths): | ||
with mock.patch("pubtools._quay.signer_wrapper.run_entrypoint") as mock_run_entry_point: | ||
mock_run_entry_point.return_value = ( | ||
False, | ||
"test-error", | ||
) | ||
sw = CosignSignerWrapper(config_file="fake-config-file", settings=cosign_signer_settings) | ||
with mock.patch( | ||
"pubtools._quay.signer_wrapper.QuayApiClient.delete_tag" | ||
) as mock_delete_tag: | ||
sw.remove_signatures([("sha256:123456789", "tag", "testing/repository")]) | ||
mock_delete_tag.assert_not_called() |
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.