diff options
-rw-r--r-- | etc/ci/performance/set_s3_policy.py | 50 | ||||
-rw-r--r-- | etc/ci/performance/submit_to_s3.py | 30 | ||||
-rwxr-xr-x | etc/ci/performance/test_all.sh | 13 | ||||
-rwxr-xr-x | etc/ci/performance/test_perf.sh | 2 | ||||
-rw-r--r-- | python/servo/testing_commands.py | 6 |
5 files changed, 85 insertions, 16 deletions
diff --git a/etc/ci/performance/set_s3_policy.py b/etc/ci/performance/set_s3_policy.py new file mode 100644 index 00000000000..183c73b54b4 --- /dev/null +++ b/etc/ci/performance/set_s3_policy.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import argparse +import boto3 + + +def main(): + parser = argparse.ArgumentParser( + description=("Set the policy of the servo-perf bucket. " + "Remember to set your S3 credentials " + "https://github.com/boto/boto3")) + parser.parse_args() + + s3 = boto3.resource('s3') + BUCKET = 'servo-perf' + POLICY = """{ + "Version":"2012-10-17", + "Statement":[ + { + "Effect":"Allow", + "Principal":"*", + "Action":[ + "s3:ListBucket", + "s3:GetBucketLocation" + ], + "Resource":"arn:aws:s3:::servo-perf" + }, + { + "Effect":"Allow", + "Principal":"*", + "Action":[ + "s3:GetObject", + "s3:GetObjectAcl" + ], + "Resource":"arn:aws:s3:::servo-perf/*" + } + ] +}""" + + s3.BucketPolicy(BUCKET).put(Policy=POLICY) + + print("Done!") + + +if __name__ == "__main__": + main() diff --git a/etc/ci/performance/submit_to_s3.py b/etc/ci/performance/submit_to_s3.py new file mode 100644 index 00000000000..88c5c822f00 --- /dev/null +++ b/etc/ci/performance/submit_to_s3.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +import argparse +import boto3 + + +def main(): + parser = argparse.ArgumentParser( + description=("Submit Servo performance data to S3. " + "Remember to set your S3 credentials " + "https://github.com/boto/boto3")) + parser.add_argument("perf_file", + help="the output CSV file from runner") + parser.add_argument("perf_key", + help="the S3 key to upload to") + args = parser.parse_args() + + s3 = boto3.client('s3') + BUCKET = 'servo-perf' + s3.upload_file(args.perf_file, BUCKET, args.perf_key) + + print("Done!") + + +if __name__ == "__main__": + main() diff --git a/etc/ci/performance/test_all.sh b/etc/ci/performance/test_all.sh index 44493f52220..d62ddd5abec 100755 --- a/etc/ci/performance/test_all.sh +++ b/etc/ci/performance/test_all.sh @@ -48,7 +48,8 @@ python3 -m http.server > /dev/null 2>&1 & # MANIFEST="page_load_test/tp5n/20160509.manifest" MANIFEST="page_load_test/test.manifest" # A manifest that excludes # timeout test cases -PERF_FILE="output/perf-$(uname -s)-$(uname -m)-$(date +%s).csv" +PERF_KEY="perf-$(uname -s)-$(uname -m)-$(date +%s).csv" +PERF_FILE="output/${PERF_KEY}" echo "Running tests" python3 runner.py ${engine} --runs 4 --timeout "${timeout}" --base "${base}" \ @@ -56,14 +57,8 @@ python3 runner.py ${engine} --runs 4 --timeout "${timeout}" --base "${base}" \ if [[ "${submit:-}" ]]; then - echo "Submitting to Perfherder" - # Perfherder SSL check will fail if time is not accurate, - # sync time before you submit - # TODO: we are using Servo's revision hash for Gecko's result to make both - # results appear on the same date. Use the correct result when Perfherder - # allows us to change the date. - python3 submit_to_perfherder.py \ - "${engine}" "${PERF_FILE}" servo/revision.json + echo "Submitting to S3" + python3 submit_to_s3.py "${PERF_FILE}" "${PERF_KEY}" fi echo "Stopping the local server" diff --git a/etc/ci/performance/test_perf.sh b/etc/ci/performance/test_perf.sh index 32daecf751f..0b0a846ed30 100755 --- a/etc/ci/performance/test_perf.sh +++ b/etc/ci/performance/test_perf.sh @@ -29,7 +29,7 @@ fi virtualenv venv --python="$(which python3)" PS1="" source venv/bin/activate # `PS1` must be defined before activating virtualenv -pip install "treeherder-client>=3.0.0" +pip install "boto3>=1.4.0" mkdir -p servo mkdir -p output # Test result will be saved to output/perf-<timestamp>.json diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 2530fee7073..16efbd60b4f 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -186,12 +186,6 @@ class MachCommands(CommandBase): if base: cmd += ["--base", base] if submit: - if not ("TREEHERDER_CLIENT_ID" in os.environ and - "TREEHERDER_CLIENT_SECRET" in os.environ): - print("Please set the environment variable \"TREEHERDER_CLIENT_ID\"" - " and \"TREEHERDER_CLIENT_SECRET\" to submit the performance" - " test result to perfherder") - return 1 cmd += ["--submit"] return call(cmd, env=env, |