Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 |
Expand All @@ -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(. != ""))')
Expand All @@ -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"
Comment on lines 90 to 94
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions scripts/build-job-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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']
Expand All @@ -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)
Expand Down
Loading