From 95f218e060911729e1308cc6484bb44ba5c4f278 Mon Sep 17 00:00:00 2001 From: Mark Do Date: Wed, 5 Jun 2024 13:13:56 +0000 Subject: [PATCH] Modified behaviour to do asset-management for all branches --- src/main.py | 30 +----------------------------- src/run.sh | 13 ++++++++++++- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/main.py b/src/main.py index 2c02a29..804933e 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,4 @@ import os -import hashlib import subprocess import boto3 @@ -187,31 +186,4 @@ def clean_bucket(): run_command(f's3cmd --config={bucket_map[S3_TEMP]} del {S3_TEMP}/{asset}') if __name__ == "__main__": - manage_assets() - # clean_bucket() - - # "server-room-light-min.jpg" -> watcloud://v1/sha256:96fc3a9fe38828d5db6146e9f8ddff0556f108fd1097f4c8a8c26721a01af557 - # "text2" -> watcloud://v1/sha256:d848ca35a6281600b5da598c7cb4d5df561e0ee63ee7cec0e98e6049996f3ff?name=text2.txt - # print(get_sha256_dict(["server-room-dark-min", "server-room-light-min", "text2"])) - - # print(get_assets_in_repo()) - # print("hello world") - # print(FILE_PATH) - # print(run_command("ls")) - # print("Temp") - # print(get_assets_in_bucket(bucket_temp)) - # print("Perm") - # print(get_assets_in_bucket(bucket_perm)) - - # print("script ran") - - # Boto test - # print(bucket_perm) - # print(bucket_temp) - - # download_file("requirements.txt", "temp/sussy.txt", bucket_perm) - - # current_dir = os.path.dirname(os.path.abspath(__file__)) - # files = os.listdir(current_dir) - # for f in files: - # print(f) \ No newline at end of file + manage_assets() \ No newline at end of file diff --git a/src/run.sh b/src/run.sh index 73a63de..51f5946 100644 --- a/src/run.sh +++ b/src/run.sh @@ -12,4 +12,15 @@ git clone -b hepromark/asset-kubernetes2 git@github.com:WATonomous/infra-config. # Install libraries pip install -r requirements.txt -python3 main.py +# Get list of branches +BRANCHES=$(git ls-remote --heads origin | sed 's?.*refs/heads/??') + +# Loop through each branch +for BRANCH in $BRANCHES; do + echo "Managing Assets for: $BRANCH" + git checkout $BRANCH + git pull origin $BRANCH + + echo "calling main.py" + python3 main.py +done