Skip to content

build-trivy-bundle

build-trivy-bundle #12

name: build-trivy-bundle
on:
workflow_dispatch:
inputs:
trivyVersion:
description: "Tag of the Trivy image to use as a base"
type: string
required: true
jobs:
build-trivy-bundle:
runs-on:
- self-hosted-nutanix-docker-large
outputs:
IMAGE_TIMESTAMP: ${{ steps.build-and-push-image.outputs.IMAGE_TIMESTAMP }}
steps:
- name: Clone trivy-bundles Repository
uses: actions/checkout@v3
with:
repository: mesosphere/trivy-bundles
#CRITICAL: Revert this back to main before merging
#ref: main
ref: ${{ github.ref_name }}
- name: Install NIX
uses: cachix/install-nix-action@V27
# - name: Install xz utils
# id: install-xz-utils
# run: |
# sudo apt-get install xz-utils
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: true
skip-nix-installation: "true"
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_READ_WRITE_USERNAME }}
password: ${{ secrets.DOCKER_READ_WRITE_PASSWORD }}
- name: Build and push a trivy-bundles image
id: build-and-push-image
run: |
IMAGE_TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ)
TRIVY_VERSION=${{ inputs.trivyVersion }}
TIMESTAMP=$IMAGE_TIMESTAMP
devbox run -- make --version
devbox run -- make publish-trivy-bundled-image
echo "IMAGE_TIMESTAMP=$IMAGE_TIMESTAMP" >> $GITHUB_OUTPUT