From 6fd9cb1d8f34c64eae350cf610ee9a85d351e135 Mon Sep 17 00:00:00 2001 From: shane knapp Date: Tue, 27 Aug 2024 16:29:40 -0700 Subject: [PATCH] script and workflow to get deployments from deployments/ subdir --- .github/scripts/get-deployments.py | 29 ++++++++++++++++++++++++++ .github/workflows/deploy-all-hubs.yaml | 8 +------ 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100755 .github/scripts/get-deployments.py diff --git a/.github/scripts/get-deployments.py b/.github/scripts/get-deployments.py new file mode 100755 index 000000000..b96ad2767 --- /dev/null +++ b/.github/scripts/get-deployments.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import argparse +import os + +def main(args): + + for deployment in next(os.walk(args.deployments))[1]: + if deployment not in args.ignore: + print(deployment) + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Generate a list of deployments from the deployments/ directory.') + parser.add_argument( + '--deployments', + '-d', + default='deployments', + help='The directory to search for deployments.' + ) + parser.add_argument( + '--ignore', + '-i', + nargs='*', + default=(), + help='Ignore one or more directories in the deployments/ subdir.' + ) + args = parser.parse_args() + + main(args) \ No newline at end of file diff --git a/.github/workflows/deploy-all-hubs.yaml b/.github/workflows/deploy-all-hubs.yaml index cd032018c..1eacf59c8 100644 --- a/.github/workflows/deploy-all-hubs.yaml +++ b/.github/workflows/deploy-all-hubs.yaml @@ -177,13 +177,7 @@ jobs: - name: Deploy base hub images to prod if: ${{ env.DEPLOY }} run: | - ignored_directories=("template") # these are directories that we never want to deploy while read deployment; do - for ignored in "${ignored_directories[@]}"; do - if [[ "${deployment}" == "${ignored}" ]]; then - continue 2 # skip to the next iteration of "while read deployment" - fi - done echo "Pretending to deploy base hub image to ${deployment} :P" echo "hubploy deploy --verbose ${deployment} hub prod" - done < <(ls deployments/ | sed -e 's,/,,g') + done < <(.github/scripts/get-deployments.py --ignore template)