From 04b52adf872d7df60d0fa94e97597955b9c0db29 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Wed, 19 Jul 2023 16:16:04 -0700 Subject: [PATCH] builder: fetch manifest from S3 --- builder.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/builder.py b/builder.py index 4177e7f..987893f 100755 --- a/builder.py +++ b/builder.py @@ -4,6 +4,7 @@ import time import os import subprocess import boto3 +import io import json import click import sys @@ -57,7 +58,7 @@ TARGETS = { }, } -MANIFEST_URI = os.getenv("MANIFEST_URI") +MANIFEST = os.getenv("MANIFEST", "installer_data.json") S3_BUCKET = os.getenv("S3_BUCKET") @@ -150,7 +151,12 @@ def packageUpload(target): def getManifest(): - return requests.get(MANIFEST_URI).json() + s3 = boto3.resource("s3") + obj = s3.Object(S3_BUCKET, MANIFEST) + data = io.BytesIO() + obj.download_fileobj(data) + + return json.loads(data.getvalue().decode("utf-8")) def manifestUpdate(): @@ -198,7 +204,7 @@ def upload(target): packageUpload(target) manifestUpdate() - uploadToS3("merged_installer_data.json", "installer_data.json") + uploadToS3("merged_installer_data.json", MANIFEST) @cli.command()