Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issues while pushing mapt image for PRs and releases #368

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 60 additions & 35 deletions .github/workflows/build-oci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,66 @@ on:
branches: [ main ]

jobs:
build-mapt:
name: build-mapt
build:
name: build
runs-on: ubuntu-24.04
steps:
- name: Prepare runner
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y qemu-user-static

- name: Checkout code
uses: actions/checkout@v4

- name: Build image for PR
if: ${{ github.event_name == 'pull_request' }}
env:
IMG: ghcr.io/redhat-developer/mapt:pr-${{ github.event.number }}
shell: bash
run: |
make oci-build
make oci-save
echo ${IMG} > mapt-image

- name: Build image for Release
if: ${{ github.event_name == 'push' }}
run: |
make oci-build
make oci-save

- name: Create image metadata
run: |
echo ${{ github.event_name }} > mapt-event

- name: Upload crc-builder
uses: actions/upload-artifact@v4
with:
name: mapt
path: mapt*
- name: Prepare runner for build multi arch
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y qemu-user-static

- name: Checkout code
uses: actions/checkout@v4

- name: Build image for PR
if: github.event_name == 'pull_request'
env:
IMG: ghcr.io/redhat-developer/mapt:pr-${{ github.event.number }}
shell: bash
run: |
make oci-build
make oci-save
echo ${IMG} > mapt-image

- name: Build and Push image for Release
if: github.event_name == 'push'
run: |
make oci-build
make oci-save

- name: Upload mapt artifacts for PR
uses: actions/upload-artifact@v4
with:
name: mapt
path: mapt*

push:
name: push
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download mapt oci flatten images
uses: actions/download-artifact@v4
with:
name: mapt

- name: Log in quay.io
uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_IO_USERNAME }}
password: ${{ secrets.QUAY_IO_PASSWORD }}

- name: Push image for Release
if: github.event_name == 'push'
run: |
make oci-load
make oci-push



52 changes: 52 additions & 0 deletions .github/workflows/push-oci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: oci-pr-push

on:
workflow_run:
workflows:
- oci-builds
types:
- completed

jobs:
push:
name: push
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Download mapt assets
uses: actions/download-artifact@v4
with:
name: mapt
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: Get mapt build informaiton
run: |
echo "image=$(cat mapt-image)" >> "$GITHUB_ENV"

- name: Log in to ghcr.io
uses: redhat-actions/podman-login@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Push mapt
run: |
# Load images from build
podman load -i mapt-arm64.tar
podman load -i mapt-amd64.tar

# Push
podman push ${{ env.image }}-arm64
podman push ${{ env.image }}-amd64
podman manifest create ${{ env.image }}
podman manifest add ${{ env.image }} docker://${{ env.image }}-arm64
podman manifest add ${{ env.image }} docker://${{ env.image }}-amd64
podman manifest push --all ${{ env.image }}
61 changes: 0 additions & 61 deletions .github/workflows/push-oci.yml

This file was deleted.

Loading