comparison contrib/automation/hgautomation/cli.py @ 43057:c5c502bd1f70

automation: add a command to submit to a Try server The CI code for running the Try Server requires more thorough review. Let's add just the client-side bits for submitting to Try so others can start using it. Differential Revision: https://phab.mercurial-scm.org/D6983
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 05 Oct 2019 11:21:39 -0400
parents b8df6a470bbb
children 2372284d9457
comparison
equal deleted inserted replaced
43056:f71b3c561b93 43057:c5c502bd1f70
15 15
16 from . import ( 16 from . import (
17 aws, 17 aws,
18 HGAutomation, 18 HGAutomation,
19 linux, 19 linux,
20 try_server,
20 windows, 21 windows,
21 ) 22 )
22 23
23 24
24 SOURCE_ROOT = pathlib.Path(os.path.abspath(__file__)).parent.parent.parent.parent 25 SOURCE_ROOT = pathlib.Path(os.path.abspath(__file__)).parent.parent.parent.parent
191 windows.publish_artifacts(DIST_PATH, version, 192 windows.publish_artifacts(DIST_PATH, version,
192 pypi=pypi, mercurial_scm_org=mercurial_scm_org, 193 pypi=pypi, mercurial_scm_org=mercurial_scm_org,
193 ssh_username=ssh_username) 194 ssh_username=ssh_username)
194 195
195 196
197 def run_try(hga: HGAutomation, aws_region: str, rev: str):
198 c = hga.aws_connection(aws_region, ensure_ec2_state=False)
199 try_server.trigger_try(c, rev=rev)
200
201
196 def get_parser(): 202 def get_parser():
197 parser = argparse.ArgumentParser() 203 parser = argparse.ArgumentParser()
198 204
199 parser.add_argument( 205 parser.add_argument(
200 '--state-path', 206 '--state-path',
437 'version', 443 'version',
438 help='Mercurial version string to locate local packages', 444 help='Mercurial version string to locate local packages',
439 ) 445 )
440 sp.set_defaults(func=publish_windows_artifacts) 446 sp.set_defaults(func=publish_windows_artifacts)
441 447
448 sp = subparsers.add_parser(
449 'try',
450 help='Run CI automation against a custom changeset'
451 )
452 sp.add_argument('-r', '--rev',
453 default='.',
454 help='Revision to run CI on')
455 sp.set_defaults(func=run_try)
456
442 return parser 457 return parser
443 458
444 459
445 def main(): 460 def main():
446 parser = get_parser() 461 parser = get_parser()