Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved issue with 'dummy' image to prevent a single build failure f… #208

Merged
merged 3 commits into from
Aug 28, 2024
Merged
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
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"]' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if: ${{ needs.build-image-list.outputs.image_list != '["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 @@ -49,7 +49,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
Loading