Skip to content

Commit

Permalink
feat: Exclude kmods from Fedora 39 and future images
Browse files Browse the repository at this point in the history
  • Loading branch information
EyeCantCU authored and bsherman committed Oct 12, 2023
1 parent 4ccbe12 commit 8796295
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 44 deletions.
55 changes: 13 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
workflow_dispatch:
env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
BASE_FLAVOR: nokmods
MAIN_FLAVOR: main

jobs:
push-ghcr:
Expand All @@ -30,6 +28,7 @@ jobs:
- lxqt
- mate
- vauxite
image_flavor: [main, nokmods]
major_version: [37, 38, 39]
include:
- major_version: 37
Expand All @@ -45,6 +44,9 @@ jobs:
is_stable_version: false
is_gts_version: false
exclude:
# Fedora 39 images do not include kmods
- image_flavor: nokmods
major_version: 39
# There is no Fedora 37 version of sericea
- image_name: sericea
major_version: 37
Expand All @@ -65,13 +67,12 @@ jobs:

- name: Matrix Variables
run: |
echo "IMAGE_NAME=${{ matrix.image_name }}-${{ matrix.image_flavor }}" >> $GITHUB_ENV
if [[ "${{ matrix.image_name }}" == "lxqt" || "${{ matrix.image_name }}" == "mate" ]]; then
echo "SOURCE_IMAGE=base" >> $GITHUB_ENV
else
echo "SOURCE_IMAGE=${{ matrix.image_name }}" >> $GITHUB_ENV
fi
echo "BASE_IMAGE=${{ matrix.image_name }}-${{ env.BASE_FLAVOR }}" >> $GITHUB_ENV
echo "MAIN_IMAGE=${{ matrix.image_name }}-${{ env.MAIN_FLAVOR }}" >> $GITHUB_ENV
- name: Generate tags
id: generate-tags
Expand Down Expand Up @@ -134,69 +135,39 @@ jobs:
ver=$(skopeo inspect docker://quay.io/fedora-ostree-desktops/${{ env.SOURCE_IMAGE }}:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]')
echo "VERSION=$ver" >> $GITHUB_OUTPUT
# Build metadata
- name: Base Image Metadata
uses: docker/metadata-action@v5
id: meta-base
with:
images: |
${{ env.BASE_IMAGE }}
labels: |
org.opencontainers.image.title=${{ env.BASE_IMAGE }}
org.opencontainers.image.version=${{ steps.labels.outputs.VERSION }}
org.opencontainers.image.description=A base Universal Blue ${{ matrix.image_name }} image with no extra kmod or kernel packages
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md
io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4
- name: Main Image Metadata
# Generate image metadata
- name: Image Metadata
uses: docker/metadata-action@v5
id: meta-main
with:
images: |
${{ env.MAIN_IMAGE }}
${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.title=${{ env.MAIN_IMAGE }}
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
org.opencontainers.image.version=${{ steps.labels.outputs.VERSION }}
org.opencontainers.image.description=A base Universal Blue ${{ matrix.image_name }} image with batteries included
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md
io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4
# Build image using Buildah action
- name: Build Base Image
id: build_image-base
uses: redhat-actions/buildah-build@v2
with:
containerfiles: |
./Containerfile
image: ${{ env.BASE_IMAGE }}
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
IMAGE_NAME=${{ matrix.image_name }}
SOURCE_IMAGE=${{ env.SOURCE_IMAGE }}
FEDORA_MAJOR_VERSION=${{ matrix.major_version }}
labels: ${{ steps.meta-base.outputs.labels }}
oci: false
extra-args: |
--target=${{ env.BASE_FLAVOR }}
- name: Build Main Image
- name: Build Image
id: build_image-main
uses: redhat-actions/buildah-build@v2
with:
containerfiles: |
./Containerfile
image: ${{ env.MAIN_IMAGE }}
image: ${{ env.IMAGE_NAME }}
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
IMAGE_NAME=${{ matrix.image_name }}
IMAGE_FLAVOR=${{ matrix.image_flavor }}
SOURCE_IMAGE=${{ env.SOURCE_IMAGE }}
FEDORA_MAJOR_VERSION=${{ matrix.major_version }}
labels: ${{ steps.meta-main.outputs.labels }}
oci: false
extra-args: |
--target=${{ env.MAIN_FLAVOR }}
--target=${{ matrix.image_flavor }}
# 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
Expand Down
8 changes: 6 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-38}"

COPY main-install.sh /tmp/main-install.sh
COPY main-sys_files /
COPY main-sys_files /tmp/modprobe

COPY --from=ghcr.io/ublue-os/akmods:main-${FEDORA_MAJOR_VERSION} /rpms /tmp/akmods-rpms

RUN /tmp/main-install.sh && \
# Exclude kmods from Fedora 39 and future main images
RUN if [[ ${FEDORA_MAJOR_VERSION} -le 38 ]]; then \
cp -rf /tmp/modprobe/* / && \
/tmp/main-install.sh \
; fi && \
rm -rf /tmp/* /var/*

RUN ostree container commit && \
Expand Down

0 comments on commit 8796295

Please sign in to comment.