Skip to content

Commit 1c0cf32

Browse files
committed
Support custom CodeBuild templates
1 parent 6eeb672 commit 1c0cf32

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/perf-test/perf_test.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,18 @@ def parse_args():
6767
default='quick',
6868
help='Subset of tasks to run (quick, full; ' +
6969
'default: quick; or regex of SV-COMP task(s))')
70+
parser.add_argument('-B', '--code-build', type=str,
71+
default=same_dir('codebuild.yaml'),
72+
help='Non-default CodeBuild template to use')
7073

7174
args = parser.parse_args()
75+
7276
assert(args.repository.startswith('https://github.com/') or
7377
args.repository.startswith('https://git-codecommit.'))
7478
assert(not args.ssh_key or args.ssh_key_name)
7579
if args.ssh_key:
7680
assert(os.path.isfile(args.ssh_key))
81+
assert(os.path.isfile(args.code_build))
7782

7883
return args
7984

@@ -345,7 +350,8 @@ def prepare_ebs(session, region, az, ami):
345350
return snapshots['Snapshots'][0]['SnapshotId']
346351

347352

348-
def build(session, repository, commit_id, bucket_name, perf_test_id):
353+
def build(session, repository, commit_id, bucket_name, perf_test_id,
354+
codebuild_file):
349355
# build the chosen commit in CodeBuild
350356
logger = logging.getLogger('perf_test')
351357

@@ -356,7 +362,7 @@ def build(session, repository, commit_id, bucket_name, perf_test_id):
356362

357363
cfn = session.resource('cloudformation', region_name='us-east-1')
358364
stack_name = 'perf-test-codebuild-' + perf_test_id
359-
with open(same_dir('codebuild.yaml')) as f:
365+
with open(codebuild_file) as f:
360366
CFN_codebuild = f.read()
361367
stack = cfn.create_stack(
362368
StackName=stack_name,
@@ -569,6 +575,7 @@ def run_perf_test(
569575
],
570576
Capabilities=['CAPABILITY_NAMED_IAM'])
571577

578+
logger.info(region + ': Waiting for completition of ' + stack_name)
572579
waiter = cfn.meta.client.get_waiter('stack_create_complete')
573580
waiter.wait(StackName=stack_name)
574581
asg_name = stack.outputs[0]['OutputValue']
@@ -643,7 +650,7 @@ def main():
643650
session2 = boto3.session.Session()
644651
build_future = e.submit(
645652
build, session2, args.repository, args.commit_id, bucket_name,
646-
perf_test_id)
653+
perf_test_id, args.code_build)
647654
session3 = boto3.session.Session()
648655
ebs_future = e.submit(prepare_ebs, session3, region, az, ami)
649656
session4 = boto3.session.Session()

0 commit comments

Comments
 (0)