Skip to content

Scan All Configured Docker Images #160

Scan All Configured Docker Images

Scan All Configured Docker Images #160

Workflow file for this run

name: CI
on:
push:
branches:
- main
- develop
tags:
- v[0-9]+.[0-9]+.[0-9]+**
pull_request:
branches:
- main
- develop
env:
FEASIBILITY_COMPOSE_PROJECT: test
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Check shell scripts
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: .github/scripts
test-feasibility-triangle-fhir-server:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install Blazectl
run: .github/scripts/install-blazectl.sh
- name: Initialize .env's
run: feasibility-triangle/initialise-triangle-env-files.sh
- name: Change Flare External Port
run: sed -i 's/8084/18084/g' feasibility-triangle/flare/.env
- name: Generate certificate
run: feasibility-triangle/generate-cert.sh
- name: Start Triangle
run: feasibility-triangle/start-triangle.sh
- name: Load Data
run: |
ACCESS_TOKEN="$(feasibility-triangle/get-fhir-server-access-token.sh)"
blazectl --no-progress --server https://fhir.localhost:444/fhir --certificate-authority feasibility-triangle/auth/cert.pem --token "$ACCESS_TOKEN" upload .github/test-data
- name: Run Test Queries
run: |
ACCESS_TOKEN="$(feasibility-triangle/get-fhir-server-access-token.sh)"
.github/scripts/test-consent-queries.sh https://fhir.localhost:444/fhir "$ACCESS_TOKEN" feasibility-triangle/auth/cert.pem
prepare-security-scan:
runs-on: ubuntu-latest
outputs:
images: ${{ steps.matrixgen.outputs.images }}
steps:
- uses: actions/checkout@v4
- name: Generate Image Test Matrix
id: matrixgen
run: |
echo "images=$(
first=true
echo -n '['
for i in $(grep -r --include="*docker-compose.yml" -Pho 'image: \K(.+)$' | tr -d "\"'" | sort | uniq)
do
if $first
then
first=false
else
echo -n ","
fi
echo -n '"'$i'"'
done
echo ']')" >> "$GITHUB_OUTPUT"
security-scan:
runs-on: ubuntu-latest
needs: prepare-security-scan
strategy:
fail-fast: false
matrix:
image: ${{ fromJSON(needs.prepare-security-scan.outputs.images) }}
steps:
- name: Run Trivy Vulnerability Scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ matrix.image }}
exit-code: 1
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
timeout: '15m0s'
security-scan-upload:
runs-on: ubuntu-latest
needs: prepare-security-scan
strategy:
fail-fast: false
matrix:
image: ${{ fromJSON(needs.prepare-security-scan.outputs.images) }}
steps:
- name: Run Trivy Vulnerability Scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ matrix.image }}
format: sarif
ignore-unfixed: true
output: trivy-results.sarif
severity: 'CRITICAL,HIGH'
timeout: '15m0s'
- name: Upload Trivy Scan Results to GitHub Security Tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif