Module: Mesa Branch: master Commit: 429ec827d4a7d2322a5e1dd854666e6c2d697082 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=429ec827d4a7d2322a5e1dd854666e6c2d697082
Author: Tomeu Vizoso <[email protected]> Date: Wed Jul 22 17:39:15 2020 +0200 ci: Namespace trace artifacts to the job number Put artifacts in a per-job folder, because if a job is retried then it will try to upload a file to the same key and fail with the following error: 403 Client Error: Forbidden for url: https://minio-packet.freedesktop.org/artifacts/daenzer/mesa/180609/gl-panfrost-t860/results.yml Also, to prevent in the future similar clashes if several trace files share the same name, upload the images with their checksums as their names. This will also make it easier to fetch images for comparison with the references. Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Andres Gomez <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6029> --- .gitlab-ci/lava-gitlab-ci.yml | 2 +- .gitlab-ci/tracie/tracie.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci/lava-gitlab-ci.yml b/.gitlab-ci/lava-gitlab-ci.yml index 78f12fbe7b6..797afc4b25a 100644 --- a/.gitlab-ci/lava-gitlab-ci.yml +++ b/.gitlab-ci/lava-gitlab-ci.yml @@ -33,7 +33,7 @@ kernel+rootfs_armhf: variables: GIT_STRATEGY: none # testing doesn't build anything from source ENV_VARS: "DEQP_PARALLEL=6" - FIXED_ENV_VARS: "CI_PIPELINE_ID=${CI_PIPELINE_ID} CI_PROJECT_PATH=${CI_PROJECT_PATH} TRACIE_NO_UNIT_TESTS=1 TRACIE_UPLOAD_TO_MINIO=1" + FIXED_ENV_VARS: "CI_PIPELINE_ID=${CI_PIPELINE_ID} CI_JOB_ID=${CI_JOB_ID} CI_PROJECT_PATH=${CI_PROJECT_PATH} TRACIE_NO_UNIT_TESTS=1 TRACIE_UPLOAD_TO_MINIO=1" DEQP_VERSION: gles2 ARTIFACTS_PREFIX: "https://minio-packet.freedesktop.org/mesa-lava/" MESA_URL: "https://minio-packet.freedesktop.org/artifacts/${CI_PROJECT_PATH}/${CI_PIPELINE_ID}/mesa-${ARCH}.tar.gz" diff --git a/.gitlab-ci/tracie/tracie.py b/.gitlab-ci/tracie/tracie.py index 0eceffacfaa..d220ef5dc60 100644 --- a/.gitlab-ci/tracie/tracie.py +++ b/.gitlab-ci/tracie/tracie.py @@ -68,14 +68,17 @@ def sign_with_hmac(key, message): return base64.encodebytes(signature).strip().decode() -def upload_artifact(file_name, content_type, device_name): +def upload_artifact(file_name, key, 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"] - resource = '/artifacts/%s/%s/%s/%s' % (os.environ['CI_PROJECT_PATH'], os.environ['CI_PIPELINE_ID'], device_name, os.path.basename(file_name)) + resource = '/artifacts/%s/%s/%s/%s' % (os.environ['CI_PROJECT_PATH'], + os.environ['CI_PIPELINE_ID'], + os.environ['CI_JOB_ID'], + key) date = formatdate(timeval=None, localtime=False, usegmt=True) url = 'https://minio-packet.freedesktop.org%s' % (resource) to_sign = "PUT\n\n%s\n%s\nx-amz-security-token:%s\n%s" % (content_type, date, minio_token, resource) @@ -120,7 +123,7 @@ def gitlab_check_trace(project_url, device_name, trace, expectation): os.makedirs(results_path, exist_ok=True) shutil.move(log_file, os.path.join(results_path, os.path.split(log_file)[1])) if not ok and os.environ.get('TRACIE_UPLOAD_TO_MINIO', '0') == '1': - upload_artifact(image_file, 'image/png', device_name) + upload_artifact(image_file, 'traces/%s.png' % checksum, 'image/png') if not ok or os.environ.get('TRACIE_STORE_IMAGES', '0') == '1': image_name = os.path.split(image_file)[1] shutil.move(image_file, os.path.join(results_path, image_name)) @@ -156,7 +159,7 @@ def run(filename, device_name): with open(os.path.join(RESULTS_PATH, 'results.yml'), 'w') as f: yaml.safe_dump(results, f, default_flow_style=False) if os.environ.get('TRACIE_UPLOAD_TO_MINIO', '0') == '1': - upload_artifact(os.path.join(RESULTS_PATH, 'results.yml'), 'text/yaml', device_name) + upload_artifact(os.path.join(RESULTS_PATH, 'results.yml'), 'traces/results.yml', 'text/yaml') return all_ok _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
