mirror of
https://github.com/hauler-dev/hauler.git
synced 2026-08-19 04:16:27 +00:00
add trivy to make and add new vuln GHA (#641)
Signed-off-by: Adam Martin <adam.martin@ranchergovernment.com>
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
# NOTE: The goreleaser job uses `environment: release` to require manual
|
||||
# approval before publishing. This only pauses the run if a maintainer has
|
||||
# configured an Environment named "release" with Required reviewers under
|
||||
# Settings > Environments. Until then, the approval gate is a no-op.
|
||||
name: Release Workflow
|
||||
|
||||
on:
|
||||
@@ -7,8 +11,14 @@ on:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
vulnerability-scan:
|
||||
name: Vulnerability Scan
|
||||
uses: ./.github/workflows/vulnerability-scan.yaml
|
||||
|
||||
goreleaser:
|
||||
name: GoReleaser Job
|
||||
needs: vulnerability-scan
|
||||
environment: release
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
name: Vulnerability Scan Workflow
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
|
||||
jobs:
|
||||
vulnerability-scan:
|
||||
name: Vulnerability Scan
|
||||
uses: ./.github/workflows/vulnerability-scan.yaml
|
||||
@@ -0,0 +1,92 @@
|
||||
name: Vulnerability Scan (Reusable)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
vulnerability-scan:
|
||||
name: Vulnerability Scan
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Clean Up Actions Tools Cache
|
||||
run: rm -rf /opt/hostedtoolcache
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Set Up Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
check-latest: true
|
||||
|
||||
- name: Install Go Releaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
install-only: true
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y make
|
||||
sudo apt-get install -y build-essential
|
||||
|
||||
- name: Install govulncheck
|
||||
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
|
||||
- name: Install Trivy
|
||||
uses: aquasecurity/setup-trivy@v0.3.1
|
||||
|
||||
- name: Run Vulnerability Scans
|
||||
run: make vulns
|
||||
|
||||
- name: Display Vulnerability Reports
|
||||
if: always()
|
||||
run: |
|
||||
echo "::group::govulncheck (vulncheck.out)"
|
||||
cat vulncheck.out || echo "vulncheck.out not found"
|
||||
echo "::endgroup::"
|
||||
echo "::group::trivy fs (trivy.out)"
|
||||
cat trivy.out || echo "trivy.out not found"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Write Vulnerability Reports to Job Summary
|
||||
if: always()
|
||||
run: |
|
||||
{
|
||||
echo "## Vulnerability Reports"
|
||||
echo ""
|
||||
echo "<details><summary>govulncheck (vulncheck.out)</summary>"
|
||||
echo ""
|
||||
echo '```'
|
||||
cat vulncheck.out 2>/dev/null || echo "vulncheck.out not found"
|
||||
echo '```'
|
||||
echo ""
|
||||
echo "</details>"
|
||||
echo ""
|
||||
echo "<details><summary>trivy fs (trivy.out)</summary>"
|
||||
echo ""
|
||||
echo '```'
|
||||
cat trivy.out 2>/dev/null || echo "trivy.out not found"
|
||||
echo '```'
|
||||
echo ""
|
||||
echo "</details>"
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Upload Vulnerability Reports
|
||||
uses: actions/upload-artifact@v6
|
||||
if: always()
|
||||
with:
|
||||
name: vulnerability-reports
|
||||
path: |
|
||||
vulncheck.out
|
||||
trivy.out
|
||||
Reference in New Issue
Block a user