From 1b32355117ad3f4322f299d674f5d35651289cdf Mon Sep 17 00:00:00 2001 From: Xor290 Date: Sun, 10 May 2026 18:13:37 +0200 Subject: [PATCH] fix: CI --- .../workflows/frontend-admin-build-local.yml | 4 ++-- .../workflows/frontend-client-build-local.yml | 4 ++-- scripts/eas_cache.py | 23 ++++++++++++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/frontend-admin-build-local.yml b/.github/workflows/frontend-admin-build-local.yml index a9bf9efc..d55f1ef9 100644 --- a/.github/workflows/frontend-admin-build-local.yml +++ b/.github/workflows/frontend-admin-build-local.yml @@ -89,7 +89,7 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.RUSTFS_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.RUSTFS_SECRET_KEY }} - S3_ENDPOINT: https://s3.uber-stup.club + S3_ENDPOINT: https://rustfs.uber-stup.club S3_BUCKET: apk-builds run: python scripts/eas_cache.py restore --app frontend-admin @@ -109,7 +109,7 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.RUSTFS_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.RUSTFS_SECRET_KEY }} - S3_ENDPOINT: https://s3.uber-stup.club + S3_ENDPOINT: https://rustfs.uber-stup.club S3_BUCKET: apk-builds run: python scripts/eas_cache.py save --app frontend-admin diff --git a/.github/workflows/frontend-client-build-local.yml b/.github/workflows/frontend-client-build-local.yml index a62179b5..d28d9ec7 100644 --- a/.github/workflows/frontend-client-build-local.yml +++ b/.github/workflows/frontend-client-build-local.yml @@ -89,7 +89,7 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.RUSTFS_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.RUSTFS_SECRET_KEY }} - S3_ENDPOINT: https://s3.uber-stup.club + S3_ENDPOINT: https://rustfs.uber-stup.club S3_BUCKET: apk-builds run: python scripts/eas_cache.py restore --app mobile @@ -109,7 +109,7 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.RUSTFS_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.RUSTFS_SECRET_KEY }} - S3_ENDPOINT: https://s3.uber-stup.club + S3_ENDPOINT: https://rustfs.uber-stup.club S3_BUCKET: apk-builds run: python scripts/eas_cache.py save --app mobile diff --git a/scripts/eas_cache.py b/scripts/eas_cache.py index 733d4bc3..b22f6ad9 100644 --- a/scripts/eas_cache.py +++ b/scripts/eas_cache.py @@ -72,6 +72,8 @@ def _boto3_client(): try: import boto3 from botocore.config import Config + import urllib3 + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) except ImportError: print("❌ boto3 non installé — lance : pip install boto3") sys.exit(1) @@ -87,10 +89,27 @@ def _boto3_client(): aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"], aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"], region_name=os.environ.get("AWS_DEFAULT_REGION", "us-east-1"), - config=Config(s3={"addressing_style": "path"}), + config=Config( + s3={"addressing_style": "path"}, + signature_version="s3v4", + ), + verify=False, ) +def ensure_bucket(s3, bucket: str): + """Crée le bucket s'il n'existe pas.""" + try: + s3.head_bucket(Bucket=bucket) + except Exception: + try: + s3.create_bucket(Bucket=bucket) + print(f"🪣 Bucket '{bucket}' créé") + except Exception as e: + print(f"❌ Impossible de créer le bucket '{bucket}': {e}") + sys.exit(1) + + class _Progress: """Affiche la progression upload/download en MB.""" @@ -136,6 +155,7 @@ def object_size(s3, bucket: str, key: str) -> int: def restore(app: str, repo_root: Path, bucket: str): s3 = _boto3_client() + ensure_bucket(s3, bucket) full_key = compute_key(app, repo_root, full=True) fallback_key = compute_key(app, repo_root, full=False) @@ -171,6 +191,7 @@ def restore(app: str, repo_root: Path, bucket: str): def save(app: str, repo_root: Path, bucket: str): s3 = _boto3_client() + ensure_bucket(s3, bucket) cache_key = compute_key(app, repo_root, full=True) obj = s3_key(app, cache_key)