cloud-build/cloud-build.py

46 lines
849 B
Python
Raw Normal View History

2019-03-28 03:28:51 +03:00
#!/usr/bin/python3
import argparse
2020-04-20 14:29:27 +03:00
import sys
2019-03-28 03:28:51 +03:00
2020-04-20 14:29:27 +03:00
import cloud_build
2019-07-08 02:14:01 +03:00
2019-03-28 03:28:51 +03:00
PROG = 'cloud-build'
def parse_args():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
'-c',
'--config',
default=f'/etc/{PROG}/config.yaml',
help='path to config',
)
2019-11-01 16:44:46 +03:00
parser.add_argument(
'--no-tests',
action='store_true',
help='disable running tests',
)
2019-03-28 03:28:51 +03:00
args = parser.parse_args()
return args
def main():
args = parse_args()
2020-04-20 17:27:33 +03:00
cb = cloud_build.CB(config=args.config, no_tests=args.no_tests)
2020-04-20 14:29:27 +03:00
cb.create_images()
cb.copy_external_files()
cb.sign()
cb.sync()
2019-03-28 03:28:51 +03:00
if __name__ == '__main__':
2020-04-20 14:29:27 +03:00
try:
main()
except cloud_build.Error as e:
print(e, file=sys.stdout)
exit(1)