Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove buildah #241

Merged
merged 1 commit into from
Mar 28, 2024
Merged
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
80 changes: 2 additions & 78 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,81 +6,7 @@ on:
types: [published] # build on release

jobs:
build-ubi:
runs-on: ubuntu-latest # use the GitHub hosted runners
permissions:
contents: write # for uploading the SBOM to the release
packages: write # for uploading the finished container
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
id-token: write # to complete the identity challenge with sigstore/fulcio when running outside of PRs
strategy:
matrix:
os: [ubi8, ubi9]
arch: [amd64, arm64]
continue-on-error: true

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set version
run: echo "VERSION=$(cat ${GITHUB_EVENT_PATH} | jq -r '.release.tag_name')" >> $GITHUB_ENV
if: github.event_name == 'release'

- name: Set short SHA
run: echo "SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV

- name: Build the image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ghcr.io/${{ github.repository }}/${{ matrix.os }}
archs: ${{ matrix.arch }}
tags: latest ${{ env.VERSION }} ${{ env.VERSION }}-${{ env.SHA_SHORT }}
containerfiles: images/ubi8.Dockerfile

- name: Push image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
digestfile: digest.txt

- name: Run Anchore scan
uses: anchore/scan-action@v3
id: scan
with:
image: "ghcr.io/${{ github.repository }}/${{ matrix.os }}:${{ env.VERSION }}"
fail-build: false

- name: Upload Anchore scan report
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.scan.outputs.sarif }}

- name: Generate SBOM for the UBI runners
uses: anchore/sbom-action@v0
with:
image: ghcr.io/${{ github.repository }}/${{ matrix.os }}:${{ env.VERSION }}-${{ env.SHA_SHORT }}

- name: Get image digest
run: echo "IMAGE_DIGEST=$(cat digest.txt)" >> $GITHUB_ENV

- name: Install cosign
uses: sigstore/cosign-installer@main

- name: Log in to GHCR
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Sign the published Docker image
env:
COSIGN_EXPERIMENTAL: "true"
run: cosign sign -y ghcr.io/${{ github.repository }}/${{ matrix.os }}@${{ env.IMAGE_DIGEST }}

build-ubuntu:
build-all:
runs-on: ubuntu-latest # use the GitHub-hosted runner to build the image
permissions:
contents: write # for uploading the SBOM to the release
Expand All @@ -89,7 +15,7 @@ jobs:
id-token: write # to complete the identity challenge with sigstore/fulcio when running outside of PRs
strategy:
matrix:
os: [rootless-ubuntu-jammy]
os: [rootless-ubuntu-jammy, ubi8, ubi9]
arch: [amd64, arm64]
continue-on-error: true

Expand Down Expand Up @@ -126,7 +52,6 @@ jobs:
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.os }}:latest
ghcr.io/${{ github.repository }}/${{ matrix.os }}:${{ env.SHA_SHORT }}
ghcr.io/${{ github.repository }}/${{ matrix.os }}:${{ env.VERSION }}-${{ env.SHA_SHORT }}

- name: Scan it
uses: anchore/scan-action@v3
Expand Down Expand Up @@ -165,5 +90,4 @@ jobs:
- name: Push the signed image, other tags
run: |
docker push ghcr.io/${{ github.repository }}/${{ matrix.os }}:${{ env.SHA_SHORT }}
docker push ghcr.io/${{ github.repository }}/${{ matrix.os }}:${{ env.VERSION }}-${{ env.SHA_SHORT }}
docker push ghcr.io/${{ github.repository }}/${{ matrix.os }}:latest
Loading