mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 02:26:42 +01:00
* migrate to runs-on runners Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * keep validations on x64 Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * correct ubuntu arm refs Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * bust cache Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * use artifacts api between jobs Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * download individual artifacts Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * troubleshoot artifact upload Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * disable magic cache Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * fix deps Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * attempt to replicate layout Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * change asset names and remove extras Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * better artifact filters Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * use action to get artifacts working Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add sboms Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * simpler artifacts Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add logging Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * remove logging Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * make artifacts executable Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * improve workflow dispatch calls Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * attempt to bring down ci times Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * update repo path Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * use local config instead of shared one Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * use runner labels instead of config Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * use valid alias Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * use compute instances for build Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * small comment on concurrency Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * fixes from review Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * remove parallelism Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
219 lines
9.7 KiB
YAML
219 lines
9.7 KiB
YAML
name: "Release"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: tag the latest commit on main with the given version (prefixed with v)
|
|
required: true
|
|
phase:
|
|
description: the specific workflow phase to run or all
|
|
required: true
|
|
default: "all"
|
|
type: choice
|
|
options:
|
|
- "all"
|
|
- "install-script-only"
|
|
|
|
jobs:
|
|
quality-gate:
|
|
environment: release
|
|
if: ${{ github.event.inputs.phase == 'all' }}
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Bootstrap environment
|
|
uses: ./.github/actions/bootstrap
|
|
|
|
- name: Validate Apple notarization credentials
|
|
run: .tool/quill submission list
|
|
env:
|
|
QUILL_NOTARY_ISSUER: ${{ secrets.APPLE_NOTARY_ISSUER }}
|
|
QUILL_NOTARY_KEY_ID: ${{ secrets.APPLE_NOTARY_KEY_ID }}
|
|
QUILL_NOTARY_KEY: ${{ secrets.APPLE_NOTARY_KEY }}
|
|
|
|
- name: Check if running on main
|
|
if: github.ref != 'refs/heads/main'
|
|
# we are using the following flag when running `cosign blob-verify` for checksum signature verification:
|
|
# --certificate-identity-regexp "https://github.com/anchore/.github/workflows/release.yaml@refs/heads/main"
|
|
# if we are not on the main branch, the signature will not be verifiable since the suffix requires the main branch
|
|
# at the time of when the OIDC token was issued on the Github Actions runner.
|
|
run: echo "This can only be run on the main branch otherwise releases produced will not be verifiable with cosign" && exit 1
|
|
|
|
- name: Check if tag already exists
|
|
# note: this will fail if the tag already exists
|
|
run: |
|
|
[[ "$VERSION" == v* ]] || (echo "version '$VERSION' does not have a 'v' prefix" && exit 1)
|
|
git tag "$VERSION"
|
|
env:
|
|
VERSION: ${{ github.event.inputs.version }}
|
|
|
|
- name: Check static analysis results
|
|
uses: fountainhead/action-wait-for-check@5a908a24814494009c4bb27c242ea38c93c593be # v1.2.0
|
|
id: static-analysis
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
# This check name is defined as the github action job name (in .github/workflows/testing.yaml)
|
|
checkName: "Static analysis"
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Check unit test results
|
|
uses: fountainhead/action-wait-for-check@5a908a24814494009c4bb27c242ea38c93c593be # v1.2.0
|
|
id: unit
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
# This check name is defined as the github action job name (in .github/workflows/testing.yaml)
|
|
checkName: "Unit tests"
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Check integration test results
|
|
uses: fountainhead/action-wait-for-check@5a908a24814494009c4bb27c242ea38c93c593be # v1.2.0
|
|
id: integration
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
# This check name is defined as the github action job name (in .github/workflows/testing.yaml)
|
|
checkName: "Integration tests"
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Check acceptance test results (linux)
|
|
uses: fountainhead/action-wait-for-check@5a908a24814494009c4bb27c242ea38c93c593be # v1.2.0
|
|
id: acceptance-linux
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
# This check name is defined as the github action job name (in .github/workflows/testing.yaml)
|
|
checkName: "Acceptance tests (Linux)"
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Check acceptance test results (mac)
|
|
uses: fountainhead/action-wait-for-check@5a908a24814494009c4bb27c242ea38c93c593be # v1.2.0
|
|
id: acceptance-mac
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
# This check name is defined as the github action job name (in .github/workflows/testing.yaml)
|
|
checkName: "Acceptance tests (Mac)"
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Check cli test results (linux)
|
|
uses: fountainhead/action-wait-for-check@5a908a24814494009c4bb27c242ea38c93c593be # v1.2.0
|
|
id: cli-linux
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
# This check name is defined as the github action job name (in .github/workflows/testing.yaml)
|
|
checkName: "CLI tests (Linux)"
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
- name: Quality gate
|
|
if: steps.static-analysis.outputs.conclusion != 'success' || steps.unit.outputs.conclusion != 'success' || steps.integration.outputs.conclusion != 'success' || steps.cli-linux.outputs.conclusion != 'success' || steps.acceptance-linux.outputs.conclusion != 'success' || steps.acceptance-mac.outputs.conclusion != 'success'
|
|
env:
|
|
STATIC_ANALYSIS_STATUS: ${{ steps.static-analysis.conclusion }}
|
|
UNIT_TEST_STATUS: ${{ steps.unit.outputs.conclusion }}
|
|
INTEGRATION_TEST_STATUS: ${{ steps.integration.outputs.conclusion }}
|
|
ACCEPTANCE_LINUX_STATUS: ${{ steps.acceptance-linux.outputs.conclusion }}
|
|
ACCEPTANCE_MAC_STATUS: ${{ steps.acceptance-mac.outputs.conclusion }}
|
|
CLI_LINUX_STATUS: ${{ steps.cli-linux.outputs.conclusion }}
|
|
run: |
|
|
echo "Static Analysis Status: $STATIC_ANALYSIS_STATUS"
|
|
echo "Unit Test Status: $UNIT_TEST_STATUS"
|
|
echo "Integration Test Status: $INTEGRATION_TEST_STATUS"
|
|
echo "Acceptance Test (Linux) Status: $ACCEPTANCE_LINUX_STATUS"
|
|
echo "Acceptance Test (Mac) Status: $ACCEPTANCE_MAC_STATUS"
|
|
echo "CLI Test (Linux) Status: $CLI_LINUX_STATUS"
|
|
false
|
|
|
|
release:
|
|
needs: [ quality-gate ]
|
|
if: ${{ github.event.inputs.phase == 'all' }}
|
|
# runs-on.com: compute instances for parallel builds
|
|
# spot disabled: reliability for build workflows (used for releases too)
|
|
# goreleaser uses parallelism of 12, so we need more CPUs
|
|
# s3-cache: faster actions cache
|
|
# tmpfs: faster io-intensive workflows
|
|
runs-on: runs-on=${{ github.run_id }}/cpu=16+32/ram=32+128/family=c5+c6+c7+c8/spot=false/extras=s3-cache+tmpfs
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
# required for goreleaser signs section with cosign
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: true
|
|
|
|
- name: Bootstrap environment
|
|
uses: ./.github/actions/bootstrap
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 #v3.5.0
|
|
with:
|
|
username: ${{ secrets.ANCHOREOSSWRITE_DH_USERNAME }}
|
|
password: ${{ secrets.ANCHOREOSSWRITE_DH_PAT }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 #v3.5.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Tag release
|
|
run: |
|
|
git config --global user.name "anchoreci"
|
|
git config --global user.email "anchoreci@users.noreply.github.com"
|
|
git tag -a "$VERSION" -m "Release $VERSION"
|
|
git push origin --tags
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
VERSION: ${{ github.event.inputs.version }}
|
|
|
|
- name: Build & publish release artifacts
|
|
run: make ci-release
|
|
env:
|
|
# for mac signing and notarization...
|
|
QUILL_SIGN_P12: ${{ secrets.ANCHORE_APPLE_DEVELOPER_ID_CERT_CHAIN }}
|
|
QUILL_SIGN_PASSWORD: ${{ secrets.ANCHORE_APPLE_DEVELOPER_ID_CERT_PASS }}
|
|
QUILL_NOTARY_ISSUER: ${{ secrets.APPLE_NOTARY_ISSUER }}
|
|
QUILL_NOTARY_KEY_ID: ${{ secrets.APPLE_NOTARY_KEY_ID }}
|
|
QUILL_NOTARY_KEY: ${{ secrets.APPLE_NOTARY_KEY }}
|
|
# for creating the release (requires write access to packages and content)
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
# for updating brew formula in anchore/homebrew-syft
|
|
GITHUB_BREW_TOKEN: ${{ secrets.ANCHOREOPS_GITHUB_OSS_WRITE_TOKEN }}
|
|
|
|
- uses: anchore/sbom-action@a930d0ac434e3182448fe678398ba5713717112a #v0.21.0
|
|
continue-on-error: true
|
|
with:
|
|
file: go.mod
|
|
artifact-name: sbom.spdx.json
|
|
|
|
- uses: 8398a7/action-slack@77eaa4f1c608a7d68b38af4e3f739dcd8cba273e #v3.19.0
|
|
continue-on-error: true
|
|
with:
|
|
status: ${{ job.status }}
|
|
fields: repo,workflow,action,eventName
|
|
text: "A new Syft release has been published: https://github.com/anchore/syft/releases/tag/${{ github.event.inputs.version }}"
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TOOLBOX_WEBHOOK_URL }}
|
|
if: ${{ success() }}
|
|
|
|
release-install-script:
|
|
needs: [ release ]
|
|
if: ${{ always() && (needs.release.result == 'success' || github.event.inputs.phase == 'install-script-only') }}
|
|
uses: "anchore/workflows/.github/workflows/release-install-script.yaml@main"
|
|
with:
|
|
tag: ${{ github.event.inputs.version }}
|
|
secrets:
|
|
# needed for r2...
|
|
R2_INSTALL_ACCESS_KEY_ID: ${{ secrets.OSS_R2_INSTALL_ACCESS_KEY_ID }}
|
|
R2_INSTALL_SECRET_ACCESS_KEY: ${{ secrets.OSS_R2_INSTALL_SECRET_ACCESS_KEY }}
|
|
R2_ENDPOINT: ${{ secrets.TOOLBOX_CLOUDFLARE_R2_ENDPOINT }}
|
|
# needed for s3...
|
|
S3_INSTALL_AWS_ACCESS_KEY_ID: ${{ secrets.TOOLBOX_AWS_ACCESS_KEY_ID }}
|
|
S3_INSTALL_AWS_SECRET_ACCESS_KEY: ${{ secrets.TOOLBOX_AWS_SECRET_ACCESS_KEY }}
|