refactor(ci): reuse stable image scans
This commit is contained in:
parent
af3065c5a7
commit
810a7285e9
|
|
@ -36,6 +36,10 @@ on:
|
|||
- .github/workflows/core-build-test-images.yml
|
||||
- .github/workflows/core-publish-images.yml
|
||||
|
||||
schedule:
|
||||
# Every Monday at 03:17 UTC
|
||||
- cron: "17 3 * * 1"
|
||||
|
||||
# Triggered from frappe/frappe and frappe/erpnext on releases
|
||||
repository_dispatch:
|
||||
|
||||
|
|
@ -51,7 +55,12 @@ jobs:
|
|||
node_version: "22"
|
||||
|
||||
v15_publish:
|
||||
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||
if: >-
|
||||
${{
|
||||
github.repository == 'frappe/frappe_docker' &&
|
||||
github.event_name != 'pull_request' &&
|
||||
github.event_name != 'schedule'
|
||||
}}
|
||||
needs: v15_test
|
||||
uses: ./.github/workflows/core-publish-images.yml
|
||||
with:
|
||||
|
|
@ -72,7 +81,12 @@ jobs:
|
|||
python_version: "3.14"
|
||||
node_version: "24"
|
||||
v16_publish:
|
||||
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||
if: >-
|
||||
${{
|
||||
github.repository == 'frappe/frappe_docker' &&
|
||||
github.event_name != 'pull_request' &&
|
||||
github.event_name != 'schedule'
|
||||
}}
|
||||
needs: v16_test
|
||||
uses: ./.github/workflows/core-publish-images.yml
|
||||
with:
|
||||
|
|
@ -88,7 +102,12 @@ jobs:
|
|||
update_versions:
|
||||
name: Update example.env and pwd.yml
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'frappe/frappe_docker' && github.event_name != 'pull_request' }}
|
||||
if: >-
|
||||
${{
|
||||
github.repository == 'frappe/frappe_docker' &&
|
||||
github.event_name != 'pull_request' &&
|
||||
github.event_name != 'schedule'
|
||||
}}
|
||||
needs: v16_publish
|
||||
permissions:
|
||||
contents: write
|
||||
|
|
|
|||
|
|
@ -204,8 +204,8 @@ jobs:
|
|||
if: >-
|
||||
${{
|
||||
always() &&
|
||||
github.event_name == 'push' &&
|
||||
github.ref == 'refs/heads/main' &&
|
||||
(github.event_name == 'push' || github.event_name == 'schedule') &&
|
||||
hashFiles('trivy-results/*.sarif') != ''
|
||||
}}
|
||||
continue-on-error: true
|
||||
|
|
|
|||
|
|
@ -1,104 +0,0 @@
|
|||
name: Security / Scan Published Images
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Every Monday at 03:17 UTC
|
||||
- cron: "17 3 * * 1"
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
scan:
|
||||
name: Version ${{ matrix.version }} / ${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version: ["15", "16"]
|
||||
arch: [amd64, arm64]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Resolve published image versions
|
||||
run: python3 ./.github/scripts/get_latest_tags.py --repo erpnext --version ${{ matrix.version }}
|
||||
|
||||
- name: Pull published images
|
||||
run: |
|
||||
docker pull --platform linux/${{ matrix.arch }} frappe/base:${FRAPPE_VERSION}
|
||||
docker pull --platform linux/${{ matrix.arch }} frappe/build:${ERPNEXT_VERSION}
|
||||
docker pull --platform linux/${{ matrix.arch }} frappe/erpnext:${ERPNEXT_VERSION}
|
||||
|
||||
- name: Create Trivy report directory
|
||||
run: mkdir -p trivy-results
|
||||
|
||||
- name: Scan base image
|
||||
uses: aquasecurity/trivy-action@v0.36.0
|
||||
with:
|
||||
image-ref: frappe/base:${{ env.FRAPPE_VERSION }}
|
||||
scanners: vuln
|
||||
format: sarif
|
||||
output: trivy-results/base.sarif
|
||||
severity: HIGH,CRITICAL
|
||||
ignore-unfixed: true
|
||||
limit-severities-for-sarif: true
|
||||
exit-code: 0
|
||||
|
||||
- name: Scan build image
|
||||
uses: aquasecurity/trivy-action@v0.36.0
|
||||
with:
|
||||
image-ref: frappe/build:${{ env.ERPNEXT_VERSION }}
|
||||
scanners: vuln
|
||||
format: sarif
|
||||
output: trivy-results/build.sarif
|
||||
severity: HIGH,CRITICAL
|
||||
ignore-unfixed: true
|
||||
limit-severities-for-sarif: true
|
||||
exit-code: 0
|
||||
skip-setup-trivy: true
|
||||
|
||||
- name: Scan ERPNext image
|
||||
uses: aquasecurity/trivy-action@v0.36.0
|
||||
with:
|
||||
image-ref: frappe/erpnext:${{ env.ERPNEXT_VERSION }}
|
||||
scanners: vuln
|
||||
format: sarif
|
||||
output: trivy-results/erpnext.sarif
|
||||
severity: HIGH,CRITICAL
|
||||
ignore-unfixed: true
|
||||
limit-severities-for-sarif: true
|
||||
exit-code: 0
|
||||
skip-setup-trivy: true
|
||||
|
||||
- name: Add Trivy result counts to summary
|
||||
if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "## Trivy image findings" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo >> "$GITHUB_STEP_SUMMARY"
|
||||
for report in trivy-results/*.sarif; do
|
||||
image="$(basename "$report" .sarif)"
|
||||
findings="$(jq '[.runs[]?.results[]?] | length' "$report")"
|
||||
echo "- **${image}:** ${findings} finding(s)" >> "$GITHUB_STEP_SUMMARY"
|
||||
done
|
||||
|
||||
- name: Upload Trivy report artifact
|
||||
if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: trivy-${{ matrix.version }}-${{ matrix.arch }}
|
||||
path: trivy-results/*.sarif
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload Trivy results to code scanning
|
||||
if: ${{ always() && hashFiles('trivy-results/*.sarif') != '' }}
|
||||
uses: github/codeql-action/upload-sarif@v4
|
||||
with:
|
||||
sarif_file: trivy-results
|
||||
category: trivy-${{ matrix.version }}-${{ matrix.arch }}
|
||||
Loading…
Reference in New Issue