From ed3718ec251d4faed10a941d8d4e9363135dcdef Mon Sep 17 00:00:00 2001 From: Kent Huang Date: Thu, 24 Oct 2024 15:58:43 +0800 Subject: [PATCH] [Bug] DRC-832 Fix recce checks status doen't shown on Cloud page Signed-off-by: Kent Huang --- recce/state.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recce/state.py b/recce/state.py index 70b63386..789edfec 100644 --- a/recce/state.py +++ b/recce/state.py @@ -8,6 +8,7 @@ from datetime import datetime from hashlib import md5, sha256 from typing import List, Optional, Dict, Union, Tuple +from urllib.parse import urlencode import botocore.exceptions from pydantic import BaseModel @@ -416,9 +417,10 @@ def _export_state_to_recce_cloud(self, metadata: dict = None) -> Union[str, None presigned_url = RecceCloud(token=self.cloud_options.get('token')).get_presigned_url( method=PresignedUrlMethod.UPLOAD, pr_info=self.pr_info, artifact_name=RECCE_STATE_COMPRESSED_FILE, metadata=metadata) - compress_passwd = self.cloud_options.get('password') headers = s3_sse_c_headers(compress_passwd) + if metadata: + headers['x-amz-tagging'] = urlencode(metadata) with tempfile.NamedTemporaryFile() as tmp: self._export_state_to_file(tmp.name, file_type=SupportedFileTypes.GZIP) response = requests.put(presigned_url, data=open(tmp.name, 'rb').read(), headers=headers)