Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 20 additions & 145 deletions .github/workflows/app-dev-auth-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,155 +11,30 @@ on:
permissions:
contents: read

env:
REGISTRY: ghcr.io
IMAGE_NAME: newstack-cloud/celerity-dev-auth

jobs:
prepare:
name: Prepare Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Extract version from tag
id: version
run: |
TAG="${{ inputs.tag }}"
VERSION="${TAG##*/}"
VERSION="${VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION from tag: $TAG"

build:
name: Build & Push Production Image
runs-on: ubuntu-latest
release:
permissions:
contents: read
packages: write
needs: prepare
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
registry: dhi.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ needs.prepare.outputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare.outputs.version }}
type=raw,value=latest,enable=${{ !contains(needs.prepare.outputs.version, '-') }}
labels: |
org.opencontainers.image.title=Celerity Dev Auth
org.opencontainers.image.description=Lightweight OIDC provider for local development and testing of Celerity applications

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

- id: build
uses: docker/build-push-action@v6
with:
context: apps/dev-auth
target: production
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha,scope=dev-auth-prod
cache-to: type=gha,mode=max,scope=dev-auth-prod

scan-images:
name: Scan Container Images
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
needs: [build]
steps:
- uses: actions/checkout@v4

- name: Trivy scan production image (table)
uses: aquasecurity/trivy-action@0.35.0
with:
image-ref: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}"
format: "table"
severity: "CRITICAL,HIGH"
exit-code: "1"

- name: Trivy scan production image (SARIF)
if: always()
uses: aquasecurity/trivy-action@0.35.0
with:
image-ref: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}"
format: "sarif"
output: "trivy-dev-auth.sarif"
severity: "CRITICAL,HIGH"
exit-code: "0"

- name: Upload production scan results
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: "trivy-dev-auth.sarif"
category: "container-dev-auth"

sign-and-attest:
name: Sign & Attest Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
attestations: write
needs: [build, scan-images]
# A signature and a provenance attestation say this image is fit to
# pull, so a failed scan has to stop them being made.
if: needs.build.result == 'success' && needs.scan-images.result == 'success'
env:
COSIGN_REGISTRY_REFERRERS_MODE: oci-1-1
steps:
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: sigstore/cosign-installer@v3
- uses: anchore/sbom-action/download-syft@v0

- name: Sign production image (cosign keyless)
run: |
cosign sign --yes \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}

- name: Generate production SBOM
run: |
syft ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }} \
-o spdx-json=dev-auth-sbom.spdx.json

- name: Attest production SBOM
run: |
cosign attest --yes --predicate dev-auth-sbom.spdx.json --type spdxjson \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}

- name: GitHub attestation (production)
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ needs.build.outputs.digest }}
push-to-registry: true
uses: ./.github/workflows/container-release.yml
secrets: inherit
with:
tag: ${{ inputs.tag }}
tag-component: dev-auth
image-name: newstack-cloud/celerity-dev-auth
context: apps/dev-auth
cache-scope: dev-auth
sarif-category: container-dev-auth
targets: >-
[
{
"name": "production",
"tagPrefix": "",
"block": true,
"title": "Celerity Dev Auth",
"description": "Lightweight OIDC provider for local development and testing of Celerity applications"
}
]
170 changes: 21 additions & 149 deletions .github/workflows/app-local-events-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,165 +4,37 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g. apps/local-events/v0.3.0)'
description: 'Release tag (e.g. local-events/v0.3.0)'
required: true
type: string

permissions:
contents: read

env:
REGISTRY: ghcr.io
IMAGE_NAME: newstack-cloud/celerity-local-events

jobs:
prepare:
name: Prepare Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Extract version from tag
id: version
run: |
TAG="${{ inputs.tag }}"
VERSION="${TAG##*/}"
VERSION="${VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION from tag: $TAG"

build:
name: Build & Push Production Image
runs-on: ubuntu-latest
release:
permissions:
contents: read
packages: write
needs: prepare
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
registry: dhi.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ needs.prepare.outputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare.outputs.version }}
type=raw,value=latest,enable=${{ !contains(needs.prepare.outputs.version, '-') }}
labels: |
org.opencontainers.image.title=Celerity Local Events Sidecar
org.opencontainers.image.description=Celerity Local Events Sidecar for local development and testing of Celerity applications

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

- id: build
uses: docker/build-push-action@v6
with:
context: apps/local-events
target: production
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha,scope=runtime-prod
cache-to: type=gha,mode=max,scope=runtime-prod

scan-images:
name: Scan Container Images
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
needs: [build]
steps:
- uses: actions/checkout@v4

- name: Trivy scan production image (table)
uses: aquasecurity/trivy-action@0.35.0
with:
image-ref: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}"
format: "table"
severity: "CRITICAL,HIGH"
exit-code: "1"

- name: Trivy scan production image (SARIF)
if: always()
uses: aquasecurity/trivy-action@0.35.0
with:
image-ref: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}"
format: "sarif"
output: "trivy-runtime.sarif"
severity: "CRITICAL,HIGH"
exit-code: "0"

- name: Upload production scan results
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: "trivy-runtime.sarif"
category: "container-runtime"

sign-and-attest:
name: Sign & Attest Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
attestations: write
needs: [build, scan-images]
# A signature and a provenance attestation say this image is fit to
# pull, so a failed scan has to stop them being made.
if: needs.build.result == 'success' && needs.scan-images.result == 'success'
env:
# Store signatures and attestations as OCI 1.1 referrers instead of
# tag-based artifacts (.sig/.att/.sbom tags) that pollute the GHCR UI.
COSIGN_REGISTRY_REFERRERS_MODE: oci-1-1
steps:
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: sigstore/cosign-installer@v3
- uses: anchore/sbom-action/download-syft@v0

# --- Production image ---
- name: Sign production image (cosign keyless)
run: |
cosign sign --yes \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}

- name: Generate production SBOM
run: |
syft ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }} \
-o spdx-json=runtime-sbom.spdx.json

- name: Attest production SBOM
run: |
cosign attest --yes --predicate runtime-sbom.spdx.json --type spdxjson \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}

- name: GitHub attestation (production)
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ needs.build.outputs.digest }}
push-to-registry: true
uses: ./.github/workflows/container-release.yml
secrets: inherit
with:
tag: ${{ inputs.tag }}
tag-component: local-events
image-name: newstack-cloud/celerity-local-events
context: apps/local-events
cache-scope: local-events
sarif-category: container-local-events
targets: >-
[
{
"name": "production",
"tagPrefix": "",
"block": true,
"title": "Celerity Local Events Sidecar",
"description": "Celerity Local Events Sidecar for local development and testing of Celerity applications"
}
]
Loading
Loading