diff --git a/.github/workflows/core-build-stable.yml b/.github/workflows/core-build-stable.yml index 675c480..a1bf344 100644 --- a/.github/workflows/core-build-stable.yml +++ b/.github/workflows/core-build-stable.yml @@ -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 diff --git a/.github/workflows/core-build-test-images.yml b/.github/workflows/core-build-test-images.yml index 207a083..f580365 100644 --- a/.github/workflows/core-build-test-images.yml +++ b/.github/workflows/core-build-test-images.yml @@ -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 diff --git a/.github/workflows/security-scan-images.yml b/.github/workflows/security-scan-images.yml deleted file mode 100644 index 344dbdb..0000000 --- a/.github/workflows/security-scan-images.yml +++ /dev/null @@ -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 }}