testboard: add dry-run option
Mostly for testing, to inspect what manifest is being constructed without triggering tests. Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
This commit is contained in:
parent
494ea6af8d
commit
4cf76886f4
|
@ -41,6 +41,8 @@ parser.add_argument('--debug', action='store_true',
|
||||||
help="Print verbose debugging messages")
|
help="Print verbose debugging messages")
|
||||||
parser.add_argument('--repo_dir', default='.',
|
parser.add_argument('--repo_dir', default='.',
|
||||||
help="Directory of repo")
|
help="Directory of repo")
|
||||||
|
parser.add_argument('-n', '--dry-run', action='store_true',
|
||||||
|
help="Do not push, just construct manifest")
|
||||||
|
|
||||||
# In Python 3, subprocess returns bytes instead of (Unicode) str.
|
# In Python 3, subprocess returns bytes instead of (Unicode) str.
|
||||||
# We don't worry about that here, since our subprocesses are
|
# We don't worry about that here, since our subprocesses are
|
||||||
|
@ -294,12 +296,15 @@ def main(argv):
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
fatal("Failed to commit to the test board repository.")
|
fatal("Failed to commit to the test board repository.")
|
||||||
|
|
||||||
# Now attempt to push it.
|
if args.dry_run:
|
||||||
# This may fail if someone else has pushed a commit in the meantime.
|
log("Dry run, skipping push.")
|
||||||
try:
|
else:
|
||||||
subprocess.check_call(['git', 'push', '--set-upstream', 'origin', args.testboard_branch], cwd=testboard_repo)
|
# Now attempt to push it.
|
||||||
except subprocess.CalledProcessError:
|
# This may fail if someone else has pushed a commit in the meantime.
|
||||||
fatal("Failed to push to test board.")
|
try:
|
||||||
|
subprocess.check_call(['git', 'push', '--set-upstream', 'origin', args.testboard_branch], cwd=testboard_repo)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
fatal("Failed to push to test board.")
|
||||||
|
|
||||||
testboard_oneline = subprocess_output(['git', 'log', '--oneline'], cwd=testboard_repo).strip()
|
testboard_oneline = subprocess_output(['git', 'log', '--oneline'], cwd=testboard_repo).strip()
|
||||||
log("Done. Your test board commit is:\n " + testboard_oneline)
|
log("Done. Your test board commit is:\n " + testboard_oneline)
|
||||||
|
|
Loading…
Reference in New Issue