Skip to content

Commit

Permalink
fix(ci): correctly run commands (#1240)
Browse files Browse the repository at this point in the history
fix(ci): source linuxbrew env to make trivy available
  • Loading branch information
cwrau authored Nov 19, 2024
1 parent df81fd4 commit b0c97f0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/check-licenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- run: pip install yq
- run: /home/linuxbrew/.linuxbrew/bin/brew install trivy
- run: ./.github/scripts/scan-for-licenses.sh ${{ needs.getChangedChart.outputs.chart }}
- run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
./.github/scripts/scan-for-licenses.sh ${{ needs.getChangedChart.outputs.chart }}
check-licenses-list:
name: check licenses from list
runs-on: ubuntu-latest
Expand All @@ -34,8 +36,10 @@ jobs:
- env:
chart: ${{ needs.getChangedChart.outputs.chart }}
run: |
set -ex
set -o pipefail
# shellcheck disable=SC2016
if missingImages="$(yq -r -e -c --argjson usedImages "$(cat "${chart?}/Chart.yaml" .github/image_licenses.yaml | yq -r '.annotations["artifacthub.io/images"]' | yq -r -c 'map(.image | split(":")[0]) | unique')" '$usedImages - (.licenses | keys) | if length == 0 then false else . end')"; then
if missingImages="$(yq -r -e -c --argjson usedImages "$(yq -r '.annotations["artifacthub.io/images"]' "charts/${chart?}/Chart.yaml" | yq -r -c 'map(.image | split(":")[0]) | unique')" '$usedImages - (.licenses | keys) | if length == 0 then false else . end' .github/image_licenses.yaml)"; then
echo "The following images have no license, please review:"
echo "$missingImages" | yq -r 'map(" - " + .)[]'
exit 1
Expand Down

0 comments on commit b0c97f0

Please sign in to comment.