Skip to content

KAFKA-19881: change CVE scanner workflow to run on active branches (wip) #608

KAFKA-19881: change CVE scanner workflow to run on active branches (wip)

KAFKA-19881: change CVE scanner workflow to run on active branches (wip) #608

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Docker Image CVE Scanner
on:
pull_request:
branches:
- trunk
# schedule:
# # This job will run at 3:30 UTC daily
# - cron: '30 3 * * *'
workflow_dispatch:
jobs:
scan_jvm:
if: github.repository == 'apache/kafka'
runs-on: ubuntu-latest
strategy:
matrix:
# This is an array of supported branches. Make sure this array only contains the supported branches
supported_image_branches: ['trunk'] # 4.1, 4.0, 3.9
steps:
- uses: actions/checkout@v5
name: Set up Python 3.10
with:
ref: ${{ matrix.supported_image_branches }}
- uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Setup Gradle
uses: ./.github/actions/setup-gradle
with:
java-version: 25
gradle-cache-read-only: true
gradle-cache-write-only: false
- name: Compile and validate
run: |
./gradlew --build-cache --info $SCAN_ARG check releaseTarGz -x test
- name: Setup Docker Compose
run: |
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
sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docker/requirements.txt
- name: Build image and run tests
working-directory: ./docker
run: |
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
- name: Run CVE scan
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
if: always()
with:
image-ref: kafka/test:test
format: 'table'
severity: 'CRITICAL,HIGH'
output: scan_report_jvm_${{ matrix.supported_image_branches }}.txt
exit-code: '1'
- name: Upload CVE scan report
if: always()
uses: actions/upload-artifact@v4
with:
name: scan_report_jvm_${{ matrix.supported_image_branches }}.txt
path: scan_report_jvm_${{ matrix.supported_image_branches }}.txt