chore(ci): clean changelog/Workflow (#1920)

This commit is contained in:
m2 2024-11-11 11:01:52 -05:00 committed by GitHub
parent e1d7cf1e23
commit 43a120b1c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 145 additions and 98 deletions

36
.github/changelogs.py vendored
View file

@ -73,23 +73,15 @@ From previous `{target}` version `{prev}` there have been the following changes.
### How to rebase
For current users, type the following to rebase to this version:
#### For this branch (if latest):
##### Bluefin
```bash
sudo bootc switch ghcr.io/ublue-os/bluefin:{target} --enforce-container-sigpolicy
```
##### Aurora
```bash
sudo bootc switch ghcr.io/ublue-os/aurora:{target} --enforce-container-sigpolicy
```
#### For this specific image:
##### Bluefin
```bash
sudo bootc switch ghcr.io/ublue-os/bluefin:{curr} --enforce-container-sigpolicy
```
##### Aurora
```bash
sudo bootc switch ghcr.io/ublue-os/aurora:{curr} --enforce-container-sigpolicy
# Get Image Name
IMAGE_NAME=$(jq -r '.["image-name"]' < /usr/share/ublue-os/image-info.json)
# For this Stream
sudo bootc switch --enforce-container-sigpolicy ghcr.io/ublue-os/$IMAGE_NAME:{target}
# For this Specific Image:
sudo bootc switch --enforce-container-sigpolicy ghcr.io/ublue-os/$IMAGE_NAME:{curr}
```
### Documentation
@ -222,7 +214,6 @@ def get_package_groups(target: str, prev: dict[str, Any], manifests: dict[str, A
# Find other packages
for t, other in others.items():
print(t)
first = True
for img, experience, de, image_flavor in get_images(target):
if img not in pkg:
@ -330,6 +321,8 @@ def get_commits(prev_manifests, manifests, workdir: str):
if subject.lower().startswith("merge"):
continue
if subject.lower().startswith("chore"):
continue
out += (
COMMIT_FORMAT.replace("{short}", short)
@ -382,10 +375,13 @@ def generate_changelog(
curr_pretty = re.sub(r"\.\d{1,2}$", "", curr)
# Remove target- from curr
curr_pretty = re.sub(rf"^[a-z]+-|^[0-9]+-", "", curr_pretty)
if not fedora_version + "." in curr_pretty:
curr_pretty=fedora_version + "." + curr_pretty
pretty = target.capitalize()
pretty += " (F" + fedora_version
pretty += "." + curr_pretty
pretty += ", #" + finish[:7] + ")"
pretty += " (F" + curr_pretty
if finish:
pretty += ", #" + finish[:7]
pretty += ")"
title = CHANGELOG_TITLE.format_map(defaultdict(str, tag=curr, pretty=pretty))

View file

@ -41,7 +41,7 @@ jobs:
secrets: inherit
uses: ./.github/workflows/generate-release.yml
with:
stream_name: '["stable"]'
stream_name: '["stable", "stable-daily"]'
build-iso-stable:
name: Build Stable ISOs

View file

@ -3,8 +3,8 @@ on:
inputs:
make_latest:
description: "Make latest for Release"
type: boolean
default: false
type: string
default: 'False'
stream_name:
description: "Release Tag (e.g. gts, stable)"
type: string
@ -16,21 +16,23 @@ on:
make_latest:
description: "Make latest for Release"
type: choice
default: "false"
default: 'False'
options:
- "false"
- "true"
- 'False'
- 'True'
stream_name:
description: "Release Tag (e.g. gts, stable)"
required: true
type: choice
options:
- '["gts", "stable"]'
- '["gts"]'
- '["stable"]'
- '["stable-daily"]'
- '["latest"]'
- '["beta"]'
- '["gts", "stable"]'
- '["gts", "stable", "latest", "beta"]'
- '["stable-daily", "latest", "beta"]'
- '["gts", "stable", "stable-daily", "latest", "beta"]'
permissions:
contents: write
@ -76,10 +78,10 @@ jobs:
- name: Create Release
uses: softprops/action-gh-release@v2
if: contains(fromJson('["workflow_dispatch", "workflow_call"]'), github.event_name) || contains(fromJson('["45 5 * * 0", "40 4 * * 0"]'), github.event_name.schedule)
if: contains(fromJson('["gts", "stable"]'), matrix.version) && github.event_name.schedule == '45 5 * * 0' || contains(fromJson('["workflow_dispatch", "workflow_call"]'), github.event_name)
with:
name: ${{ steps.generate-release-text.outputs.title }}
tag_name: ${{ steps.generate-release-text.outputs.tag }}
body_path: ./changelog.md
make_latest: ${{ inputs.make_latest == true && matrix.version == 'stable' || false }}
prerelease: ${{ inputs.make_latest != false }}
make_latest: ${{ inputs.make_latest == 'True' && matrix.version == 'stable' || false }}
prerelease: ${{ inputs.make_latest != 'True' }}

View file

@ -67,28 +67,14 @@ jobs:
IMAGE_NAME="$(just image_name ${{ matrix.base_name }} ${{ matrix.stream_name }} ${{ matrix.image_flavor }})"
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
- name: Generate tags
id: generate-tags
- name: Default Tag
shell: bash
run: |
DEFAULT_TAG="$(just generate-default-tag \
${{ matrix.stream_name }} \
"1")"
alias_tags="$(just generate-build-tags \
${{ matrix.base_name }} \
${{ matrix.stream_name }} \
${{ matrix.image_flavor }} \
"1" \
${{ github.event.number }} \
${{ github.event_name }})"
${{ matrix.stream_name }} \
"1")"
echo "Default Tag: ${DEFAULT_TAG}"
echo "Tags for this Action..."
echo "$alias_tags"
echo "DEFAULT_TAG=${DEFAULT_TAG}" >> $GITHUB_ENV
echo "alias_tags=${alias_tags}" >> $GITHUB_OUTPUT
- name: Maximize build space
uses: ublue-os/remove-unwanted-software@517622d6452028f266b7ba4cc9a123b5f58a6b53 # v7
@ -113,22 +99,47 @@ jobs:
"${{ matrix.image_flavor }}" \
"1"
- name: Load Image into Podman
id: load-rechunk
shell: bash
run: |
just load-rechunk "${{ matrix.base_name }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ matrix.image_flavor }}"
- name: Secureboot Check
id: secureboot
shell: bash
run: |
sudo just secureboot "${{ matrix.base_name }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ matrix.image_flavor }}"
just secureboot "${{ matrix.base_name }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ matrix.image_flavor }}"
- name: Generate tags
id: generate-tags
shell: bash
run: |
alias_tags="$(just generate-build-tags \
"${{ matrix.base_name }}" \
"${{ matrix.stream_name }}" \
"${{ matrix.image_flavor }}" \
"1" \
"$(podman inspect ${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} | jq -r '.[].Config.Labels["org.opencontainers.image.version"]')" \
"${{ github.event_name }}" \
"${{ github.event.number }}")"
echo "Tags for this Action..."
echo "$alias_tags"
echo "alias_tags=${alias_tags}" >> $GITHUB_OUTPUT
# Tag Images
- name: Tag Images
shell: bash
run: |
set -eoux pipefail
sudo just tag-images "${{ env.IMAGE_NAME }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ steps.generate-tags.outputs.alias_tags }}"
just tag-images "${{ env.IMAGE_NAME }}" \
"${{ env.DEFAULT_TAG }}" \
"${{ steps.generate-tags.outputs.alias_tags }}"
# 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
@ -141,7 +152,7 @@ jobs:
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
run: |
echo ${{ secrets.GITHUB_TOKEN }} | sudo podman login ghcr.io -u ${{ github.actor }} --password-stdin
echo ${{ secrets.GITHUB_TOKEN }} | podman login ghcr.io -u ${{ github.actor }} --password-stdin
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push to GHCR
@ -155,7 +166,7 @@ jobs:
set -euox pipefail
for tag in ${{ steps.generate-tags.outputs.alias_tags }}; do
sudo podman push ${{ env.IMAGE_NAME }}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${tag}
podman push ${{ env.IMAGE_NAME }}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${tag}
done
if [[ "${{ matrix.image_flavor }}" =~ hwe ]]; then
@ -165,12 +176,12 @@ jobs:
surface_name="${image_name/hwe/surface}"
for tag in ${{ steps.generate-tags.outputs.alias_tags }}; do
sudo podman push ${asus_name}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${asus_name}:${tag}
sudo podman push ${surface_name}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${surface_name}:${tag}
podman push ${asus_name}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${asus_name}:${tag}
podman push ${surface_name}:${tag} ${{ steps.registry_case.outputs.lowercase }}/${surface_name}:${tag}
done
fi
digest=$(sudo skopeo inspect docker://${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} --format '{{.Digest}}')
digest=$(skopeo inspect docker://${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} --format '{{.Digest}}')
echo "digest=${digest}" >> $GITHUB_OUTPUT
@ -184,7 +195,7 @@ jobs:
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}
- name: Sign container image
if: github.event_name != 'pull_request' && contains(inputs.image_flavors, 'hwe')
if: github.event_name != 'pull_request' && contains(matrix.image_flavor, 'hwe')
shell: bash
run: |
image_name="${{ env.IMAGE_NAME }}"

1
.gitignore vendored
View file

@ -8,3 +8,4 @@ flatpak.*
previous.manifest.json
changelog.md
output.env
version.txt

110
Justfile
View file

@ -59,6 +59,7 @@ clean:
# Sudo Clean Repo
[group('Utility')]
[private]
sudo-clean:
just sudoif just clean
@ -71,9 +72,16 @@ validate image="" tag="" flavor="":
declare -A images={{ images }}
declare -A tags={{ tags }}
declare -A flavors={{ flavors }}
image={{ image }}
tag={{ tag }}
flavor={{ flavor }}
# Handle Stable Daily
if [[ "${tag}" == "stable-daily" ]]; then
tag="stable"
fi
checkimage="${images[${image}]-}"
checktag="${tags[${tag}]-}"
checkflavor="${flavors[${flavor}]-}"
@ -87,6 +95,10 @@ validate image="" tag="" flavor="":
echo "Invalid tag..."
exit 1
fi
if [[ -z "$checkflavor" ]]; then
echo "Invalid flavor..."
exit 1
fi
if [[ "$checktag" =~ gts && "$checkimage" =~ aurora ]]; then
echo "Aurora Does not build GTS..."
exit 1
@ -183,11 +195,7 @@ build image="bluefin" tag="latest" flavor="main" rechunk="0" ghcr="0" pipeline="
# Get Version
ver=$(skopeo inspect --retry-times 3 docker://ghcr.io/ublue-os/"${base_image_name}-main":"${fedora_version}" | jq -r '.Labels["org.opencontainers.image.version"]')
if [ -z "$ver" ] || [ "null" = "$ver" ]; then
echo "inspected image version must not be empty or null"
exit 1
fi
ver="${fedora_version}.$(date +%Y%m%d)"
# Build Arguments
BUILD_ARGS=()
@ -234,7 +242,7 @@ build-rechunk image="bluefin" tag="latest" flavor="main" kernel_pin="":
@just build {{ image }} {{ tag }} {{ flavor }} 1 0 0 {{ kernel_pin }}
# Build Image with GHCR Flag
[group('Production')]
[group('Image')]
build-ghcr image="bluefin" tag="latest" flavor="main" kernel_pin="":
#!/usr/bin/bash
if [[ "${UID}" -gt "0" ]]; then
@ -244,7 +252,7 @@ build-ghcr image="bluefin" tag="latest" flavor="main" kernel_pin="":
just build {{ image }} {{ tag }} {{ flavor }} 0 1 0 {{ kernel_pin }}
# Build Image for Pipeline:
[group('Production')]
[group('Image')]
build-pipeline image="bluefin" tag="latest" flavor="main" kernel_pin="":
#!/usr/bin/bash
if [[ "${UID}" -gt "0" ]]; then
@ -337,6 +345,10 @@ rechunk image="bluefin" tag="latest" flavor="main" ghcr="0" pipeline="0":
just sudoif podman rm "$CREF"
just sudoif podman rmi "$OLD_IMAGE"
SHA="dedbeef"
if [[ -z "$(git status -s)" ]]; then
SHA=$(git rev-parse HEAD)
fi
# Run Rechunker
just sudoif podman run --rm \
--pull=newer \
@ -347,32 +359,57 @@ rechunk image="bluefin" tag="latest" flavor="main" ghcr="0" pipeline="0":
--env REPO=/var/ostree/repo \
--env PREV_REF=ghcr.io/ublue-os/"${image_name}":"${tag}" \
--env OUT_NAME="$OUT_NAME" \
--env LABELS="org.opencontainers.image.title=${image_name}$'\n'org.opencontainers.image.version=${fedora_version}.$(date +%Y%m%d)$'\n''io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/bluefin/refs/heads/main/README.md'$'\n''io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4'$'\n'" \
--env LABELS="org.opencontainers.image.title=${image_name}$'\n''io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/bluefin/refs/heads/main/README.md'$'\n''io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4'$'\n'" \
--env "DESCRIPTION='An interpretation of the Ubuntu spirit built on Fedora technology'" \
--env "VERSION=${fedora_version}.$(date +%Y%m%d)" \
--env VERSION_FN=/workspace/version.txt \
--env OUT_REF="oci:$OUT_NAME" \
--env GIT_DIR="/var/git" \
--env REVISION="$SHA" \
--user 0:0 \
"${rechunker}" \
/sources/rechunk/3_chunk.sh
# Load Image into Podman Store
# Fix Permissions of OCI
if [[ "${UID}" -gt "0" ]]; then
just sudoif chown "${UID}:${GROUPS}" -R "${PWD}"
elif [[ -n "${SUDO_UID:-}" ]]; then
chown "${SUDO_UID}":"${SUDO_GID}" -R "${PWD}"
fi
IMAGE=$(podman pull oci:"${PWD}"/"${OUT_NAME}")
podman tag ${IMAGE} localhost/"${image_name}":"${tag}"
# Cleanup
# Remove cache_ostree
just sudoif podman volume rm cache_ostree
just sudoif "rm -rf ${OUT_NAME}*"
just sudoif "rm -f previous.manifest.json"
# Show OCI Labels
just sudoif skopeo inspect oci:"${PWD}"/"${OUT_NAME}" | jq -r '.Labels'
# Pipeline Checks
if [[ {{ pipeline }} == "1" ]]; then
just secureboot "${image}" "${tag}" "${flavor}"
if [[ {{ pipeline }} == "1" && -n "${SUDO_USER:-}" ]]; then
sudo -u "${SUDO_USER}" just load-rechunk "${image}" "${tag}" "${flavor}"
sudo -u "${SUDO_USER}" just secureboot "${image}" "${tag}" "${flavor}"
fi
# Load OCI into Podman Store
[group('Image')]
load-rechunk image="bluefin" tag="latest" flavor="main":
#!/usr/bin/bash
set -eou pipefail
# Validate
just validate {{ image }} {{ tag }} {{ flavor }}
# Image Name
image_name=$(just image_name {{ image }} {{ tag }} {{ flavor }})
# Load Image
OUT_NAME="${image_name}_build"
IMAGE=$(podman pull oci:"${PWD}"/"${OUT_NAME}")
podman tag ${IMAGE} localhost/"${image_name}":{{ tag }}
# Cleanup
just sudoif "rm -rf ${OUT_NAME}*"
just sudoif "rm -f previous.manifest.json"
# Run Container
[group('Image')]
run image="bluefin" tag="latest" flavor="main":
@ -523,7 +560,7 @@ build-iso image="bluefin" tag="latest" flavor="main" ghcr="0":
fi
# Build ISO using GHCR Image
[group('Production')]
[group('ISO')]
build-iso-ghcr image="bluefin" tag="latest" flavor="main":
@just build-iso {{ image }} {{ tag }} {{ flavor }} 1
@ -620,22 +657,12 @@ secureboot image="bluefin" tag="latest" flavor="main":
tag={{ tag }}
flavor={{ flavor }}
# Validate (Handle Stable-daily)
if [[ "${tag}" == "stable-daily" ]]; then
temp_tag="${tag}"
tag="stable"
fi
# Validate
just validate "${image}" "${tag}" "${flavor}"
# Image Name
image_name=$(just image_name ${image} ${tag} ${flavor})
if [[ -n "${temp_tag:-}" ]]; then
tag="${temp_tag}"
fi
# Get the vmlinuz to check
kernel_release=$(podman inspect "${image_name}":"${tag}" | jq -r '.[].Config.Labels["ostree.linux"]')
TMP=$(podman create "${image_name}":"${tag}" bash)
@ -677,6 +704,7 @@ secureboot image="bluefin" tag="latest" flavor="main":
# Get Fedora Version of an image
[group('Utility')]
[private]
fedora_version image="bluefin" tag="latest" flavor="main":
#!/usr/bin/bash
set -eou pipefail
@ -694,6 +722,7 @@ fedora_version image="bluefin" tag="latest" flavor="main":
# Image Name
[group('Utility')]
[private]
image_name image="bluefin" tag="latest" flavor="main":
#!/usr/bin/bash
set -eou pipefail
@ -707,17 +736,24 @@ image_name image="bluefin" tag="latest" flavor="main":
# Generate Tags
[group('Utility')]
generate-build-tags image="bluefin" tag="latest" flavor="main" ghcr="0" github_number="" github_event="":
generate-build-tags image="bluefin" tag="latest" flavor="main" ghcr="0" version="" github_event="" github_number="":
#!/usr/bin/bash
set -eou pipefail
# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
TODAY="$(date +%A)"
WEEKLY="Sunday"
if [[ {{ ghcr }} == "0" ]]; then
rm -f /tmp/manifest.json
fi
FEDORA_VERSION="$(just fedora_version {{ image }} {{ tag }} {{ flavor }})"
DEFAULT_TAG=$(just generate-default-tag {{ tag }} {{ ghcr }})
IMAGE_NAME=$(just image_name {{ image }} {{ tag }} {{ flavor }})
# Use Build Version from Rechunk
BUILD_VERSION={{ version }}
if [[ -z "${BUILD_VERSION:-}" ]]; then
BUILD_VERSION="${FEDORA_VERSION}.$(date +%Y%m%d)"
fi
BUILD_VERSION="${BUILD_VERSION:3}"
# Arrays for Tags
BUILD_TAGS=()
@ -733,21 +769,21 @@ generate-build-tags image="bluefin" tag="latest" flavor="main" ghcr="0" github_n
# Convenience Tags
if [[ "{{ tag }}" =~ stable ]]; then
BUILD_TAGS+=("stable-daily" "stable-daily-${TIMESTAMP}")
BUILD_TAGS+=("stable-daily" "stable-daily-${BUILD_VERSION}")
else
BUILD_TAGS+=("{{ tag }}" "{{ tag }}-${TIMESTAMP}")
BUILD_TAGS+=("{{ tag }}" "{{ tag }}-${BUILD_VERSION}")
fi
# Weekly Stable / Rebuild Stable on workflow_dispatch
github_event="{{ github_event }}"
if [[ "{{ tag }}" =~ "stable" && "${WEEKLY}" == "${TODAY}" && "${github_event}" =~ schedule ]]; then
BUILD_TAGS+=("stable" "stable-${TIMESTAMP}")
BUILD_TAGS+=("stable" "stable-${BUILD_VERSION}")
elif [[ "{{ tag }}" =~ "stable" && "${github_event}" =~ workflow_dispatch|workflow_call ]]; then
BUILD_TAGS+=("stable" "stable-${TIMESTAMP}")
BUILD_TAGS+=("stable" "stable-${BUILD_VERSION}")
elif [[ "{{ tag }}" =~ "stable" && "{{ ghcr }}" == "0" ]]; then
BUILD_TAGS+=("stable" "stable-${TIMESTAMP}")
BUILD_TAGS+=("stable" "stable-${BUILD_VERSION}")
elif [[ ! "{{ tag }}" =~ stable|beta ]]; then
BUILD_TAGS+=("${FEDORA_VERSION}" "${FEDORA_VERSION}-${TIMESTAMP}")
BUILD_TAGS+=("${FEDORA_VERSION}" "${FEDORA_VERSION}-${BUILD_VERSION}")
fi
if [[ "${github_event}" == "pull_request" ]]; then

View file

@ -31,6 +31,7 @@ sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
rpm-ostree install \
/tmp/akmods/kmods/*xone*.rpm \
/tmp/akmods/kmods/*xpadneo*.rpm \
/tmp/akmods/kmods/*openrazer*.rpm \
/tmp/akmods/kmods/*framework-laptop*.rpm
# RPMFUSION Dependent AKMODS