Skip to content

Merge pull request #38 from RedHatInsights/push_images_to_public_quay #139

Merge pull request #38 from RedHatInsights/push_images_to_public_quay

Merge pull request #38 from RedHatInsights/push_images_to_public_quay #139

Workflow file for this run

name: Build Insights proxy (rhproxy-engine) Container Images
on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [main, 'release/*']
env:
STABLE_TAG: ${{ github.event_name == 'push' && github.ref_name || format('pr-{0}', github.event.pull_request.number) }}
EXPIRATION_LABEL: ${{ github.event_name == 'push' && 'rhproxy-engine.source=github' || 'quay.expires-after=5d' }}
IMAGE_NAME: ${{ vars.IMAGE_NAME || 'abellott/rhproxy-engine' }}
REGISTRY: ${{ vars.REGISTRY || 'quay.io' }}
jobs:
build-amd64:
runs-on: ubuntu-latest
steps:
- name: Clone repository
id: clone-repository-amd64
uses: actions/[email protected]
with:
fetch-depth: 0 # fetches all commits/tags
- name: Define Release Tag Amd64
id: define-release-tag-amd64
shell: bash
run: echo "RELEASE_TAG_AMD64=$([[ ${GITHUB_REF_NAME} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo ${GITHUB_REF_NAME%.[0-9]*}-amd64 || echo)" >> "$GITHUB_ENV"
- name: Build Amd64 rhproxy-engine image
id: build-image-amd64
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
archs: amd64
tags: ${{ env.STABLE_TAG }}-amd64 ${{ env.STABLE_TAG == 'main' && 'latest-amd64' || '' }} ${{ contains( env.RELEASE_TAG_AMD64 , '.' ) && env.RELEASE_TAG_AMD64 || '' }}
containerfiles: |
./Containerfile
labels: |
${{ env.EXPIRATION_LABEL }}
rhproxy-engine.backend.git_sha=${{ github.sha }}
- name: Push Amd64 To quay.io
id: push-image-amd64
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ steps.build-image-amd64.outputs.tags }}
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
continue-on-error: true
build-arm64:
runs-on: ubuntu-latest
steps:
- name: Clone repository
id: clone-repository-arm64
uses: actions/[email protected]
with:
fetch-depth: 0 # fetches all commits/tags
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Define Release Tag Arm64
id: define-release-tag-arm64
shell: bash
run: echo "RELEASE_TAG_ARM64=$([[ ${GITHUB_REF_NAME} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo ${GITHUB_REF_NAME%.[0-9]*}-arm64 || echo)" >> "$GITHUB_ENV"
- name: Build Arm64 rhproxy-engine image
id: build-image-arm64
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
archs: arm64
tags: ${{ env.STABLE_TAG }}-arm64 ${{ env.STABLE_TAG == 'main' && 'latest-arm64' || '' }} ${{ contains( env.RELEASE_TAG_ARM64 , '.' ) && env.RELEASE_TAG_ARM64 || '' }}
containerfiles: |
./Containerfile
labels: |
${{ env.EXPIRATION_LABEL }}
rhproxy-engine.backend.git_sha=${{ github.sha }}
- name: Push Arm64 To quay.io
id: push-image-arm64
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ steps.build-image-arm64.outputs.tags }}
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
continue-on-error: true
push-manifest:
runs-on: ubuntu-latest
needs: [build-amd64, build-arm64]
steps:
- name: Define Release Tag
id: define-release-tag
shell: bash
run: echo "RELEASE_TAG=$([[ ${GITHUB_REF_NAME} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo ${GITHUB_REF_NAME%.[0-9]*} || echo)" >> "$GITHUB_ENV"
- name: Define Image Tag
id: define-image-tag
shell: bash
run: echo "IMAGE_TAG=${{ env.STABLE_TAG == 'main' && 'latest' || contains( env.RELEASE_TAG , '.' ) && env.RELEASE_TAG || env.STABLE_TAG }}" >> "${GITHUB_ENV}"
- name: Push Manifest
id: push-manifest
uses: pixelfederation/[email protected]
with:
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
platforms: linux/amd64,linux/arm64
template: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}-ARCH
target: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: Push Versioned Manifest
id: push-versioned-manifest
if: contains( env.RELEASE_TAG, '.' )
uses: pixelfederation/[email protected]
with:
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_PASSWORD }}
platforms: linux/amd64,linux/arm64
template: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.STABLE_TAG }}-ARCH
target: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.STABLE_TAG }}