From 3e7ad214576a981c445c44008b82fffa22d1bd0e Mon Sep 17 00:00:00 2001 From: Marco Ceppi Date: Sun, 18 Jun 2023 21:43:56 -0400 Subject: [PATCH 1/5] feat: add a bluefin-framework image --- .github/workflows/build.yml | 11 +++++++++-- Containerfile | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ffbaafcf0b..4bbb9842e16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,12 +23,18 @@ jobs: fail-fast: false matrix: image_flavor: [main, nvidia] - base_name: [bluefin, bluefin-dx, bluefin-dx-framework] + base_name: [bluefin, bluefin-dx, bluefin-framework, bluefin-dx-framework] + major_version: [37, 38] exclude: - base_name: bluefin-dx-framework image_flavor: nvidia - major_version: [37, 38] + - base_name: bluefin-framework + image_flavor: nvidia include: + - base_name: bluefin-framework + target_name: bluefin + - base_name: bluefin-dx-framework + target_name: bluefin-dx - major_version: 37 is_latest_version: false is_stable_version: false @@ -123,6 +129,7 @@ jobs: IMAGE_NAME=${{ env.IMAGE_NAME }} IMAGE_FLAVOR=${{ matrix.image_flavor }} FEDORA_MAJOR_VERSION=${{ matrix.major_version }} + TARGET_NAME=${{ matrix.target_name }} labels: ${{ steps.meta.outputs.labels }} oci: false extra-args: | diff --git a/Containerfile b/Containerfile index 9c0e5033917..685b9db1d48 100644 --- a/Containerfile +++ b/Containerfile @@ -3,6 +3,7 @@ ARG IMAGE_FLAVOR="${IMAGE_FLAVOR:-main}" ARG SOURCE_IMAGE="${SOURCE_IMAGE:-$BASE_IMAGE_NAME-$IMAGE_FLAVOR}" ARG BASE_IMAGE="ghcr.io/ublue-os/${SOURCE_IMAGE}" ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-37}" +ARG TARGET_NAME="${TARGET_NAME:-bluefin}" FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS bluefin @@ -88,7 +89,7 @@ RUN rm -rf /tmp/* /var/* RUN ostree container commit # Image for Framework laptops -FROM bluefin-dx as bluefin-dx-framework +FROM ${TARGET_NAME} as ${TARGET_NAME}-framework COPY framework/usr /usr From ef0cdfc0b616778efd09e83155cfa3599fa45947 Mon Sep 17 00:00:00 2001 From: Marco Ceppi Date: Sun, 18 Jun 2023 21:50:48 -0400 Subject: [PATCH 2/5] fix: add IMAGE_NAME matrix variable and create permenant framework slug --- .github/workflows/build.yml | 12 +++++++----- Containerfile | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4bbb9842e16..42e7d87cb75 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: image_flavor: [main, nvidia] - base_name: [bluefin, bluefin-dx, bluefin-framework, bluefin-dx-framework] + base_name: [bluefin, bluefin-dx, framework] major_version: [37, 38] exclude: - base_name: bluefin-dx-framework @@ -31,10 +31,12 @@ jobs: - base_name: bluefin-framework image_flavor: nvidia include: - - base_name: bluefin-framework + - base_name: framework target_name: bluefin - - base_name: bluefin-dx-framework + image_name: bluefin-framework + - base_name: framework target_name: bluefin-dx + image_name: bluefin-dx-framework - major_version: 37 is_latest_version: false is_stable_version: false @@ -49,9 +51,9 @@ jobs: - name: Matrix Variables run: | if [[ "${{ matrix.image_flavor }}" == "main" ]]; then - echo "IMAGE_NAME=${{ matrix.base_name }}" >> $GITHUB_ENV + echo "IMAGE_NAME=${{ matrix.image_name || matrix.base_name }}" >> $GITHUB_ENV else - echo "IMAGE_NAME=${{ format('{0}-{1}', matrix.base_name, matrix.image_flavor) }}" >> $GITHUB_ENV + echo "IMAGE_NAME=${{ format('{0}-{1}', matrix.image_name || matrix.base_name, matrix.image_flavor) }}" >> $GITHUB_ENV fi - name: Generate tags diff --git a/Containerfile b/Containerfile index 685b9db1d48..5e9022614ac 100644 --- a/Containerfile +++ b/Containerfile @@ -89,7 +89,7 @@ RUN rm -rf /tmp/* /var/* RUN ostree container commit # Image for Framework laptops -FROM ${TARGET_NAME} as ${TARGET_NAME}-framework +FROM ${TARGET_NAME} as framework COPY framework/usr /usr From 302e3567b65da84323f02a2a71850c0a936a14be Mon Sep 17 00:00:00 2001 From: Marco Ceppi Date: Sun, 18 Jun 2023 21:52:08 -0400 Subject: [PATCH 3/5] fix: update exclude for nvidia framework --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42e7d87cb75..d25db532284 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,9 +26,7 @@ jobs: base_name: [bluefin, bluefin-dx, framework] major_version: [37, 38] exclude: - - base_name: bluefin-dx-framework - image_flavor: nvidia - - base_name: bluefin-framework + - base_name: framework image_flavor: nvidia include: - base_name: framework From 92b595fd1a0c13fe0fdbc212006353150b528f46 Mon Sep 17 00:00:00 2001 From: Marco Ceppi Date: Sun, 18 Jun 2023 21:55:58 -0400 Subject: [PATCH 4/5] fix: keep the base_names, add target_base / target_name --- .github/workflows/build.yml | 26 ++++++++++++++------------ Containerfile | 4 ++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d25db532284..391c05411ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,18 +23,20 @@ jobs: fail-fast: false matrix: image_flavor: [main, nvidia] - base_name: [bluefin, bluefin-dx, framework] + base_name: [bluefin, bluefin-dx, bluefin-framework, bluefin-dx-framework] major_version: [37, 38] exclude: - - base_name: framework + - base_name: bluefin-dx-framework + image_flavor: nvidia + - base_name: bluefin-framework image_flavor: nvidia include: - - base_name: framework - target_name: bluefin - image_name: bluefin-framework - - base_name: framework - target_name: bluefin-dx - image_name: bluefin-dx-framework + - base_name: bluefin-framework + target_base: bluefin + target_name: framework + - base_name: bluefin-dx-framework + target_base: bluefin-dx + target_name: framework - major_version: 37 is_latest_version: false is_stable_version: false @@ -49,9 +51,9 @@ jobs: - name: Matrix Variables run: | if [[ "${{ matrix.image_flavor }}" == "main" ]]; then - echo "IMAGE_NAME=${{ matrix.image_name || matrix.base_name }}" >> $GITHUB_ENV + echo "IMAGE_NAME=${{ matrix.base_name }}" >> $GITHUB_ENV else - echo "IMAGE_NAME=${{ format('{0}-{1}', matrix.image_name || matrix.base_name, matrix.image_flavor) }}" >> $GITHUB_ENV + echo "IMAGE_NAME=${{ format('{0}-{1}', matrix.base_name, matrix.image_flavor) }}" >> $GITHUB_ENV fi - name: Generate tags @@ -129,11 +131,11 @@ jobs: IMAGE_NAME=${{ env.IMAGE_NAME }} IMAGE_FLAVOR=${{ matrix.image_flavor }} FEDORA_MAJOR_VERSION=${{ matrix.major_version }} - TARGET_NAME=${{ matrix.target_name }} + TARGET_BASE=${{ matrix.target_base }} labels: ${{ steps.meta.outputs.labels }} oci: false extra-args: | - --target=${{ matrix.base_name }} + --target=${{ matrix.target_name || matrix.base_name }} # Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR. # https://github.com/macbre/push-to-ghcr/issues/12 diff --git a/Containerfile b/Containerfile index 5e9022614ac..8dd0d6c36ce 100644 --- a/Containerfile +++ b/Containerfile @@ -3,7 +3,7 @@ ARG IMAGE_FLAVOR="${IMAGE_FLAVOR:-main}" ARG SOURCE_IMAGE="${SOURCE_IMAGE:-$BASE_IMAGE_NAME-$IMAGE_FLAVOR}" ARG BASE_IMAGE="ghcr.io/ublue-os/${SOURCE_IMAGE}" ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-37}" -ARG TARGET_NAME="${TARGET_NAME:-bluefin}" +ARG TARGET_BASE="${TARGET_BASE:-bluefin}" FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS bluefin @@ -89,7 +89,7 @@ RUN rm -rf /tmp/* /var/* RUN ostree container commit # Image for Framework laptops -FROM ${TARGET_NAME} as framework +FROM ${TARGET_BASE} as framework COPY framework/usr /usr From 0193311f0f37d3f1dccba74d4a66ea9a40fbcd00 Mon Sep 17 00:00:00 2001 From: Marco Ceppi Date: Sun, 18 Jun 2023 22:24:14 -0400 Subject: [PATCH 5/5] fix: use sed for framework --- .github/workflows/build.yml | 19 ++++++++++++++++++- Containerfile | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 391c05411ab..47f6808c732 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,6 +117,20 @@ jobs: io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/bluefin/bluefin/README.md io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4 + # Update FROM lines for variants that have their own matrix via SED + # This is due to limitations in buildah using interpreted values as registry + # images and not image targets in file: + # `FROM ${TARGET_BASE} as framework` + # evalutates to `FROM bluefin as framework` but buildah then looks for quay.io/bluefin + # vs the existing containerfile target. + # TODO(GH-280): Find an alternative for this rather than using sed. + - name: Build Image + id: sed_workaround + if: matrix.target_base + shell: bash + run: | + sed -i 's/FROM bluefin AS bluefin-framework/FROM ${{ matrix.target_base }} AS ${{ matrix.base_name }}/' Containerfile + # Build image using Buildah action - name: Build Image id: build_image @@ -134,8 +148,11 @@ jobs: TARGET_BASE=${{ matrix.target_base }} labels: ${{ steps.meta.outputs.labels }} oci: false + # TODO(GH-280) + # extra-args: | + # --target=${{ matrix.target_name || matrix.base_name }} extra-args: | - --target=${{ matrix.target_name || matrix.base_name }} + --target=${{ matrix.base_name }} # Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR. # https://github.com/macbre/push-to-ghcr/issues/12 diff --git a/Containerfile b/Containerfile index 8dd0d6c36ce..df4a51b55e7 100644 --- a/Containerfile +++ b/Containerfile @@ -89,7 +89,7 @@ RUN rm -rf /tmp/* /var/* RUN ostree container commit # Image for Framework laptops -FROM ${TARGET_BASE} as framework +FROM bluefin AS bluefin-framework COPY framework/usr /usr