From 38dda90a23ba183b6aaf34026d5f046cad5c5122 Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 13 Aug 2023 18:00:58 +0300 Subject: [PATCH] refactor: rename fedora version to os version this change makes sense for when in the future it's possible to build other OS's with this same system it was done now, because i'm bundling a bunch of breaking changes into a single update --- .github/workflows/build.yml | 8 ++++---- Containerfile | 4 ++-- build.sh | 6 +++--- config/common-packages.yml | 2 +- config/recipe.yml | 2 +- modules/rpm-ostree/rpm-ostree.sh | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3699ec2..82c729c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,8 +45,8 @@ jobs: id-token: write strategy: fail-fast: false - matrix: + matrix: # Add recipes for all the images you want to build here. # Don't add module configuration files, you will get errors. recipe: @@ -64,13 +64,13 @@ jobs: run: | echo "IMAGE_NAME=$(yq '.name' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV echo "IMAGE_DESCRIPTION=$(yq '.description' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV - echo "FEDORA_MAJOR_VERSION=$(yq '.fedora-version' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV + echo "IMAGE_MAJOR_VERSION=$(yq '.image-version' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV echo "BASE_IMAGE_URL=$(yq '.base-image' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV - name: Get current version id: labels run: | - ver=$(skopeo inspect docker://${{ env.BASE_IMAGE_URL }}:${{ env.FEDORA_MAJOR_VERSION }} | jq -r '.Labels["org.opencontainers.image.version"]') + ver=$(skopeo inspect docker://${{ env.BASE_IMAGE_URL }}:${{ env.IMAGE_MAJOR_VERSION }} | jq -r '.Labels["org.opencontainers.image.version"]') echo "VERSION=$ver" >> $GITHUB_OUTPUT - name: Generate tags @@ -146,7 +146,7 @@ jobs: tags: | ${{ steps.generate-tags.outputs.alias_tags }} build-args: | - FEDORA_MAJOR_VERSION=${{ env.FEDORA_MAJOR_VERSION }} + IMAGE_MAJOR_VERSION=${{ env.IMAGE_MAJOR_VERSION }} BASE_IMAGE_URL=${{ env.BASE_IMAGE_URL }} RECIPE=${{ matrix.recipe }} IMAGE_REGISTRY=${{ steps.registry_case.outputs.lowercase }} diff --git a/Containerfile b/Containerfile index e1387b7..2c0bdef 100644 --- a/Containerfile +++ b/Containerfile @@ -5,11 +5,11 @@ # in the cloud. The ARGs have default values, but changing those # does nothing if the image is built in the cloud. -ARG FEDORA_MAJOR_VERSION=38 +ARG IMAGE_MAJOR_VERSION=38 # Warning: changing this might not do anything for you. Read comment above. ARG BASE_IMAGE_URL=ghcr.io/ublue-os/silverblue-main -FROM ${BASE_IMAGE_URL}:${FEDORA_MAJOR_VERSION} +FROM ${BASE_IMAGE_URL}:${IMAGE_MAJOR_VERSION} # The default recipe set to the recipe's default filename # so that `podman build` should just work for many people. diff --git a/build.sh b/build.sh index 4c8339a..3750629 100644 --- a/build.sh +++ b/build.sh @@ -15,17 +15,17 @@ get_yaml_array() { export -f get_yaml_array # this makes the function available to all modules # Declare dynamically generated variables as read-only and exported -declare -rx IMAGE_NAME BASE_IMAGE FEDORA_VERSION +declare -rx IMAGE_NAME BASE_IMAGE OS_VERSION # Read configuration variables. BASE_IMAGE="$(yq '.base-image' "$RECIPE_FILE")" IMAGE_NAME="$(yq '.name' "$RECIPE_FILE")" # Automatically determine which Fedora version we're building. -FEDORA_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)" +OS_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)" # Welcome. -echo "Building $IMAGE_NAME from Fedora $FEDORA_VERSION ($BASE_IMAGE)." +echo "Building $IMAGE_NAME from $BASE_IMAGE:$OS_VERSION." # Run each module readarray MODULES < <(yq -o=j -I=0 '.modules[]' "$RECIPE_FILE" ) diff --git a/config/common-packages.yml b/config/common-packages.yml index 59f07c7..17ab30f 100644 --- a/config/common-packages.yml +++ b/config/common-packages.yml @@ -1,6 +1,6 @@ type: rpm-ostree repos: - # - https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-%FEDORA_VERSION%/atim-starship-fedora-%FEDORA_VERSION%.repo + # - https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-%OS_VERSION%/atim-starship-fedora-%OS_VERSION%.repo install: - python3-pip - libadwaita diff --git a/config/recipe.yml b/config/recipe.yml index 6183495..53684ae 100644 --- a/config/recipe.yml +++ b/config/recipe.yml @@ -1,7 +1,7 @@ name: startingpoint description: A starting point for further customization of uBlue images. Make your own! https://ublue.it/making-your-own/ base-image: ghcr.io/ublue-os/silverblue-main -fedora-version: 38 +image-version: 38 modules: - type: script diff --git a/modules/rpm-ostree/rpm-ostree.sh b/modules/rpm-ostree/rpm-ostree.sh index 0fcb78a..a55bfa0 100644 --- a/modules/rpm-ostree/rpm-ostree.sh +++ b/modules/rpm-ostree/rpm-ostree.sh @@ -7,7 +7,7 @@ get_yaml_array REPOS '.repos[]' "$1" if [[ ${#REPOS[@]} -gt 0 ]]; then echo "Adding repositories" for REPO in "${REPOS[@]}"; do - REPO="${REPO//%FEDORA_VERSION%/${FEDORA_VERSION}}" + REPO="${REPO//%OS_VERSION%/${OS_VERSION}}" wget "${REPO}" -P "/etc/yum.repos.d/" done fi