lhotari commented on code in PR #22063: URL: https://github.com/apache/pulsar/pull/22063#discussion_r1507449184
########## .github/workflows/ci-trivy-container-scan.yaml: ########## @@ -0,0 +1,92 @@ +# +# 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: CI - Trivy Container Scan +on: + schedule: + - cron: '0 8 * * *' # Every day at 8am UTC + workflow_dispatch: + inputs: + report-format: + description: 'Format of the report' + type: choice + default: table + options: + - table + - json + - sarif + severity: + description: "Severities to include (comma-separated or 'ALL' to include all)" + required: false + default: 'CRITICAL,HIGH' + +jobs: + container_scan: + if: ${{ github.repository == 'apache/pulsar' }} + name: Trivy Docker image vulnerability scan + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + docker-image: + - 'apachepulsar/pulsar' + - 'apachepulsar/pulsar-all' + docker-tag: + - '3.2.0' + env: + IMAGE_REF: '${{ matrix.docker-image }}:${{ matrix.docker-tag }}' + steps: + - id: prepare-vars + shell: bash + run: | + IMAGE_REF_CLEAN="$(echo $IMAGE_REF | sed 's/-/_/g; s/\./_/g; s/:/_/g; s/\//_/g')" + echo "image_ref_clean=$IMAGE_REF_CLEAN" >> "$GITHUB_OUTPUT" + echo "report_filename=trivy-scan-$IMAGE_REF_CLEAN.${{ inputs.report-format }}" >> "$GITHUB_OUTPUT" + - name: Run Trivy container scan + uses: aquasecurity/trivy-action@master + with: + image-ref: ${{ env.IMAGE_REF }} + scanners: vuln + severity: ${{ inputs.severity != 'ALL' && inputs.severity || 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL' }} + limit-severities-for-sarif: true + format: ${{ inputs.report-format }} + output: ${{ steps.prepare-vars.outputs.report_filename }} + exit-code: 1 + - name: Email Trivy container scan report + uses: dawidd6/action-send-mail@v3 + if: ${{ failure() }} + with: + server_address: smtp.gmail.com + server_port: 465 + secure: true + username: ${{secrets.TRIVY_SCAN_MAIL_USERNAME}} Review Comment: we cannot add secrets to `apache/pulsar` ourselves. The only way to add secrets is to contact ASF Infra support by creating an INFRA ticket in ASF Jira. They will most likely refuse to add a personal token. I'm not sure if there's an email option available. ASF Infra people could be also reached on [ASF Slack's #asfinfra channel](https://infra.apache.org/slack.html). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
