Do not include Config to MachineRegistration as pointer (#870) #44
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker build and push on tag | |
on: | |
push: | |
tags: | |
- 'v*' | |
env: | |
OPERATOR_REPO: quay.io/costoolkit/elemental-operator | |
REGISTER_REPO: quay.io/costoolkit/elemental-register | |
SEEDIMAGE_REPO: quay.io/costoolkit/elemental-seedimage | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # OIDC support. | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: cosign-installer | |
uses: sigstore/cosign-installer@v2.8.0 | |
- name: Install the bom command | |
shell: bash | |
run: | | |
curl -L https://github.com/kubernetes-sigs/bom/releases/download/v0.3.0/bom-linux-amd64.tar.gz | tar xvz | |
sudo mv ./bom /usr/bin/bom | |
- name: Export tag | |
id: export_tag | |
run: | | |
git describe --abbrev=0 --tags | |
TAG=`git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0"` | |
COMMITDATE=`date -d @$(git log -n1 --format="%at") "+%FT%TZ"` | |
echo "operator_tag=$TAG" >> $GITHUB_OUTPUT | |
echo "commit_date=$COMMITDATE" >> $GITHUB_OUTPUT | |
- name: Docker meta for operator tag | |
id: meta-operator | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: | | |
${{ env.OPERATOR_REPO }} | |
tags: | | |
type=semver,pattern={{raw}} | |
- name: Docker meta for register tag | |
id: meta-register | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: | | |
${{ env.REGISTER_REPO }} | |
tags: | | |
type=semver,pattern={{raw}} | |
- name: Docker meta for seedimage tag | |
id: meta-seedimage | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: | | |
${{ env.SEEDIMAGE_REPO }} | |
tags: | | |
type=semver,pattern={{raw}} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3.2.0 | |
- name: Login to Quay | |
uses: docker/login-action@v3.1.0 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Build operator image | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: . | |
tags: ${{ steps.meta-operator.outputs.tags }} | |
labels: ${{ steps.meta-operator.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: elemental-operator | |
push: true | |
build-args: | | |
TAG=${{ steps.export_tag.outputs.operator_tag }} | |
COMMITDATE=${{ steps.export_tag.outputs.commit_date }} | |
COMMIT=${{ github.sha }} | |
- name: Build register image | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: . | |
tags: ${{ steps.meta-register.outputs.tags }} | |
labels: ${{ steps.meta-register.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: elemental-register | |
push: true | |
build-args: | | |
TAG=${{ steps.export_tag.outputs.operator_tag }} | |
COMMITDATE=${{ steps.export_tag.outputs.commit_date }} | |
COMMIT=${{ github.sha }} | |
- name: Build seedimage image | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: . | |
tags: ${{ steps.meta-seedimage.outputs.tags }} | |
labels: ${{ steps.meta-seedimage.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
file: Dockerfile.seedimage | |
push: true | |
build-args: | | |
TAG=${{ steps.export_tag.outputs.operator_tag }} | |
COMMITDATE=${{ steps.export_tag.outputs.commit_date }} | |
COMMIT=${{ github.sha }} | |
- name: Create SBOM file | |
shell: bash | |
run: | | |
bom generate -o elemental-operator.spdx . | |
bom generate -o elemental-register.spdx . | |
bom generate -o elemental-seedimage.spdx . | |
- name: Attach SBOM file in the container image | |
shell: bash | |
run: | | |
set -e | |
cosign attach sbom --sbom elemental-operator.spdx "${{ env.OPERATOR_REPO }}:${{ steps.export_tag.outputs.operator_tag }}" | |
cosign attach sbom --sbom elemental-operator.spdx "${{ env.OPERATOR_REPO }}:latest" | |
cosign attach sbom --sbom elemental-register.spdx "${{ env.REGISTER_REPO }}:${{ steps.export_tag.outputs.operator_tag }}" | |
cosign attach sbom --sbom elemental-register.spdx "${{ env.REGISTER_REPO }}:latest" | |
cosign attach sbom --sbom elemental-seedimage.spdx "${{ env.SEEDIMAGE_REPO }}:${{ steps.export_tag.outputs.operator_tag }}" | |
cosign attach sbom --sbom elemental-seedimage.spdx "${{ env.SEEDIMAGE_REPO }}:latest" | |
- name: Sign image | |
env: | |
COSIGN_EXPERIMENTAL: 1 | |
run: | | |
cosign sign ${{ env.OPERATOR_REPO }}:${{ steps.export_tag.outputs.operator_tag }} | |
cosign sign ${{ env.OPERATOR_REPO }}:latest | |
cosign sign ${{ env.REGISTER_REPO }}:${{ steps.export_tag.outputs.operator_tag }} | |
cosign sign ${{ env.REGISTER_REPO }}:latest | |
cosign sign ${{ env.SEEDIMAGE_REPO }}:${{ steps.export_tag.outputs.operator_tag }} | |
cosign sign ${{ env.SEEDIMAGE_REPO }}:latest |