Skip to content

chore(deps): Bump the bundler group with 2 updates (#255) #255

chore(deps): Bump the bundler group with 2 updates (#255)

chore(deps): Bump the bundler group with 2 updates (#255) #255

Workflow file for this run

name: Commit
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- .github/dependabot.yaml
- .github/workflows/pull-request.yaml
- .github/workflows/release.yaml
jobs:
build:
name: Build OCI Image
permissions: write-all
strategy:
fail-fast: false
matrix:
variant: [musl, glibc]
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
PLATFORMS: "linux/amd64,linux/arm64"
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup
id: setup
run: |
set -euo pipefail
source_date_epoch="$(git log -1 --pretty=%ct)"
echo "source_date_epoch=${source_date_epoch}" >> "${GITHUB_OUTPUT}"
echo "SOURCE_DATE_EPOCH=${source_date_epoch}" >> "${GITHUB_ENV}"
- name: Install Crane
uses: imjasonh/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # v0.3
- name: Install Syft
uses: anchore/sbom-action/download-syft@fd74a6fb98a204a1ad35bbfae0122c1a302ff88b # v0.15.0
with:
syft-version: latest
- name: Install Grype
uses: anchore/scan-action/download-grype@896d5f410043987c8fe18f60d91bf199e436840c # v3.3.8
with:
grype-version: v0.67.0
- name: Install Cosign
uses: sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8 # v3.2.0
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Install Hadolint
uses: action-stars/install-tool-from-github-release@58e2dd20166c0eb19ab9ac4d0966c930a647ee69 # v0.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
owner: hadolint
repository: hadolint
arch_amd64: x86_64
os_linux: Linux
extract: false
filename_format: "{name}-{os}-{arch}"
check_command: hadolint --version
version: latest
- name: Run Hadolint
run: |
set -euo pipefail
hadolint --no-fail --format sarif ./${{ matrix.variant }}.dockerfile > ./hadolint-${{ matrix.variant }}.sarif
- name: Upload Hadolint SARIF report
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
with:
category: hadolint-${{ matrix.variant }}
sarif_file: hadolint-${{ matrix.variant }}.sarif
- name: Generate OCI image metadata
id: metadata
uses: docker/metadata-action@e6428a5c4e294a61438ed7f43155db912025b6b3 # v5.2.0
with:
flavor: |
latest=false
images: |
ghcr.io/${{ github.repository }}
tags: |
type=sha
labels: |
org.opencontainers.image.description=Fluentd aggregator OCI image based on the default Fluentd OCI image.
org.opencontainers.image.authors=Steve Hipwell <steve.hipwell@gmail.com>
- name: Login to GitHub Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build OCI image
id: build
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
file: ./${{ matrix.variant }}.dockerfile
context: .
provenance: false
sbom: false
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha,scope=buildkit-${{ matrix.variant }}
cache-to: type=gha,scope=buildkit-${{ matrix.variant }},mode=max
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
push: true
build-args: |
SOURCE_DATE_EPOCH=${{ steps.setup.outputs.source_date_epoch }}
- name: Generate SBOMs
id: sboms
run: |
set -euo pipefail
default_image="ghcr.io/${{ github.repository }}"
sha_tag="${{ steps.metadata.outputs.version }}"
sbom_paths=""
for platform in ${PLATFORMS//,/ }
do
digest="$(crane digest "${default_image}:${sha_tag}" --platform="${platform}")"
sbom_path="syft-sbom-${{ matrix.variant }}-${platform#*/}.spdx.json"
syft --source-name "${{ github.repository }}" --source-version "${digest}" --platform "${platform}" -o "spdx-json=${sbom_path}" "${default_image}@${digest}"
sbom_paths="${sbom_paths}${sbom_path},"
done
echo "paths=${sbom_paths%,}" >> $GITHUB_OUTPUT
- name: Upload SBOM artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: sboms
retention-days: 28
if-no-files-found: error
path: "*.spdx.json"
- name: Upload SBOMs to Dependency Graph
uses: jhutchings1/spdx-to-dependency-graph-action@18b183bb96461852e90574736c3c65812b0f3cd8 # v0.0.2
with:
filePath: "."
filePattern: "*.spdx.json"
- name: Scan SBOMs with Grype
id: grype
run: |
set -euo pipefail
directory_path="grype-results"
mkdir -p "${directory_path}"
for platform in ${PLATFORMS//,/ }
do
sarif_path="${directory_path}/grype-scan-${{ matrix.variant }}-${platform#*/}.sarif"
grype --platform "${platform}" -o "sarif=${sarif_path}" "sbom:syft-sbom-${{ matrix.variant }}-${platform#*/}.spdx.json"
done
echo "path=${directory_path}" >> $GITHUB_OUTPUT
- name: Upload Grype SARIF report
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
with:
category: grype-${{ matrix.variant }}
sarif_file: ${{ steps.grype.outputs.path }}
- name: Login to DockerHub
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push OCI image tags
id: push
run: |
set -euo pipefail
default_image="ghcr.io/${{ github.repository }}"
sha_tag="${{ steps.metadata.outputs.version }}"
digest="${{ steps.build.outputs.digest }}"
images="docker.io/${{ github.repository }}"
tags="${{ matrix.variant }}-main"
if [[ "${{ matrix.variant }}" == "musl" ]]
then
tags="${tags},main"
fi
references="${default_image}:${sha_tag}"
for image in ${images//,/ }
do
crane copy --platform all "${default_image}:${sha_tag}@${digest}" "${image}:${sha_tag}"
references="${references},${image}:${sha_tag}"
done
images="${images},${default_image}"
for image in ${images//,/ }
do
for tag in ${tags//,/ }
do
crane tag --platform all "${image}:${sha_tag}@${digest}" "${tag}"
references="${references},${image}:${tag}"
done
done
echo "references=${references}" >> $GITHUB_OUTPUT
- name: Sign OCI image
run: |
set -euo pipefail
default_image="ghcr.io/${{ github.repository }}"
sha_tag="${{ steps.metadata.outputs.version }}"
references="${{ steps.push.outputs.references }}"
for reference in ${references//,/ }
do
cosign sign --yes --recursive "${reference}@${{ steps.build.outputs.digest }}"
done
for platform in ${PLATFORMS//,/ }
do
digest="$(crane digest "${default_image}:${sha_tag}@${{ steps.build.outputs.digest }}" --platform="${platform}")"
for reference in ${references//,/ }
do
cosign attest --yes --type spdxjson --predicate syft-sbom-${{ matrix.variant }}-${platform#*/}.spdx.json "${reference}@${digest}"
cosign attach sbom --type spdx --input-format json --sbom syft-sbom-${{ matrix.variant }}-${platform#*/}.spdx.json "${reference}@${digest}"
cosign sign --yes "${reference%:*}:${digest/:/-}.sbom"
done
done