Skip to content

Build Images

Build Images #86

name: Build Images
on:
workflow_call:
inputs:
kuadrantOperatorTag:
description: Kuadrant Operator tag
default: latest
type: string
kuadrantOperatorVersion:
description: Kuadrant Operator version
default: 0.0.0
type: string
authorinoOperatorVersion:
description: Authorino Operator bundle version
default: latest
type: string
limitadorOperatorVersion:
description: Limitador Operator bundle version
default: latest
type: string
dnsOperatorVersion:
description: DNS Operator bundle version
default: latest
type: string
wasmShimVersion:
description: WASM Shim version
default: latest
type: string
consolePluginImageURL:
description: ConsolePlugin image URL
default: "quay.io/kuadrant/console-plugin:latest"
type: string
channels:
description: Bundle and catalog channels, comma separated
default: preview
type: string
defaultChannel:
description: Bundle default channel
default: preview
type: string
quayImageExpiry:
description: When to expire the built quay images. The time values could be something like 1h, 2d, 3w for hours, days, and weeks, respectively, from the time the image is built.
default: never
type: string
workflow_dispatch:
inputs:
kuadrantOperatorTag:
description: Kuadrant Operator tag
default: latest
type: string
kuadrantOperatorVersion:
description: Kuadrant Operator version
default: 0.0.0
type: string
authorinoOperatorVersion:
description: Authorino Operator bundle version
default: latest
type: string
limitadorOperatorVersion:
description: Limitador Operator bundle version
default: latest
type: string
dnsOperatorVersion:
description: DNS Operator bundle version
default: latest
type: string
wasmShimVersion:
description: WASM Shim version
default: latest
type: string
consolePluginImageURL:
description: ConsolePlugin image URL
default: "quay.io/kuadrant/console-plugin:latest"
type: string
channels:
description: Bundle and catalog channels, comma separated
default: preview
type: string
defaultChannel:
description: Bundle default channel
default: preview
type: string
quayImageExpiry:
description: When to expire the built quay images. The time values could be something like 1h, 2d, 3w for hours, days, and weeks, respectively, from the time the image is built.
default: never
type: string
env:
IMG_TAGS: ${{ inputs.kuadrantOperatorTag }}
VERSION: ${{ inputs.kuadrantOperatorVersion }}
IMG_REGISTRY_HOST: quay.io
IMG_REGISTRY_ORG: kuadrant
MAIN_BRANCH_NAME: main
OPERATOR_NAME: kuadrant-operator
QUAY_IMAGE_EXPIRY: ${{ inputs.quayImageExpiry }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set IMG_TAG to lower case
id: lower-img-tag
run: echo "IMG_TAGS=${IMG_TAGS@L}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.IMG_REGISTRY_USERNAME }}
password: ${{ secrets.IMG_REGISTRY_TOKEN }}
registry: ${{ env.IMG_REGISTRY_HOST }}
- name: Build and Push Image
id: build-image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
provenance: false
tags: |
${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}:${{ env.IMG_TAGS }}
build-args: |
QUAY_IMAGE_EXPIRY=${{ inputs.quayImageExpiry }}
GIT_SHA=${{ github.sha }}
DIRTY=false
VERSION=${{ inputs.operatorVersion }}
- name: Print Image URL
run: echo "Image pushed to ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}:${{ env.IMG_TAGS }}"
build-bundle:
needs: build
name: Build Bundle
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22.x
uses: actions/setup-go@v4
with:
go-version: 1.22.x
id: go
- name: Check out code
uses: actions/checkout@v3
- name: Set IMG_TAG to lower case
id: lower-img-tag
run: echo "IMG_TAGS=${IMG_TAGS@L}" >> $GITHUB_ENV
- name: Run make bundle
id: make-bundle
run: |
make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \
VERSION=${{ env.VERSION }} IMAGE_TAG=${{ env.IMG_TAGS }} \
AUTHORINO_OPERATOR_VERSION=${{ inputs.authorinoOperatorVersion }} \
LIMITADOR_OPERATOR_VERSION=${{ inputs.limitadorOperatorVersion }} \
DNS_OPERATOR_VERSION=${{ inputs.dnsOperatorVersion }} \
WASM_SHIM_VERSION=${{ inputs.wasmShimVersion }} \
RELATED_IMAGE_CONSOLEPLUGIN=${{ inputs.consolePluginImageURL }} \
DEFAULT_CHANNEL=${{ inputs.defaultChannel }} \
CHANNELS=${{ inputs.channels }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.IMG_REGISTRY_USERNAME }}
password: ${{ secrets.IMG_REGISTRY_TOKEN }}
registry: ${{ env.IMG_REGISTRY_HOST }}
- name: Build and Push Bundle Image
id: build-bundle-image
uses: docker/build-push-action@v5
with:
context: .
file: ./bundle.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
provenance: false
tags: |
${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-bundle:${{ env.IMG_TAGS }}
build-args: QUAY_IMAGE_EXPIRY=${{ inputs.quayImageExpiry }}
- name: Print Bundle Image URL
run: echo "Bundle image pushed to ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-bundle:${{ env.IMG_TAGS }}"
build-catalog:
name: Build Catalog
needs: [build, build-bundle]
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22.x
uses: actions/setup-go@v4
with:
go-version: 1.22.x
id: go
- name: Check out code
uses: actions/checkout@v3
- name: Set IMG_TAG to lower case
id: lower-img-tag
run: echo "IMG_TAGS=${IMG_TAGS@L}" >> $GITHUB_ENV
- name: Generate Catalog Content
run: |
make catalog REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \
VERSION=${{ env.VERSION }} IMAGE_TAG=${{ env.IMG_TAGS }} \
AUTHORINO_OPERATOR_VERSION=${{ inputs.authorinoOperatorVersion }} \
LIMITADOR_OPERATOR_VERSION=${{ inputs.limitadorOperatorVersion }} \
DNS_OPERATOR_VERSION=${{ inputs.dnsOperatorVersion }} \
WASM_SHIM_VERSION=${{ inputs.wasmShimVersion }} \
RELATED_IMAGE_CONSOLEPLUGIN=${{ inputs.consolePluginImageURL }} \
DEFAULT_CHANNEL=${{ inputs.defaultChannel }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.IMG_REGISTRY_USERNAME }}
password: ${{ secrets.IMG_REGISTRY_TOKEN }}
registry: ${{ env.IMG_REGISTRY_HOST }}
- name: Build and Push Catalog Image
id: build-catalog-image
uses: docker/build-push-action@v5
with:
context: ./catalog
file: ./catalog/kuadrant-operator-catalog.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
provenance: false
tags: |
${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-catalog:${{ env.IMG_TAGS }}
# The Quay image expiry label for the generated catalog Dockerfile is set via opm, using the value set in the QUAY_IMAGE_EXPIRY environment variable
- name: Print Catalog Image URL
run: echo "Catalog image pushed to ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/${{ env.OPERATOR_NAME }}-catalog:${{ env.IMG_TAGS }}"