Skip to content

Commit

Permalink
Merge pull request #208 from PPathu/Version-1.4.Build-Config-File
Browse files Browse the repository at this point in the history
Resolved issue with 'dummy' image to prevent a single build failure f…
  • Loading branch information
brianhlin authored Aug 28, 2024
2 parents 9079e74 + 5126b0e commit 75cff05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
image_list: ${{ steps.image-list.outputs.image_list }}
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -72,6 +73,7 @@ jobs:
image_json=$(echo -n "${images:-dummy}" | jq -Rcs '.|split("\n") | map(select(. != ""))')
echo "$image_json" > image_list.json
echo "images=$(echo $images | tr '\n' ' ')" >> $GITHUB_OUTPUT
echo "image_list=$image_json" >> $GITHUB_OUTPUT
- name: Display image list
run: cat image_list.json
Expand All @@ -89,6 +91,7 @@ jobs:
# Use jq to extract the 'include' part of the JSON
matrix=$(echo "$matrix_json" | jq -c '.include')
echo "::set-output name=matrix::$matrix"
- name: Verify matrix content
run: |
Expand All @@ -98,7 +101,7 @@ jobs:
build:
runs-on: ubuntu-latest
needs: build-image-list
if: needs.build-image-list.outputs.images != '["dummy"]'
if: ${{ needs.build-image-list.outputs.image_list != '["dummy"]' }}
# Prevent a single build failure from killing the workflow.
# This is safe since subsequent pushes should fail on cache load
continue-on-error: true
Expand Down Expand Up @@ -152,7 +155,7 @@ jobs:
github.ref == 'refs/heads/main' &&
github.event_name != 'pull_request' &&
github.repository_owner == 'opensciencegrid' &&
needs.build-image-list.outputs.images != '["dummy"]'
needs.build-image-list.outputs.image_list != '["dummy"]'
needs: [make-date-tag, build-image-list, build]
strategy:
fail-fast: false
Expand Down
3 changes: 2 additions & 1 deletion scripts/build-job-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def main(image_dirs):
# Constructs a unique configuration string to represent each build setting.
# This combines the base OS, OSG series, base repository, and two standard
# build parameters, making it easy to identify and manage each configuration.
# This approach is preferred because it offers:
# This approach is preferred because GHA's inability to deal with nested JSON
# structures in the matrix construction and it offers:
# 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']}"
Expand Down

0 comments on commit 75cff05

Please sign in to comment.