diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml index 7809dfe2..dafec15a 100644 --- a/.github/workflows/build-containers.yml +++ b/.github/workflows/build-containers.yml @@ -30,7 +30,7 @@ jobs: - id: image-list run: | - ORG_DIR=opensciencegrid + ORG_DIR_REGEX="^(opensciencegrid|osg-htc)/" # Get the list of files changed based on the type of event # kicking off the GHA: # 1. For the main branch, diff the previous state of main vs @@ -54,7 +54,7 @@ jobs: images=$(git diff --name-only \ "$BASE" \ "$GITHUB_SHA" | - egrep "^$ORG_DIR/" | + grep -E "$ORG_DIR_REGEX" | cut -d/ -f -2 | sort | uniq | @@ -64,10 +64,11 @@ jobs: else # List all image root dirs. Example value: # "opensciencegrid/vo-frontend opensciencegrid/ospool-cm" - images=$(find $ORG_DIR -mindepth 1 \ - -maxdepth 1 \ - -type d \ - -printf "$ORG_DIR/%P\n") + images=$(find -mindepth 2 \ + -maxdepth 2 \ + -type d \ + -printf "%P\n" | + grep -E "${ORG_DIR_REGEX}") fi image_json=$(echo -n "${images:-dummy}" | jq -Rcs '.|split("\n") | map(select(. != ""))') @@ -87,7 +88,7 @@ jobs: id: set-matrix run: | # Run Python script and capture JSON output - matrix_json=$(python scripts/build-job-matrix.py ${{ steps.image-list.outputs.images }} | tail -n +2) + matrix_json=$(python scripts/build-job-matrix.py ${{ steps.image-list.outputs.images }}) # Use jq to extract the 'include' part of the JSON matrix=$(echo "$matrix_json" | jq -c '.include') echo "::set-output name=matrix::$matrix" @@ -124,7 +125,7 @@ jobs: BASE_OS=$(echo $CONFIG | awk -F'-' '{print $1}') OSG_SERIES=$(echo $CONFIG | awk -F'-' '{print $2}') BASE_REPO=$(echo $CONFIG | awk -F'-' '{print $3}') - CONTEXT="opensciencegrid/${{ matrix.name }}" + CONTEXT="${{ matrix.name }}" echo "BASE_OS=${BASE_OS}" >> $GITHUB_ENV echo "OSG_SERIES=${OSG_SERIES}" >> $GITHUB_ENV echo "BASE_REPO=${BASE_REPO}" >> $GITHUB_ENV @@ -176,7 +177,7 @@ jobs: BASE_OS=$(echo $CONFIG | awk -F'-' '{print $1}') OSG_SERIES=$(echo $CONFIG | awk -F'-' '{print $2}') BASE_REPO=$(echo $CONFIG | awk -F'-' '{print $3}') - CONTEXT="opensciencegrid/${{ matrix.name }}" + CONTEXT="${{ matrix.name }}" echo "BASE_OS=${BASE_OS}" >> $GITHUB_ENV echo "OSG_SERIES=${OSG_SERIES}" >> $GITHUB_ENV echo "BASE_REPO=${BASE_REPO}" >> $GITHUB_ENV diff --git a/scripts/build-job-matrix.py b/scripts/build-job-matrix.py index a8b86388..e255c14e 100644 --- a/scripts/build-job-matrix.py +++ b/scripts/build-job-matrix.py @@ -22,8 +22,6 @@ def load_config(config_path, default_config=None): def main(image_dirs): - print("Image directories:", image_dirs) - default_config = load_config(DEFAULT_CONFIG_PATH) include_list = [] @@ -35,8 +33,6 @@ def main(image_dirs): config = load_config(build_config_path, default_config) - image_name = os.path.basename(image_dir) - base_os_list = config['base_os'] osg_series_list = config['osg_series'] base_repo_list = config['base_repo'] @@ -56,7 +52,7 @@ def main(image_dirs): # 1. Simplicity: Using a single string to represent configurations is straightforward and easy to understand. # 2. Integration: A single string is easily passed to external tools and systems that manage builds. configuration_string = f"{base_os}-{osg_series}-{base_repo}-{config['standard_build']}-{config['repo_build']}" - include_list.append({"name": image_name, "config": configuration_string}) + include_list.append({"name": image_dir, "config": configuration_string}) sys.stdout.flush() json_output = json.dumps({"include": include_list}, indent=4)