Skip to content

Commit

Permalink
add shared action to export advisories in the osv format
Browse files Browse the repository at this point in the history
  • Loading branch information
cpanato committed Mar 26, 2024
1 parent dbd4b09 commit aa71c02
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions build-and-publish-osv/action.yaml
@@ -0,0 +1,76 @@
---
name: 'build-and-publish-osv'
description: |
Build and publish advisories in the OSV format.
inputs:
workload_identity_provider:
description: |
GCO Workload Identity.
required: true
default: ''
service_account:
description: |
GCP service account.
required: true
default: ''
gcp_project_id:
description: |
GCP project id.
required: true
default: ''
wolfictl_args:
description: |
Wolfictl args to run the advisory secdb.
required: true
default: ''
gcs_apk_bucket_name:
description: |
GCS bucket to store the security.json.
required: true
default: ''
gcs_apk_directory_name:
description: |
Directory to store the security.json.
required: false
default: ''
enable_acl_public_read:
description: |
Enable acl public read (set '--canned-acl=publicRead').
required: false
default: ''

runs:
using: "composite"
steps:
- id: auth
name: 'Authenticate to Google Cloud'
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ inputs.workload_identity_provider }}
service_account: ${{ inputs.service_account }}

- uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ inputs.gcp_project_id }}

- name: 'Check that GCloud is properly configured'
run: |
gcloud info
gcloud --quiet alpha storage ls 1> /dev/null
shell: bash

- name: Build the security database
uses: docker://ghcr.io/wolfi-dev/sdk:latest@sha256:1caf04b3d018df12829bdeec93fb1fcc320131d87787de6995847ad1e7aaa77e
with:
entrypoint: wolfictl
args: advisory export --format osv -o osv.yaml ${{ inputs.wolfictl_args }}

- name: 'Upload the security database to a bucket'
run: |
# Don't cache the security.json.
gcloud --quiet alpha storage cp \
${{ inputs.enable_acl_public_read }} --cache-control=no-store \
./osv.yaml \
gs://${{ inputs.gcs_apk_bucket_name }}/${{ inputs.gcs_apk_directory_name}}/
shell: bash

0 comments on commit aa71c02

Please sign in to comment.