Skip to content

Continuous image testing #471

Continuous image testing

Continuous image testing #471

name: Continuous image testing
on:
schedule:
- cron: "0 1 * * *"
jobs:
prepare-test-matrix:
runs-on: ubuntu-latest
name: Prepare released image revisions to be tested
outputs:
released-revisions-matrix: ${{ steps.prepare-test-matrix.outputs.released-revisions-matrix }}
last-scan: ${{ steps.last-scan.outputs.date }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- run: pip install -r src/tests/requirements.txt
- name: Prepare test matrix
id: prepare-test-matrix
run: ./src/tests/get_released_revisions.py --oci-images-path $PWD/oci
- name: Infer date of last scan
id: last-scan
run: |
# This is scheduled to run every day, so let's look at the previous
# 26 hours, roughly
set -ex
last_scan="$(date --date='26 hours ago' +'%Y-%m-%dT%H:%M:00Z')"
echo "date=$last_scan" >> "$GITHUB_OUTPUT"
run-tests:
name: Run tests for released images
needs: [prepare-test-matrix]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare-test-matrix.outputs.released-revisions-matrix) }}
uses: canonical/oci-factory/.github/workflows/Vulnerability-Scan.yaml@main
with:
oci-image-name: "${{ matrix.source-image }}"
oci-image-path: "oci/${{ matrix.name }}"
date-last-scan: ${{ needs.prepare-test-matrix.outputs.last-scan }}
secrets: inherit