|
15 | 15 |
|
16 | 16 | name: Docker Image CVE Scanner |
17 | 17 | on: |
18 | | - schedule: |
19 | | - # This job will run at 3:30 UTC daily |
20 | | - - cron: '30 3 * * *' |
| 18 | + pull_request: |
| 19 | + branches: |
| 20 | + - trunk |
| 21 | + # schedule: |
| 22 | +# # This job will run at 3:30 UTC daily |
| 23 | +# - cron: '30 3 * * *' |
21 | 24 | workflow_dispatch: |
22 | 25 | jobs: |
23 | 26 | scan_jvm: |
24 | 27 | if: github.repository == 'apache/kafka' |
25 | 28 | runs-on: ubuntu-latest |
26 | 29 | strategy: |
27 | 30 | matrix: |
28 | | - # This is an array of supported tags. Make sure this array only contains the supported tags |
29 | | - supported_image_tag: ['latest', '3.9.1', '4.0.1', '4.1.1'] |
| 31 | + # This is an array of supported branches. Make sure this array only contains the supported branches |
| 32 | + supported_image_branches: ['trunk'] # 4.1, 4.0, 3.9 |
30 | 33 | steps: |
| 34 | + - uses: actions/checkout@v5 |
| 35 | + name: Set up Python 3.10 |
| 36 | + with: |
| 37 | + ref: ${{ matrix.supported_image_branches }} |
| 38 | + - uses: actions/setup-python@v6 |
| 39 | + with: |
| 40 | + python-version: "3.10" |
| 41 | + - name: Setup Gradle |
| 42 | + uses: ./.github/actions/setup-gradle |
| 43 | + with: |
| 44 | + java-version: 25 |
| 45 | + gradle-cache-read-only: true |
| 46 | + gradle-cache-write-only: false |
| 47 | + - name: Compile and validate |
| 48 | + run: | |
| 49 | + ./gradlew --build-cache --info $SCAN_ARG check releaseTarGz -x test |
| 50 | + - name: Setup Docker Compose |
| 51 | + run: | |
| 52 | + sudo curl -L "https://github.com/docker/compose/releases/download/v2.30.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
| 53 | + sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose |
| 54 | + sudo chmod +x /usr/bin/docker-compose |
| 55 | + - name: Install dependencies |
| 56 | + run: | |
| 57 | + python -m pip install --upgrade pip |
| 58 | + pip install -r docker/requirements.txt |
| 59 | + - name: Build image and run tests |
| 60 | + working-directory: ./docker |
| 61 | + run: | |
| 62 | + python docker_build_test.py kafka/test -tag=test -type=jvm --kafka-archive=../core/build/distributions/kafka_2.13-$(./gradlew properties | grep version: | awk '{print $NF}' | head -n 1)-SNAPSHOT.tgz |
31 | 63 | - name: Run CVE scan |
32 | 64 | uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1 |
33 | 65 | if: always() |
34 | 66 | with: |
35 | | - image-ref: apache/kafka:${{ matrix.supported_image_tag }} |
| 67 | + image-ref: kafka/test:test |
36 | 68 | format: 'table' |
37 | 69 | severity: 'CRITICAL,HIGH' |
38 | | - output: scan_report_jvm_${{ matrix.supported_image_tag }}.txt |
| 70 | + output: scan_report_jvm_${{ matrix.supported_image_branches }}.txt |
39 | 71 | exit-code: '1' |
40 | 72 | - name: Upload CVE scan report |
41 | 73 | if: always() |
42 | 74 | uses: actions/upload-artifact@v4 |
43 | 75 | with: |
44 | | - name: scan_report_jvm_${{ matrix.supported_image_tag }}.txt |
45 | | - path: scan_report_jvm_${{ matrix.supported_image_tag }}.txt |
| 76 | + name: scan_report_jvm_${{ matrix.supported_image_branches }}.txt |
| 77 | + path: scan_report_jvm_${{ matrix.supported_image_branches }}.txt |
0 commit comments