Skip to content

Merge pull request #171 from openstack-k8s-operators/renovate/opensta… #147

Merge pull request #171 from openstack-k8s-operators/renovate/opensta…

Merge pull request #171 from openstack-k8s-operators/renovate/opensta… #147

name: openstack-baremetal operator image builder
on:
push:
branches:
- '*'
env:
imageregistry: 'quay.io'
imagenamespace: ${{ secrets.IMAGENAMESPACE || secrets.QUAY_USERNAME }}
latesttag: latest
jobs:
check-secrets:
runs-on: ubuntu-latest
steps:
- name: Check secrets are set
id: have-secrets
if: "${{ env.imagenamespace != '' }}"
run: echo "ok=true" >>$GITHUB_OUTPUT
outputs:
have-secrets: ${{ steps.have-secrets.outputs.ok }}
call-build-workflow:
uses: openstack-k8s-operators/openstack-k8s-operators-ci/.github/workflows/reusable-build-operator.yaml@main
needs: [build-openstack-baremetal-operator-agent]
with:
operator_name: openstack-baremetal
go_version: 1.20.x
operator_sdk_version: 1.31.0
secrets:
IMAGENAMESPACE: ${{ secrets.IMAGENAMESPACE }}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
REDHATIO_USERNAME: ${{ secrets.REDHATIO_USERNAME }}
REDHATIO_PASSWORD: ${{ secrets.REDHATIO_PASSWORD }}
build-openstack-baremetal-operator-agent:
name: Build agent image using buildah
runs-on: ubuntu-latest
needs: [check-secrets]
if: needs.check-secrets.outputs.have-secrets == 'true'
steps:
- uses: actions/checkout@v3
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]
- name: Set latest tag for non main branch
if: "${{ steps.branch-name.outputs.current_branch != 'main' }}"
run: |
echo "latesttag=${{ steps.branch-name.outputs.current_branch }}-latest" >> $GITHUB_ENV
- name: Buildah Action
id: build-openstack-baremetal-operator-agent
uses: redhat-actions/buildah-build@v2
with:
image: openstack-baremetal-operator-agent
tags: ${{ env.latesttag }} ${{ github.sha }}
containerfiles: |
./Dockerfile.agent
- name: Push agent To ${{ env.imageregistry }}
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-openstack-baremetal-operator-agent.outputs.image }}
tags: ${{ steps.build-openstack-baremetal-operator-agent.outputs.tags }}
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}