This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
π update use-cases #98
Workflow file for this run
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 container images | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: [main] | |
pull_request_target: | |
types: [opened, synchronize, reopened, ready_for_review] | |
env: | |
GO_VERSION: 1.22 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build-workspaces: | |
name: Build workspace images | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
include: | |
- directory: server | |
image_base: quay.io/konflux-workspaces/workspaces-server | |
- directory: operator | |
image_base: quay.io/konflux-workspaces/workspaces-operator | |
steps: | |
- name: Checkout Git Repository | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'pull_request_target' }} | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- name: Checkout Git Repository | |
uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'push' }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: Build image | |
id: tag | |
run: | | |
if [[ "${GITHUB_EVENT_NAME}" = "pull_request_target" ]]; then | |
export PR_SHA=${{ github.event.pull_request.head.sha }} | |
export IMG="${{ matrix.image_base }}:pr-${{ github.event.pull_request.number }}-${PR_SHA:0:8}" | |
else | |
export IMG="${{ matrix.image_base }}:${GITHUB_SHA:0:8}" | |
fi | |
echo "tag=${IMG}" >> ${GITHUB_OUTPUT} | |
make -C "${{ matrix.directory }}" docker-build | |
- name: Tag image with :latest | |
if: ${{ github.event_name == 'push' }} | |
env: | |
LATEST: ${{ matrix.image_base }}:latest | |
IMG: ${{ steps.tag.outputs.tag }} | |
run: docker tag "${IMG}" "${LATEST}" | |
- name: Login to Quay | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Push images | |
run: docker push -a ${{ matrix.image_base }} | |
build-kubesaw: | |
name: Build kubesaw components | |
runs-on: ubuntu-22.04 | |
if: ${{ github.event_name == 'pull_request_target' }} | |
strategy: | |
matrix: | |
include: | |
- scope: host | |
- scope: member | |
steps: | |
- name: Checkout Git Repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.20.8 | |
cache: false | |
- name: Prepare tools | |
uses: codeready-toolchain/toolchain-cicd/prepare-tools-action@master | |
- name: Login to Quay | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- name: Build and push images for ${{ matrix.scope }} | |
env: | |
PR_SHA: ${{ github.event.pull_request.head.sha }} | |
run: | | |
export TAG=pr-${{ github.event.pull_request.number }}-${PR_SHA:0:8} | |
IMAGE_BUILDER=docker hack/toolchain_build_push_${{ matrix.scope }}.sh "${TAG}" |