fix: Update gh cli to 2.67.0 (#219) #120
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 of UBI 9 based Developer Images | |
on: | |
push: | |
branches: [ main ] | |
workflow_call: | |
# Map the workflow outputs to job outputs | |
secrets: | |
QUAY_USERNAME: | |
required: true | |
QUAY_PASSWORD: | |
required: true | |
outputs: | |
uniq_tag: | |
description: "The first output string" | |
value: ${{ jobs.build_universal_ubi9_image.outputs.output1 }} | |
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: Set short_sha environment variable | |
run: echo short_sha="$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | |
- name: Free runner space | |
run: sudo rm -rf /usr/local/lib/android | |
- name: Cleanup docker images | |
run: docker system prune -af | |
- name: Login to Quay.io | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Build base image | |
run: | | |
cd base/ubi9 && docker buildx build \ | |
--platform linux/${{env.arch}} \ | |
--progress=plain \ | |
--push \ | |
-t quay.io/devfile/base-developer-image:${{env.arch}}-${{env.short_sha}} . | |
publish-base-image: | |
name: Publish base image | |
runs-on: ubuntu-22.04 | |
needs: build-base-image | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set short_sha environment variable | |
run: echo short_sha="$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | |
- 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: | | |
for tag in latest ubi9-latest ubi9-${{env.short_sha}}; | |
do | |
docker manifest create quay.io/devfile/base-developer-image:${tag} \ | |
--amend quay.io/devfile/base-developer-image:amd64-${{env.short_sha}} \ | |
--amend quay.io/devfile/base-developer-image:arm64-${{env.short_sha}} | |
docker manifest annotate quay.io/devfile/base-developer-image:${tag} \ | |
quay.io/devfile/base-developer-image:amd64-${{env.short_sha}} \ | |
--os linux --arch amd64 | |
docker manifest annotate quay.io/devfile/base-developer-image:${tag} \ | |
quay.io/devfile/base-developer-image:arm64-${{env.short_sha}} \ | |
--os linux --arch arm64 | |
docker manifest push quay.io/devfile/base-developer-image:${tag} | |
done | |
build-udi: | |
name: Build udi | |
strategy: | |
fail-fast: false | |
matrix: | |
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm'] | |
runs-on: ${{matrix.runners}} | |
needs: publish-base-image | |
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: Set short_sha environment variable | |
run: echo short_sha="$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | |
- name: Free runner space | |
run: sudo rm -rf /usr/local/lib/android | |
- name: Cleanup docker images | |
run: docker system prune -af | |
- 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}}-${{env.short_sha}} . | |
publish-udi: | |
name: Publish udi | |
runs-on: ubuntu-22.04 | |
needs: build-udi | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set short_sha environment variable | |
run: echo short_sha="$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | |
- 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: | | |
for tag in latest ubi9-latest ubi9-${{env.short_sha}}; | |
do | |
docker manifest create quay.io/devfile/universal-developer-image:${tag} \ | |
--amend quay.io/devfile/universal-developer-image:amd64-${{env.short_sha}} \ | |
--amend quay.io/devfile/universal-developer-image:arm64-${{env.short_sha}} | |
docker manifest annotate quay.io/devfile/universal-developer-image:${tag} \ | |
quay.io/devfile/universal-developer-image:amd64-${{env.short_sha}} \ | |
--os linux --arch amd64 | |
docker manifest annotate quay.io/devfile/universal-developer-image:${tag} \ | |
quay.io/devfile/universal-developer-image:arm64-${{env.short_sha}} \ | |
--os linux --arch arm64 | |
docker manifest push quay.io/devfile/universal-developer-image:${tag} | |
done | |
- name: Get tag with uniq prefix | |
id: setTagName | |
# set the image with uniq tag prefix (for example: quay.io/..../base-developer-image:ubi9-7ad6cab) to env. var | |
# and define it for output. This output with tag image will be used in caller job | |
run: | | |
echo "uniq_tag=quay.io/devfile/universal-developer-image:ubi9-${{env.short_sha}}" >> $GITHUB_OUTPUT |