Skip to content

Commit

Permalink
ci: scan amd
Browse files Browse the repository at this point in the history
  • Loading branch information
0xawaz committed Nov 29, 2024
1 parent e14009e commit 1a7e03d
Showing 1 changed file with 15 additions and 57 deletions.
72 changes: 15 additions & 57 deletions .github/workflows/common-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,17 @@ on:
GRAVITON_BUILDER_SSH_PRIVATE_KEY:
required: true
inputs:
ref:
type: string
required: false
default: ""
working-directory:
type: string
required: true
docker-context:
type: string
required: false
default: "."
image-name:
type: string
required: true
push_image:
type: boolean
default: true
required: false
runs_on:
type: string
required: false
default: "ubuntu-latest"
docker-file:
type: string
default: "ci.dockerfile"
required: false
graviton-build-host:
type: string
required: false
default: "ec2-15-188-101-126.eu-west-3.compute.amazonaws.com"
arm-build:
type: boolean
default: true
required: false
cache-from:
type: string
required: false
default: "type=gha"
cache-to:
type: string
required: false
default: "type=gha,mode=max"
ref: { type: string, default: "" }
working-directory: { type: string, required: true }
docker-context: { type: string, default: "." }
image-name: { type: string, required: true }
push_image: { type: boolean, default: true }
runs_on: { type: string, default: "ubuntu-latest" }
docker-file: { type: string, default: "ci.dockerfile" }
graviton-build-host: { type: string, default: "ec2-15-188-101-126.eu-west-3.compute.amazonaws.com" }
arm-build: { type: boolean, default: true }
cache-from: { type: string, default: "type=gha" }
cache-to: { type: string, default: "type=gha,mode=max" }
outputs:
image_name:
description: "Image Name with Tag generated by this task"
Expand Down Expand Up @@ -88,13 +57,11 @@ jobs:
- endpoint: "ssh://ec2-user@${{ inputs.graviton-build-host }}"
platforms: linux/arm64
- name: Echo github event
run: echo "Github event ==> ${{ github.event_name }}"

- name: Current branch sha
if: github.event_name != 'release'
run: |
echo "DOCKER_TAG_IMAGE=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Current Tag
if: github.event_name == 'release'
run: |
Expand All @@ -111,7 +78,7 @@ jobs:
push: false
pull: false
provenance: false
outputs: type=docker, dest=docker-${{ inputs.image-name }}-oci-tar-${{env.DOCKER_TAG_IMAGE }}
outputs: type=docker, dest=docker-${{ inputs.image-name }}-oci-tar-${{env.DOCKER_TAG_IMAGE }}-amd
tags: ghcr.io/zama-ai/${{ inputs.image-name }}:${{env.DOCKER_TAG_IMAGE }},ghcr.io/zama-ai/${{ inputs.image-name }}:latest
cache-from: ${{ inputs.cache-from }}
cache-to: ${{ inputs.cache-to }}
Expand All @@ -120,16 +87,8 @@ jobs:
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 ## v4.4.3
if: success()
with:
name: docker-${{ inputs.image-name }}-img-${{env.DOCKER_TAG_IMAGE }}
path: docker-${{ inputs.image-name }}-oci-tar-${{env.DOCKER_TAG_IMAGE }}

scan-vulns-docker-tarball:
runs-on: ubuntu-latest
needs: [build]

steps:
- name: Checkout parent Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 ## v4
name: docker-${{ inputs.image-name }}-img-${{env.DOCKER_TAG_IMAGE }}-amd
path: docker-${{ inputs.image-name }}-oci-tar-${{env.DOCKER_TAG_IMAGE }}-amd

- name: Download Container Img Tarball as Artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 ## v4
Expand Down Expand Up @@ -186,4 +145,3 @@ jobs:
with:
sarif_file: trivy-out-docker.sarif
category: sca-trivy-docker

0 comments on commit 1a7e03d

Please sign in to comment.