generated from datalad/datalad-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds trusted execution. Trusted execution requires that the latest commit to the method (in `.datalad/make/methods`) and the specification file (in `.datalad/make/specifications`) were signed with a trusted key. That means, a `git verify-commit` succeeds.
- Loading branch information
1 parent
76e4d8b
commit 979c0ef
Showing
9 changed files
with
93 additions
and
5 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
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,26 @@ | ||
from pathlib import Path | ||
|
||
from datalad_next.runners import ( | ||
call_git_oneline, | ||
call_git_success, | ||
) | ||
|
||
|
||
def verify_file(root_directory: Path, file: Path): | ||
# Get the latest commit of `file` | ||
commit = call_git_oneline([ | ||
'-C', str(root_directory), | ||
'log', '-1', '--follow', | ||
'--pretty=%H', | ||
str(file) | ||
]) | ||
|
||
# Let git do the verification of the commit | ||
result = call_git_success([ | ||
'-C', str(root_directory), | ||
'verify-commit', | ||
commit | ||
]) | ||
if not result: | ||
msg = f'Signature validation of {file} failed' | ||
raise ValueError(msg) |
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