Update containers.build.yaml
Signed-off-by: Kjeld Schouten <info@kjeldschouten.nl>
This commit is contained in:
@@ -29,6 +29,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
outputs:
|
outputs:
|
||||||
matrix: '{"container": ${{ steps.reduce.outputs.containers }} }'
|
matrix: '{"container": ${{ steps.reduce.outputs.containers }} }'
|
||||||
|
containers_found: ${{ steps.reduce.outputs.containers_found }} # New output
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
||||||
@@ -45,8 +46,17 @@ jobs:
|
|||||||
- id: reduce
|
- id: reduce
|
||||||
run: |
|
run: |
|
||||||
CONTAINERS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>/?containers/(?<first_directory>(?<root1>[/]?)[^/]+/)(?<second_directory>(?<root2>[/]?)[^/]+)(?<extra_paths>/[^/]+)*)"; "\(.second_directory)") | unique' changes.json)
|
CONTAINERS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>/?containers/(?<first_directory>(?<root1>[/]?)[^/]+/)(?<second_directory>(?<root2>[/]?)[^/]+)(?<extra_paths>/[^/]+)*)"; "\(.second_directory)") | unique' changes.json)
|
||||||
|
|
||||||
|
# Set the containers output
|
||||||
echo ::set-output name=containers::${CONTAINERS}
|
echo ::set-output name=containers::${CONTAINERS}
|
||||||
|
|
||||||
|
# Check if containers were found and set the containers_found output
|
||||||
|
if [[ -z "$CONTAINERS" ]]; then
|
||||||
|
echo ::set-output name=containers_found::false
|
||||||
|
else
|
||||||
|
echo ::set-output name=containers_found::true
|
||||||
|
fi
|
||||||
|
|
||||||
hadolint:
|
hadolint:
|
||||||
name: Run hadolint
|
name: Run hadolint
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
@@ -85,7 +95,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.changes.outputs.matrix) }}
|
matrix: ${{ fromJson(needs.changes.outputs.matrix) }}
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
if: ${{ needs.changes.outputs.matrix != '{}' && needs.changes.outputs.matrix != '' && fromJson(needs.changes.outputs.matrix).container != null }}
|
if: ${{ needs.changes.outputs.containers_found == 'true' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
|
||||||
|
|||||||
Reference in New Issue
Block a user