Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add shared action to export advisories in the osv format
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |