Add option no-sign

This commit is contained in:
Mikhail Gordeev 2020-05-06 15:24:48 +03:00
parent e789e5dc82
commit 48d7b9d3b4
2 changed files with 17 additions and 5 deletions

View File

@ -37,6 +37,11 @@ def parse_args():
action='store_true',
help='disable running tests',
)
parser.add_argument(
'--no-sign',
action='store_true',
help='disable creating check sum and signing it',
)
parser.add_argument(
'--tasks',
default={},
@ -53,7 +58,8 @@ def main():
cb = cloud_build.CB(**dict(args._get_kwargs()))
cb.create_images()
cb.copy_external_files()
cb.sign()
if not args.no_sign:
cb.sign()
cb.sync()

View File

@ -54,13 +54,15 @@ class CB:
*,
data_dir: PathLike = None,
no_tests: bool = False,
no_sign: bool = False,
create_remote_dirs: bool = False,
tasks: dict = None,
) -> None:
self.initialized = False
self._save_cwd = os.getcwd()
self.parse_config(config)
self.no_tests = no_tests
self.no_sign = no_sign
self.parse_config(config)
self._create_remote_dirs = create_remote_dirs
if tasks is None:
self.tasks = {}
@ -187,9 +189,10 @@ class CB:
try:
self._remote = self.expand_path(cfg['remote'])
self.key = cfg['key']
if isinstance(self.key, int):
self.key = '{:X}'.format(self.key)
if not self.no_sign:
self.key = cfg['key']
if isinstance(self.key, int):
self.key = '{:X}'.format(self.key)
self._images = cfg['images']
self._branches = cfg['branches']
for _, branch in self._branches.items():
@ -641,6 +644,9 @@ Dir::Etc::preferencesparts "/var/empty";
self.images_dir / branch / image)
def sign(self):
if self.no_sign:
return
sum_file = self.checksum_command.upper()
for branch in self.branches:
with self.pushd(self.images_dir / branch):