Skip to content

Regarding Copa for scanning the docker image #51

@ofschnai

Description

@ofschnai

Hello

I am trying to use Copa for scanning the build docker image using its GitHub action, but getting below error.

Image

As the action states, we have to give the names of docker images to scan in the matrix and Copa action will try to download those images from docker, then scans and patch it.

Is it possible to scan the docker image which is build in previous github action step? Like below example-

`

  - name: Set up Docker Buildx
    uses: docker/setup-buildx-action@v2

  - name: Build Docker image
    run: |
      docker build -t pythonworld:${{ github.sha }} .

  - name: Generate Trivy Report
    uses: aquasecurity/trivy-action@d43c1f16c00cfd3978dde6c07f4bbcf9eb6993ca # 0.16.1
    with:
      scan-type: "image"
      format: "json"
      output: "report.json"
      ignore-unfixed: true
      vuln-type: "os"
      image-ref: "pythonworld:${{ github.sha }}"

      
  - name: Check vulnerability count
    id: vuln_count
    run: |
      report_file="report.json"
      vuln_count=$(jq 'if .Results then [.Results[] | select(.Class=="os-pkgs" and .Vulnerabilities!=null) | .Vulnerabilities[]] | length else 0 end' "$report_file")
      echo "vuln_count=$vuln_count" >> $GITHUB_OUTPUT

  - name: Log in to Azure Container Registry
    uses: azure/docker-login@v2
    with:
      username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
      password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
      login-server: ${{ secrets.CONTAINER_REGISTRY_URL }}

  - name: Run Copa action
    if: steps.vuln_count.outputs.vuln_count != '0'
    id: copa
      # using main for testing purposes
      # use a tag (such as v1 or v1.0.1) at a bare minimum
      # recommendation is to pin to a digest for security and stability
      # and rely on dependabot for digest/version updates
    uses: project-copacetic/copa-action@main
    with:
      image: "pythonworld:${{ github.sha }}"
      image-report: "report.json"
      patched-tag: ${{ github.sha }}
      timeout: "5m" # optional, default is 5m
      output: vex.json # optional
      format: "openvex" # optional, default is openvex`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions