summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorAndres Gomez <agomez@igalia.com>2020-08-23 22:58:03 +0300
committerAndres Gomez <agomez@igalia.com>2020-11-02 22:10:17 +0200
commit04fa6e49496cf2e6cc697c67b2f76df4152fb600 (patch)
treea796fcdd260a7dd2245e62210e966d84ccbe8ad5 /framework
parentc9aa7f171730d5866d8c593ced482efa87c155d8 (diff)
framework/replay: remove upload_utils
We don't want to have this embedded into piglit. Let deal with the need of moving piglit's results to some other location to a different tool. Signed-off-by: Andres Gomez <agomez@igalia.com> Suggested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/353>
Diffstat (limited to 'framework')
-rw-r--r--framework/replay/__init__.py1
-rw-r--r--framework/replay/compare_replay.py3
-rw-r--r--framework/replay/upload_utils.py82
3 files changed, 0 insertions, 86 deletions
diff --git a/framework/replay/__init__.py b/framework/replay/__init__.py
index 954bb8947..78f8e7cb8 100644
--- a/framework/replay/__init__.py
+++ b/framework/replay/__init__.py
@@ -35,4 +35,3 @@ from .dump_trace_images import *
from .image_checksum import *
from .query_traces_yaml import *
from .trace_utils import *
-from .upload_utils import *
diff --git a/framework/replay/compare_replay.py b/framework/replay/compare_replay.py
index 2db3bd4f5..feac7cccb 100644
--- a/framework/replay/compare_replay.py
+++ b/framework/replay/compare_replay.py
@@ -35,7 +35,6 @@ from framework.replay import query_traces_yaml as qty
from framework.replay.download_utils import ensure_file
from framework.replay.dump_trace_images import dump_from_trace
from framework.replay.image_checksum import hexdigest_from_image
-from framework.replay.upload_utils import upload_file
__all__ = ['from_yaml',
@@ -90,7 +89,6 @@ def _check_trace(download_url, device_name, trace_path, expected_checksum):
print('[check_image] Images match for:\n {}\n'.format(trace_path))
ok = True
else:
- upload_file(image_file, 'image/png', device_name)
print('[check_image] Images differ for '
'%s (expected: %s, actual: %s)'.format(
trace_path, expected_checksum, checksum))
@@ -112,7 +110,6 @@ def _write_results(results):
results_file_path = path.join(RESULTS_PATH, 'results.yml')
with open(results_file_path, 'w') as f:
yaml.safe_dump(results, f, default_flow_style=False)
- upload_file(results_file_path, 'text/yaml', device_name)
def from_yaml(yaml_file, device_name):
diff --git a/framework/replay/upload_utils.py b/framework/replay/upload_utils.py
deleted file mode 100644
index 59d2684b8..000000000
--- a/framework/replay/upload_utils.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# coding=utf-8
-#
-# Copyright (c) 2020 Collabora Ltd
-# Copyright © 2020 Valve Corporation.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-#
-# SPDX-License-Identifier: MIT
-
-import base64
-import hmac
-import os
-import requests
-
-from email.utils import formatdate
-from hashlib import sha1
-from os import path
-from urllib.parse import urljoin, urlparse
-try:
- import simplejson as json
-except ImportError:
- import json
-
-
-__all__ = ['upload_file']
-
-
-def _sign_with_hmac(key, message):
- key = key.encode('UTF-8')
- message = message.encode('UTF-8')
-
- signature = hmac.new(key, message, sha1).digest()
-
- return base64.encodebytes(signature).strip().decode()
-
-
-def upload_file(file_path, content_type, device_name):
- if os.environ.get('TRACIE_UPLOAD_TO_MINIO', '0') != '1':
- return
-
- resource = ('/artifacts/%s/%s/%s/%s'
- % (os.environ['CI_PROJECT_PATH'], os.environ['CI_PIPELINE_ID'],
- device_name, path.basename(file_path)))
- date = formatdate(timeval=None, localtime=False, usegmt=True)
- url = 'https://minio-packet.freedesktop.org%s' % (resource)
- headers = {'Host': 'minio-packet.freedesktop.org',
- 'Date': date,
- 'Content-Type': content_type}
-
- with open('.minio_credentials', 'r') as f:
- credentials = json.load(f)["minio-packet.freedesktop.org"]
- minio_key = credentials['AccessKeyId']
- minio_secret = credentials['SecretAccessKey']
- minio_token = credentials['SessionToken']
- to_sign = 'PUT\n\n{}\n{}\nx-amz-security-token:{}\n{}'.format(
- content_type, date, minio_token, url.path)
- signature = _sign_with_hmac(minio_secret, to_sign)
- headers.update(
- {'Authorization': 'AWS {}:{}'.format(minio_key, signature),
- 'x-amz-security-token': minio_token})
-
- with open(file_path, 'rb') as data:
- print('Uploading file to {}'.format(url.geturl()))
- r = requests.put(url.geturl(), headers=headers, data=data)
- #print(r.text)
- r.raise_for_status()