fix: CI
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+22
-1
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user