Skip to content

Move ppc64le/s390x builders from QEMU to a remote machine (#118) #582

Move ppc64le/s390x builders from QEMU to a remote machine (#118)

Move ppc64le/s390x builders from QEMU to a remote machine (#118) #582

---
name: Build and Publish
on:
push:
branches:
- redhat-** # IMPORTANT! this must match the jobs.build-and-publish.env.BRANCH_PREFIX (save the **).
workflow_dispatch:
# Allows you to run this workflow manually from the Actions tab
inputs:
tag:
description: 'Tag to attach to image'
required: true
jobs:
build-and-publish:
name: Publish container image
env:
BRANCH_PREFIX: redhat- # IMPORTANT! this must match the .on.push.branches prefix!
REGISTRY: quay.io/projectquay
REPO_NAME: ${{ github.event.repository.name }}
TAG_SUFFIX: -unstable
runs-on: 'ubuntu-latest'
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set version from branch name
id: version-from-branch
if: startsWith('env.BRANCH_PREFIX', env.GITHUB_REF)
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "::set-output name=version::${BRANCH_NAME/${{ env.BRANCH_PREFIX }}/}"
- name: Setup SSH config for builders
env:
BUILDER_PPC64LE_SSH_CONFIG: ${{ secrets.BUILDER_PPC64LE_SSH_CONFIG }}
BUILDER_PPC64LE_SSH_KEY: ${{ secrets.BUILDER_PPC64LE_SSH_KEY }}
BUILDER_PPC64LE_SSH_KNOWN_HOSTS: ${{ secrets.BUILDER_PPC64LE_SSH_KNOWN_HOSTS }}
BUILDER_S390X_SSH_CONFIG: ${{ secrets.BUILDER_S390X_SSH_CONFIG }}
BUILDER_S390X_SSH_KEY: ${{ secrets.BUILDER_S390X_SSH_KEY }}
run: |
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/id_builder_ppc64le
chmod 600 ~/.ssh/id_builder_ppc64le
echo "$BUILDER_PPC64LE_SSH_KEY" >~/.ssh/id_builder_ppc64le
touch ~/.ssh/id_builder_s390x
chmod 600 ~/.ssh/id_builder_s390x
echo "$BUILDER_S390X_SSH_KEY" > ~/.ssh/id_builder_s390x
touch ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
cat >~/.ssh/known_hosts <<END
$BUILDER_PPC64LE_SSH_KNOWN_HOSTS
END
touch ~/.ssh/config
chmod 600 ~/.ssh/config
cat >~/.ssh/config <<END
Host builder-ppc64le
IdentityFile "~/.ssh/id_builder_ppc64le"
$BUILDER_PPC64LE_SSH_CONFIG
Host builder-s390x
IdentityFile "~/.ssh/id_builder_s390x"
$BUILDER_S390X_SSH_CONFIG
END
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64
append: |
- endpoint: ssh://builder-ppc64le
platforms: linux/ppc64le
- endpoint: ssh://builder-s390x
platforms: linux/s390x
- name: Login to Quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
env:
TAG: ${{ steps.version-from-branch.outputs.version }}${{ env.TAG_SUFFIX }}
with:
platforms: linux/amd64,linux/s390x,linux/ppc64le
build-args: BUILDER_SRC=github.com/quay/quay-builder
push: true
file: Dockerfile
tags: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}:${{ github.event.inputs.tag || env.TAG }}