-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support build on arm64 platform (#216)
* Build linux/arm64 ubi9 universal image in GH action Signed-off-by: dkwon17 <dakwon@redhat.com> Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Update dockerfile Signed-off-by: David Kwon <dakwon@redhat.com> Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Update CONTRIBUTING.md Signed-off-by: David Kwon <dakwon@redhat.com> Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Add newline Signed-off-by: David Kwon <dakwon@redhat.com> Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Add PR check (#1) Signed-off-by: Anatolii Bazko <abazko@redhat.com> * chore: Rework GitHub action to build UDI on arm64 (#2) Signed-off-by: Anatolii Bazko <abazko@redhat.com Signed-off-by: Anatolii Bazko <abazko@redhat.com> * Resolve conflicts Signed-off-by: Anatolii Bazko <abazko@redhat.com> --------- Signed-off-by: dkwon17 <dakwon@redhat.com> Signed-off-by: Anatolii Bazko <abazko@redhat.com> Signed-off-by: David Kwon <dakwon@redhat.com> Signed-off-by: Anatolii Bazko <abazko@redhat.com Co-authored-by: dkwon17 <dakwon@redhat.com>
- Loading branch information
Showing
6 changed files
with
474 additions
and
96 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# | ||
# Copyright (c) 2021-2025 Red Hat, Inc. | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
|
||
name: Pull Request Check | ||
|
||
# Trigger the workflow on pull request | ||
on: [pull_request] | ||
|
||
jobs: | ||
build-base-image: | ||
name: Build base image | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm'] | ||
runs-on: ${{matrix.runners}} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set arch environment variable | ||
run: | | ||
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then | ||
echo arch="amd64" >> $GITHUB_ENV | ||
else | ||
echo arch="arm64" >> $GITHUB_ENV | ||
fi | ||
- name: Free runner space | ||
run: sudo rm -rf /usr/local/lib/android | ||
- name: Cleanup docker images | ||
run: docker system prune -af | ||
- name: Build base image | ||
run: | | ||
cd base/ubi9 && docker buildx build \ | ||
--platform linux/${{env.arch}} \ | ||
--progress=plain \ | ||
-t base-developer-image-${{env.arch}} . | ||
- name: Display docker images | ||
run: docker images | ||
- name: Compress image to a file | ||
run: docker save base-developer-image-${{env.arch}} | gzip > base-developer-image-${{env.arch}}.tgz | ||
- name: Upload image artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: base-developer-image-${{env.arch}} | ||
path: base-developer-image-${{env.arch}}.tgz | ||
|
||
build-udi: | ||
name: Build udi | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm'] | ||
runs-on: ${{matrix.runners}} | ||
needs: build-base-image | ||
steps: | ||
- name: Set arch environment variable | ||
run: | | ||
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then | ||
echo arch="amd64" >> $GITHUB_ENV | ||
else | ||
echo arch="arm64" >> $GITHUB_ENV | ||
fi | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Free runner space | ||
run: sudo rm -rf /usr/local/lib/android | ||
- name: Cleanup docker images | ||
run: docker system prune -af | ||
- name: Download BDI artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: base-developer-image-* | ||
merge-multiple: true | ||
path: . | ||
- name: List downloaded files | ||
run: ls -lah | ||
- name: Load docker images | ||
run: docker load -i base-developer-image-${{env.arch}}.tgz | ||
- name: Display docker images | ||
run: docker images | ||
- name: Update UDI Dockerfile | ||
run: sed "s|quay.io/devfile/base-developer-image:ubi9-latest|base-developer-image-${{env.arch}}|" -i "universal/ubi9/Dockerfile" | ||
- name: Login to Quay.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
- name: Build udi | ||
run: | | ||
cd universal/ubi9 && docker buildx build \ | ||
--platform linux/${{env.arch}} \ | ||
--progress=plain \ | ||
--push \ | ||
-t quay.io/devfile/universal-developer-image:${{env.arch}}-pr-${{github.event.number}} . | ||
publish-udi: | ||
name: Publish udi | ||
runs-on: ubuntu-22.04 | ||
needs: build-udi | ||
steps: | ||
- name: Login to Quay.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
- name: publish | ||
run: | | ||
docker manifest create quay.io/devfile/universal-developer-image:pr-${{github.event.number}} \ | ||
--amend quay.io/devfile/universal-developer-image:amd64-pr-${{github.event.number}} \ | ||
--amend quay.io/devfile/universal-developer-image:arm64-pr-${{github.event.number}} | ||
docker manifest annotate quay.io/devfile/universal-developer-image:pr-${{github.event.number}} \ | ||
quay.io/devfile/universal-developer-image:amd64-pr-${{github.event.number}} \ | ||
--os linux --arch amd64 | ||
docker manifest annotate quay.io/devfile/universal-developer-image:pr-${{github.event.number}} \ | ||
quay.io/devfile/universal-developer-image:arm64-pr-${{github.event.number}} \ | ||
--os linux --arch arm64 | ||
docker manifest push quay.io/devfile/universal-developer-image:pr-${{github.event.number}} | ||
- name: 'Comment PR' | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const { repo: { owner, repo } } = context; | ||
await github.rest.issues.createComment({ | ||
issue_number: ${{github.event.number}}, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `Pull Request images published ✨\n\nUDI: [quay.io/devfile/universal-developer-image:pr-${{github.event.number}}](https://quay.io/devfile/universal-developer-image:pr-${{github.event.number}})` | ||
}) |
Oops, something went wrong.