Build Images #4
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: Build Images | |
on: | |
workflow_call: | |
inputs: | |
operatorVersion: | |
description: Operator bundle version | |
default: 0.0.0 | |
type: string | |
operatorTag: | |
description: Operator tag | |
default: latest | |
type: string | |
limitadorVersion: | |
description: Limitador version | |
default: latest | |
type: string | |
replacesVersion: | |
description: Limitador Operator replaced version | |
default: 0.0.0-alpha | |
type: string | |
channels: | |
description: Bundle and catalog channels, comma separated | |
default: preview | |
type: string | |
workflow_dispatch: | |
inputs: | |
operatorVersion: | |
description: Operator bundle version | |
default: 0.0.0 | |
type: string | |
operatorTag: | |
description: Operator tag | |
default: latest | |
type: string | |
limitadorVersion: | |
description: Limitador version | |
default: latest | |
type: string | |
replacesVersion: | |
description: Limitador Operator replaced version | |
default: 0.0.0-alpha | |
type: string | |
channels: | |
description: Bundle and catalog channels, comma separated | |
default: preview | |
type: string | |
env: | |
IMG_TAGS: ${{ github.sha }} ${{ inputs.operatorTag }} | |
VERSION: ${{ inputs.operatorVersion }} | |
IMG_REGISTRY_HOST: quay.io | |
IMG_REGISTRY_ORG: kuadrant | |
MAIN_BRANCH_NAME: main | |
OPERATOR_NAME: limitador-operator | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Install qemu dependency | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static | |
- name: Build Image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.OPERATOR_NAME }} | |
tags: ${{ env.IMG_TAGS }} | |
platforms: linux/amd64,linux/arm64 | |
dockerfiles: | | |
./Dockerfile | |
- name: Push Image | |
if: ${{ !env.ACT }} | |
id: push-to-quay | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} | |
username: ${{ secrets.IMG_REGISTRY_USERNAME }} | |
password: ${{ secrets.IMG_REGISTRY_TOKEN }} | |
- name: Print Image URL | |
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" | |
build-bundle: | |
needs: build | |
name: Build Bundle | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.21.x | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
id: go | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Install qemu dependency | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static | |
- 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=${{ inputs.operatorTag }} \ | |
LIMITADOR_VERSION=${{ inputs.limitadorVersion }} \ | |
REPLACES_VERSION=${{ inputs.replacesVersion }} \ | |
CHANNELS=${{ inputs.channels }} | |
- name: Build Image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.OPERATOR_NAME }}-bundle | |
tags: ${{ env.IMG_TAGS }} | |
platforms: linux/amd64,linux/arm64 | |
dockerfiles: | | |
./bundle.Dockerfile | |
- name: Push Image | |
if: ${{ !env.ACT }} | |
id: push-to-quay | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} | |
username: ${{ secrets.IMG_REGISTRY_USERNAME }} | |
password: ${{ secrets.IMG_REGISTRY_TOKEN }} | |
- name: Print Image URL | |
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" | |
build-catalog: | |
name: Build Catalog | |
needs: [build, build-bundle] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.21.x | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
id: go | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Generate Catalog Content | |
run: | | |
make catalog \ | |
REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \ | |
VERSION=${{ env.VERSION }} IMAGE_TAG=${{ inputs.operatorTag }} \ | |
LIMITADOR_VERSION=${{ inputs.limitadorVersion }} \ | |
REPLACES_VERSION=${{ inputs.replacesVersion }} \ | |
CHANNELS=${{ inputs.channels }} | |
- name: Install qemu dependency | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static | |
- name: Build Image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.OPERATOR_NAME }}-catalog | |
tags: ${{ env.IMG_TAGS }} | |
platforms: linux/amd64,linux/arm64 | |
context: ./catalog | |
dockerfiles: | | |
./catalog/${{ env.OPERATOR_NAME }}-catalog.Dockerfile | |
- name: Push Image | |
if: ${{ !env.ACT }} | |
id: push-to-quay | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }} | |
username: ${{ secrets.IMG_REGISTRY_USERNAME }} | |
password: ${{ secrets.IMG_REGISTRY_TOKEN }} | |
- name: Print Image URL | |
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |