From c227138af1fa1b7e30b568254efdfd5acbf950f8 Mon Sep 17 00:00:00 2001 From: Joe Ipson Date: Wed, 13 Mar 2024 17:13:09 -0600 Subject: [PATCH] Move to new template --- .github/CODEOWNERS | 2 +- .github/dependabot.yml | 9 +- .github/semantic.yml | 2 - .github/workflows/build.yml | 228 ++---------------- .github/workflows/release-iso.yml | 13 +- .gitignore | 1 + CODE_OF_CONDUCT.md | 128 ---------- CONTRIBUTING.md | 141 ----------- Containerfile | 50 ---- build.sh | 74 ------ config/common_modules/scripts.yml | 3 +- config/common_modules/signing.yml | 1 + .../usr/etc/sysctl.d/20-memory-cabos.conf | 18 +- config/files/usr/lib/sysctl.d/swappiness.conf | 1 - .../usr/share/ublue-os/just/100-bling.just | 2 - .../usr/share/ublue-os/just/60-custom.just | 1 - config/recipe.yml | 1 + config/scripts/signing.sh | 30 --- 18 files changed, 40 insertions(+), 665 deletions(-) delete mode 100644 .github/semantic.yml delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Containerfile delete mode 100644 build.sh create mode 100644 config/common_modules/signing.yml delete mode 100644 config/files/usr/lib/sysctl.d/swappiness.conf delete mode 100644 config/files/usr/share/ublue-os/just/100-bling.just delete mode 100644 config/scripts/signing.sh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f6a87d2..9ba27c8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @castrojo +* @xynydev @fiftydinar diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d26c3c4..1230149 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,13 +1,6 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" - - + interval: "daily" diff --git a/.github/semantic.yml b/.github/semantic.yml deleted file mode 100644 index b5161df..0000000 --- a/.github/semantic.yml +++ /dev/null @@ -1,2 +0,0 @@ -enabled: true -titleOnly: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c72396b..415e93d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,224 +1,34 @@ -# This workflow builds every branch of the repository daily at 16:30 UTC, one hour after ublue-os/nvidia builds. -# The images are also built after pushing changes or pull requests. -# The builds can also be triggered manually in the Actions tab thanks to workflow dispatch. -# Only the branch called `live` is published. - - -name: build-cabos -on: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows +name: bluebuild +on: schedule: - - cron: "30 16 * * *" + - cron: "00 17 * * *" # build at 17:00 UTC every day + # (20 minutes after last ublue images start building) push: - branches: - - live - - template - - main paths-ignore: # don't rebuild if only documentation has changed - "**.md" + pull_request: - workflow_dispatch: - -env: - IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} - -# Only deploys the branch named "live". Ignores all other branches, to allow -# having "development" branches without interfering with GHCR image uploads. + workflow_dispatch: # allow manually triggering builds jobs: - push-ghcr: - name: Build and push image - runs-on: ubuntu-22.04 + bluebuild: + name: Build Custom Image + runs-on: ubuntu-latest permissions: contents: read packages: write id-token: write strategy: - fail-fast: false - + fail-fast: false # stop GH from cancelling all matrix builds if one fails matrix: -# !!! - # Add recipes for all the images you want to build here. - # Don't add module configuration files, you will get errors. recipe: + # !! Add your recipes here - recipe.yml -# !!! - steps: - # Checkout push-to-registry action GitHub repository - - name: Checkout Push to Registry action - uses: actions/checkout@v4 - - # Confirm that cosign.pub matches SIGNING_SECRET - - uses: sigstore/cosign-installer@v3.3.0 - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/live' - - - name: Check SIGNING_SECRET matches cosign.pub - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/live' - env: - COSIGN_EXPERIMENTAL: false - COSIGN_PASSWORD: "" - COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }} - shell: bash - run: | - echo "Checking for difference between public key from SIGNING_SECRET and cosign.pub" - delta=$(diff -u <(cosign public-key --key env://COSIGN_PRIVATE_KEY) cosign.pub) - if [ -z "$delta" ]; then - echo "cosign.pub matches SIGNING_SECRET" - else - echo "cosign.pub does not match SIGNING_SECRET" - echo "$delta" - exit 1 - fi - - - name: Add yq (for reading recipe.yml) - uses: mikefarah/yq@v4.40.5 - - - name: Gather image data from recipe - run: | - echo "IMAGE_NAME=$(yq '.name' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV - echo "IMAGE_DESCRIPTION=$(yq '.description' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV - echo "IMAGE_MAJOR_VERSION=$(yq '.image-version' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV - BASE_IMAGE=$(yq '.base-image' ./config/${{ matrix.recipe }}) - echo "BASE_IMAGE_URL=$BASE_IMAGE" >> $GITHUB_ENV - echo "BASE_IMAGE_NAME=$(echo $BASE_IMAGE | sed 's/.*\/.*\///')" >> $GITHUB_ENV - - - name: Verify base image - uses: EyeCantCU/cosign-action/verify@v0.2.2 - with: - containers: ${{ env.BASE_IMAGE_NAME }}:${{ env.IMAGE_MAJOR_VERSION }} - - - name: Get current version - id: labels - run: | - 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 - id: generate-tags - shell: bash - run: | - # Generate a timestamp for creating an image version history - TIMESTAMP="$(date +%Y%m%d)" - MAJOR_VERSION="$(echo ${{ steps.labels.outputs.VERSION }} | cut -d . -f 1)" - COMMIT_TAGS=() - BUILD_TAGS=() - # Have tags for tracking builds during pull request - SHA_SHORT="${GITHUB_SHA::7}" - - # Using clever bash string templating, https://stackoverflow.com/q/40771781 - # don't make malformed tags if $MAJOR_VERSION is empty (base-image didn't include proper labels) -- - COMMIT_TAGS+=("pr-${{ github.event.number }}${MAJOR_VERSION:+-$MAJOR_VERSION}") - COMMIT_TAGS+=("${SHA_SHORT}${MAJOR_VERSION:+-$MAJOR_VERSION}") - - BUILD_TAGS=("${MAJOR_VERSION}" "${MAJOR_VERSION:+$MAJOR_VERSION-}${TIMESTAMP}") - # -- - - BUILD_TAGS+=("${TIMESTAMP}") - BUILD_TAGS+=("latest") - - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - echo "Generated the following commit tags: " - for TAG in "${COMMIT_TAGS[@]}"; do - echo "${TAG}" - done - alias_tags=("${COMMIT_TAGS[@]}") - else - alias_tags=("${BUILD_TAGS[@]}") - fi - echo "Generated the following build tags: " - for TAG in "${BUILD_TAGS[@]}"; do - echo "${TAG}" - done - echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT - - # Build metadata - - name: Image Metadata - uses: docker/metadata-action@v5 - id: meta - with: - images: | - ${{ env.IMAGE_NAME }} - labels: | - org.opencontainers.image.title=${{ env.IMAGE_NAME }} - org.opencontainers.image.version=${{ steps.labels.outputs.VERSION }} - org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} - io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/startingpoint/main/README.md - io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4 - - # 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 - - name: Lowercase Registry - id: registry_case - uses: ASzc/change-string-case-action@v6 - with: - string: ${{ env.IMAGE_REGISTRY }} - - - name: Lowercase Image - id: image_case - uses: ASzc/change-string-case-action@v6 - with: - string: ${{ env.IMAGE_NAME }} - - - name: Maximize build space - uses: AdityaGarg8/remove-unwanted-software@v2 - with: - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - - # Build image using Buildah action - - name: Build Image - id: build_image - uses: redhat-actions/buildah-build@v2 - with: - containerfiles: | - ./Containerfile - image: ${{ env.IMAGE_NAME }} - tags: | - ${{ steps.generate-tags.outputs.alias_tags }} - build-args: | - IMAGE_MAJOR_VERSION=${{ env.IMAGE_MAJOR_VERSION }} - BASE_IMAGE_URL=${{ env.BASE_IMAGE_URL }} - RECIPE=${{ matrix.recipe }} - IMAGE_REGISTRY=${{ steps.registry_case.outputs.lowercase }} - labels: ${{ steps.meta.outputs.labels }} - oci: false - - # Push the image to GHCR (Image Registry) - - name: Push To GHCR - uses: redhat-actions/push-to-registry@v2 - id: push - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/live' - env: - REGISTRY_USER: ${{ github.actor }} - REGISTRY_PASSWORD: ${{ github.token }} - with: - image: ${{ steps.build_image.outputs.image }} - tags: ${{ steps.build_image.outputs.tags }} - registry: ${{ steps.registry_case.outputs.lowercase }} - username: ${{ env.REGISTRY_USER }} - password: ${{ env.REGISTRY_PASSWORD }} - extra-args: | - --disable-content-trust - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/live' - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Sign container - - name: Sign container image - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/live' - run: | - cosign sign -y --key env://COSIGN_PRIVATE_KEY ${{ steps.registry_case.outputs.lowercase }}/${{ steps.image_case.outputs.lowercase }}@${TAGS} - env: - TAGS: ${{ steps.push.outputs.digest }} - COSIGN_EXPERIMENTAL: false - COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }} - - - name: Echo outputs - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/live' - run: | - echo "${{ toJSON(steps.push.outputs) }}" + # the build is fully handled by the reusable github action + - name: Build Custom Image + uses: blue-build/github-action@v1.2 + with: + recipe: ${{ matrix.recipe }} + cosign_private_key: ${{ secrets.SIGNING_SECRET }} + registry_token: ${{ github.token }} + pr_event_number: ${{ github.event.number }} diff --git a/.github/workflows/release-iso.yml b/.github/workflows/release-iso.yml index 899f934..c89ea27 100644 --- a/.github/workflows/release-iso.yml +++ b/.github/workflows/release-iso.yml @@ -1,8 +1,8 @@ on: push: paths: - - 'boot_menu.yml' - - '.github/workflows/release-iso.yml' + - "boot_menu.yml" + - ".github/workflows/release-iso.yml" workflow_dispatch: name: release-iso @@ -12,13 +12,13 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - container: + container: image: fedora:39 options: --privileged steps: - uses: actions/checkout@v4 - - name: Generate ISO - uses: ublue-os/isogenerator@v2.3.1 + - name: Generate ISO + uses: ublue-os/isogenerator-old@v2.3.1 id: isogenerator with: image-name: ${{ github.event.repository.name }} @@ -43,5 +43,4 @@ jobs: - name: Upload SHA256SUM env: GITHUB_TOKEN: ${{ github.token }} - run: - gh release upload auto-iso ${{ steps.isogenerator.outputs.sha256sum-path }} -R ${{ github.repository_owner }}/${{ github.event.repository.name }} --clobber + run: gh release upload auto-iso ${{ steps.isogenerator.outputs.sha256sum-path }} -R ${{ github.repository_owner }}/${{ github.event.repository.name }} --clobber diff --git a/.gitignore b/.gitignore index 2ea33b5..51bf1a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea cosign.key +/Containerfile \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 1b6545a..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,128 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -jorge.castro@gmail.com. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series -of actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or -permanent ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within -the community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.0, available at -https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by [Mozilla's code of conduct -enforcement ladder](https://github.com/mozilla/diversity). - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 9289907..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,141 +0,0 @@ -# Welcome to Universal Blue - -Thanks for taking the time to look into helping out! -All contributions are appreciated! -Please refer to our [Code of Conduct](/CODE_OF_CONDUCT.md) while you're at it! - -Feel free to report issues as you find them, and [helping others in the discussions]() is always appreciated. - -# Contributing - -All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. - -> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: -> - Star the project -> - Tweet about it -> - Refer this project in your project's readme -> - Mention the project at local meetups and tell your friends/colleagues - -## Table of Contents - -- [Code of Conduct](#code-of-conduct) -- [I Have a Question](#i-have-a-question) -- [I Want To Contribute](#i-want-to-contribute) -- [Reporting Bugs](#reporting-bugs) -- [How to test incoming changes](#how-to-test-incoming-changes) -- [Building Locally](#building-locally) -- [Styleguides](#styleguides) -- [Commit Messages](#commit-messages) -- [Join The Project Team](#join-the-project-team) - -## Code of Conduct - -This project and everyone participating in it is governed by the -[CONTRIBUTING.md Code of Conduct](/CODE_OF_CONDUCT.md). -By participating, you are expected to uphold this code. Please report unacceptable behavior -to jorge.castro@gmail.com - -## I Have a Question - -> If you want to ask a question, ask in the [discussion forum](https://github.com/orgs/ublue-os/discussions) - -## I Want To Contribute - -> ### Legal Notice -> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. - -Generally speaking we try to follow the [Lazy Concensus](http://lazyconcens.us/) model of development to keep the builds healthy and ourselves happy. - - If you're looking for concensus to make a decision post an issue for feedback and remember to account for timezones and weekends/holidays/work time. - - We want people to be opinionated in their builds so we're more of a loose confederation of repos than a top-down org. - - Try not to merge your own stuff, ask for a review. At some point when we have enough reviewers we'll be turning on branch protection. - -### Reporting Bugs - -#### Before Submitting a Bug Report - -A good bug report should describe the issue in detail. Generally speaking: - -- Make sure that you are using the latest version. -- Remember that these are unofficial builds, it's usually prudent to investigate an issue before reporting it here or in Fedora! -- Collect information about the bug: - - `rpm-ostree status -v` usually helps -- Image and Version -- Possibly your input and the output -- Can you reliably reproduce the issue? And can you also reproduce it with older versions? - -### How to test incoming changes - -One of the nice things about the image model is that we can generate an entire OS image for every change we want to commit, so this makes testing way easier than in the past. You can rebase to it, see if it works, and then move back. This also means we can increase the amount of testers! - -We strive towards a model where proposed changes are more thoroughly reviewed and tested by the community. So here's how to do it. If you see a pull request that is opened up on an image you're following you can leave a review on how it's working for you. At the bottom of every PR you'll see something like this: - -![image](https://user-images.githubusercontent.com/1264109/221305388-3860fc07-212c-4eb9-80d9-5d7a35a77f46.png) - -Click on "Add your review", and then you'll see this: - -![image](https://user-images.githubusercontent.com/1264109/221307636-5e312e48-821f-4206-848f-7fbc2c91cd78.png) - -Don't worry, you can't mess anything up, all the merging and stuff will be done by the maintainer, what this does is lets us gather information in a more formal manner than just shoving everything in a forum thread. The more people are reviewing and testing images, the better off we'll be, especially for images that are new like Sericea. - -At some point we'll have a bot that will leave you instructions on how to rebase to the image and all that stuff, but in the meantime we'll leave instructions manually. - -Here's an example: https://github.com/ublue-os/nvidia/pull/49 - -## Building Locally - -The minimum tools required are git and a working machine with podman enabled and configured. -Building locally is much faster than building in GitHub and is a good way to move fast before pushing to a remote. - -### Clone the repo you want - - git clone https://github.com/ublue-os/base.git - -### Build the image - -First make sure you can build an existing image: - - podman build . -t something - -Then confirm your image built: - - podman image ls - -TODO: Set up and push to your own local registry - -### Make your changes - -This usually involved editing the `Containerfile`. Most techniques for building containers apply here, if you're new to containers using the term "Dockerfile" in your searches usually shows more results when you're searching for information. - -Check out CoreOS's [layering examples](https://github.com/coreos/layering-examples) for more information on customizing. - -### Reporting problems to Fedora - -We endevaour to be a good partner for Fedora. - -This project is consuming new features in Fedora and ostree, it is not uncommon to find an issue. -Issues should be reported upstream, and in some cases we can help test and find fixes. -Some of the issues you find may involve other dependencies in other projects, in those cases the Fedora team will tell you where to report the issue. - -Upstream bug tracker: [https://github.com/fedora-silverblue/issue-tracker/issues](https://github.com/fedora-silverblue/issue-tracker/issues) - -## Styleguides -### Commit Messages - -We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and enforce them with a bot to keep the changelogs tidy: - -``` -chore: add Oyster build script -docs: explain hat wobble -feat: add beta sequence -fix: remove broken confirmation message -refactor: share logic between 4d3d3d3 and flarhgunnstow -style: convert tabs to spaces -test: ensure Tayne retains clothing -``` - -## Join The Project Team - -If you're interested in _maintaining_ something then let us know! - -## Attribution -This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)! diff --git a/Containerfile b/Containerfile deleted file mode 100644 index 645cfab..0000000 --- a/Containerfile +++ /dev/null @@ -1,50 +0,0 @@ -# This is the Containerfile for your custom image. - -# Instead of adding RUN statements here, you should consider creating a script -# in `config/scripts/`. Read more in `modules/script/README.md` - -# This Containerfile takes in the recipe, version, and base image as arguments, -# all of which are provided by build.yml when doing builds -# in the cloud. The ARGs have default values, but changing those -# does nothing if the image is built in the cloud. - -# !! Warning: changing these might not do anything for you. Read comment above. -ARG IMAGE_MAJOR_VERSION=39 -ARG BASE_IMAGE_URL=ghcr.io/ublue-os/silverblue-main - -FROM ${BASE_IMAGE_URL}:${IMAGE_MAJOR_VERSION} - -# The default recipe is set to the recipe's default filename -# so that `podman build` should just work for most people. -ARG RECIPE=recipe.yml -# The default image registry to write to policy.json and cosign.yaml -ARG IMAGE_REGISTRY=ghcr.io/ublue-os - - -COPY cosign.pub /usr/share/ublue-os/cosign.pub - -# Copy the bling from ublue-os/bling into tmp, to be installed later by the bling module -# Feel free to remove these lines if you want to speed up image builds and don't want any bling -COPY --from=ghcr.io/ublue-os/bling:latest /rpms /tmp/bling/rpms -COPY --from=ghcr.io/ublue-os/bling:latest /files /tmp/bling/files - -# Copy build scripts & configuration -COPY build.sh /tmp/build.sh -COPY config /tmp/config/ - -# Copy modules -# The default modules are inside ublue-os/bling -COPY --from=ghcr.io/ublue-os/bling:latest /modules /tmp/modules/ -# Custom modules overwrite defaults -COPY modules /tmp/modules/ - -# `yq` is used for parsing the yaml configuration -# It is copied from the official container image since it's not available as an RPM. -COPY --from=docker.io/mikefarah/yq /usr/bin/yq /usr/bin/yq - -# Change this if you want different version/tag of akmods. -COPY --from=ghcr.io/ublue-os/akmods:main-39 /rpms /tmp/rpms - -# Run the build script, then clean up temp files and finalize container build. -RUN chmod +x /tmp/build.sh && /tmp/build.sh && \ - rm -rf /tmp/* /var/* && ostree container commit diff --git a/build.sh b/build.sh deleted file mode 100644 index f93a5b3..0000000 --- a/build.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash - -# This script executes the modules in order. -# If you have some custom commands you need to run, you should not put them here. -# Instead, you should probably include them as custom scripts. -# Editing this file directly is an unsupported configuration. - -# Tell build process to exit if there are any errors. -set -oue pipefail - -export CONFIG_DIRECTORY="/tmp/config" -RECIPE_FILE="$CONFIG_DIRECTORY/$RECIPE" -MODULE_DIRECTORY="/tmp/modules" - -# https://mikefarah.gitbook.io/yq/usage/tips-and-tricks#yq-in-a-bash-loop -get_yaml_array() { - # creates array $1 with content at key $2 from $3 - readarray "$1" < <(echo "$3" | yq -I=0 "$2") -} -export -f get_yaml_array # this makes the function available to all modules - -run_module() { - MODULE="$1" - TYPE=$(echo "$MODULE" | yq '.type') - if [[ "$TYPE" != "null" ]]; then - cd "$CONFIG_DIRECTORY" - # If type is found, that means that the module config - # has been declared inline, and thus is safe to pass to the module - echo "=== Launching module of type: $TYPE ===" - bash "$MODULE_DIRECTORY/$TYPE/$TYPE.sh" "$MODULE" - else - # If the type is not found, that means that the module config - # is in a separate file, and has to be read from it - FILE=$(echo "$MODULE" | yq '.from-file') - run_modules "$CONFIG_DIRECTORY/$FILE" - fi - echo "======" -} - -run_modules() { - MODULES_FILE="$1" - readarray MODULES < <(yq -o=j -I=0 '.modules[]' "$MODULES_FILE" ) - if [[ ${#MODULES[@]} -gt 0 ]]; then - for MODULE in "${MODULES[@]}"; do - run_module "$MODULE" - done - else - MODULE=$(yq -o=j -I=0 '.' "$MODULES_FILE") - run_module "$MODULE" - fi -} - -# Declare dynamically generated variables as exported -declare -x 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. -OS_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)" - -# Welcome. -echo "Building $IMAGE_NAME from $BASE_IMAGE:$OS_VERSION." - -# Remove old image-info.json from main image -# (this file is added back by signing.sh, but shouldn't exist -# with wrong details in an unsigned image) -IMAGE_INFO="/usr/share/ublue-os/image-info.json" -if [ -f "$IMAGE_INFO" ]; then - rm -v "$IMAGE_INFO" -fi - -run_modules "$RECIPE_FILE" diff --git a/config/common_modules/scripts.yml b/config/common_modules/scripts.yml index cf11efa..bc0c046 100644 --- a/config/common_modules/scripts.yml +++ b/config/common_modules/scripts.yml @@ -3,5 +3,4 @@ scripts: - system76-scheduler.sh - extra-packages.sh - oh-my-zsh.sh - - extensions.sh - - signing.sh \ No newline at end of file + - extensions.sh \ No newline at end of file diff --git a/config/common_modules/signing.yml b/config/common_modules/signing.yml new file mode 100644 index 0000000..43ec7c6 --- /dev/null +++ b/config/common_modules/signing.yml @@ -0,0 +1 @@ +type: signing \ No newline at end of file diff --git a/config/files/usr/etc/sysctl.d/20-memory-cabos.conf b/config/files/usr/etc/sysctl.d/20-memory-cabos.conf index a7b25c5..857a87b 100644 --- a/config/files/usr/etc/sysctl.d/20-memory-cabos.conf +++ b/config/files/usr/etc/sysctl.d/20-memory-cabos.conf @@ -1,15 +1,15 @@ # ZRAM tweaks (PopOS defaults) -vm.swappiness=180 -vm.watermark_boost_factor=0 -vm.watermark_scale_factor=125 -vm.page-cluster=0 +vm.swappiness=60 +# vm.watermark_boost_factor=0 +# vm.watermark_scale_factor=125 +# vm.page-cluster=0 -# Prevent long file transfer OOM -vm.dirty_bytes=268435456 -vm.dirty_background_bytes=134217728 +# Prevent long file transfer OOM +# vm.dirty_bytes=268435456 +# vm.dirty_background_bytes=134217728 # Increase memory maps (SteamOS default) -vm.max_map_count=2147483642 +# vm.max_map_count=2147483642 # Disable core dump -kernel.core_pattern=|/bin/false +# kernel.core_pattern=|/bin/false diff --git a/config/files/usr/lib/sysctl.d/swappiness.conf b/config/files/usr/lib/sysctl.d/swappiness.conf deleted file mode 100644 index 2aed62c..0000000 --- a/config/files/usr/lib/sysctl.d/swappiness.conf +++ /dev/null @@ -1 +0,0 @@ -vm.swappiness=1 \ No newline at end of file diff --git a/config/files/usr/share/ublue-os/just/100-bling.just b/config/files/usr/share/ublue-os/just/100-bling.just deleted file mode 100644 index 9e3a89b..0000000 --- a/config/files/usr/share/ublue-os/just/100-bling.just +++ /dev/null @@ -1,2 +0,0 @@ -# this file is a placeholder, -# making changes here is not supported diff --git a/config/files/usr/share/ublue-os/just/60-custom.just b/config/files/usr/share/ublue-os/just/60-custom.just index c166a8f..7f52058 100644 --- a/config/files/usr/share/ublue-os/just/60-custom.just +++ b/config/files/usr/share/ublue-os/just/60-custom.just @@ -1,4 +1,3 @@ -import '100-bling.just' # Include some of your custom scripts here! # Configure GRUB screen with various options diff --git a/config/recipe.yml b/config/recipe.yml index c171e0b..fb8fe9f 100644 --- a/config/recipe.yml +++ b/config/recipe.yml @@ -10,6 +10,7 @@ image-version: 39 # latest is also supported if you want new updates ASAP # module configuration, executed in order # you can include multiple instances of the same module modules: + - from-file: common_modules/signing.yml - from-file: common_modules/akmods.yml - from-file: common_modules/files.yml - from-file: common_modules/rpm-ostree.yml diff --git a/config/scripts/signing.sh b/config/scripts/signing.sh deleted file mode 100644 index 16b0ea8..0000000 --- a/config/scripts/signing.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# Tell build process to exit if there are any errors. -set -oue pipefail - -echo "Setting up container signing in policy.json and cosign.yaml for $IMAGE_NAME" -echo "Registry to write: $IMAGE_REGISTRY" - -cp /usr/share/ublue-os/cosign.pub /usr/etc/pki/containers/"$IMAGE_NAME".pub - -FILE=/usr/etc/containers/policy.json - -yq -i -o=j '.transports.docker |= - {"'"$IMAGE_REGISTRY"'/'"$IMAGE_NAME"'": [ - { - "type": "sigstoreSigned", - "keyPath": "/usr/etc/pki/containers/'"$IMAGE_NAME"'.pub", - "signedIdentity": { - "type": "matchRepository" - } - } - ] - } -+ .' "$FILE" - -IMAGE_REF="ostree-image-signed:docker://$IMAGE_REGISTRY/$IMAGE_NAME" -printf '{\n"image-ref": "'"$IMAGE_REF"'",\n"image-tag": "latest"\n}' > /usr/share/ublue-os/image-info.json - -cp /usr/etc/containers/registries.d/ublue-os.yaml /usr/etc/containers/registries.d/"$IMAGE_NAME".yaml -sed -i "s ghcr.io/ublue-os $IMAGE_REGISTRY g" /usr/etc/containers/registries.d/"$IMAGE_NAME".yaml