Compare commits

...

10 Commits
1.0.8 ... main

Author SHA1 Message Date
Morgan 6ef674397a
Update test-iso.yml 2024-03-05 19:08:26 +09:00
Morgan b5410c1668
Update test-iso.yml 2024-03-05 19:07:11 +09:00
Morgan 7ae9eae9fd
Update test-iso.yml 2024-03-05 18:56:17 +09:00
Noel Miller 766300bd98
fix: Container versions are not being set properly (#53)
* fix: Container versions are not being set properly

* fix: replaced build-action action

* fix: removed extra }

* fix: Fixed name of env variable

* fix: added checkout command
2024-03-04 16:42:27 +00:00
Noel Miller 10487bbf5b
chore: Remove CODEOWNERS (#54)
We are replacing codeowners with prow or possibly a different tool.
2024-03-04 16:31:48 +00:00
Robert Sturla c5f825fd3e
chore: remove ACTION_REF and ACTION_REPO action inputs (#49)
* Remove ACTION_REF and ACTION_REPO action inputs

* Remove duplicate github.

* Remove inputs from test-iso.yml workflow

* I highly doubt this will work, but let's try it anyway

* Let's try a different approach.  Don't clone the repo at all, as it should already be there.  Let's just set the working directory.

* Do not introduce a breaking change

* Say the unused variables will be removed soon
2024-02-29 19:49:22 +00:00
Robert Sturla aa4aecdc7e
chore: remove dnf cache and unused files from built image (#26)
* chore: add a `dnf clean all` step after installing deps

* chore: only copy the required files to the image

* fix: add scripts to the image

* Switch to .dockerignore file

---------

Co-authored-by: Noel Miller <4983138+noelmiller@users.noreply.github.com>
2024-02-29 19:49:12 +00:00
Robert Sturla e2fbaa438c
feat: add action outputs (#47)
* Create and document action outputs

* Use outputs in upload artifact step
2024-02-29 17:01:08 +00:00
Robert Sturla ec1f755ae3
chore: small refactoring to CI build matrix jobs (#48)
chore: small refactoring so the build matrix job names make a bit more sense
2024-02-29 16:55:37 +00:00
Noel Miller 7a19c2dbe1
fix: sets default password in action (#46) 2024-02-29 00:02:51 +00:00
7 changed files with 193 additions and 39 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
.devcontainer
.git*
*.md
action.yml
LICENSE

2
.github/CODEOWNERS vendored
View File

@ -1,2 +0,0 @@
# Default owner of code within this repo
* @JasonN3

View File

@ -13,6 +13,9 @@ on:
branches:
- main
workflow_dispatch:
env:
IMAGE_NAME: "isogenerator"
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
push-image:
@ -30,17 +33,144 @@ jobs:
- 40
include:
- version: 39
support: latest
is_latest_version: true
is_stable_version: true
steps:
- name: Build image
uses: ublue-os/build-action@1.0.1
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
uses: actions/checkout@v4
- name: Generate tags
id: generate-tags
shell: bash
run: |
# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
VARIANT="${{ matrix.version }}"
COMMIT_TAGS=()
BUILD_TAGS=()
# Have tags for tracking builds during pull request
SHA_SHORT="${GITHUB_SHA::7}"
COMMIT_TAGS+=("pr-${{ github.event.number }}-${VARIANT}")
COMMIT_TAGS+=("${SHA_SHORT}-${VARIANT}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]]; then
COMMIT_TAGS+=("pr-${{ github.event.number }}")
COMMIT_TAGS+=("${SHA_SHORT}")
fi
BUILD_TAGS=("${VARIANT}")
# Append matching timestamp tags to keep a version history
for TAG in "${BUILD_TAGS[@]}"; do
BUILD_TAGS+=("${TAG}-${TIMESTAMP}")
done
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]]; then
BUILD_TAGS+=("${TIMESTAMP}")
BUILD_TAGS+=("latest")
fi
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
- name: Get current version
id: labels
run: |
ver=$(skopeo inspect docker://ghcr.io/ublue-os/${{ env.IMAGE_NAME }}:${{ matrix.version }} | jq -r '.Labels["org.opencontainers.image.version"]')
echo "VERSION=$ver" >> $GITHUB_OUTPUT
# Build metadata
- name: Image Metadata
uses: docker/metadata-action@v5
id: meta
with:
image_name: isogenerator
image_variant: main
version: ${{ matrix.version }}
support: ${{ matrix.support }}
signing_key: ${{ secrets.SIGNING_SECRET }}
continue-on-error: false
images: |
${{ env.IMAGE_NAME }}
labels: |
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md
org.opencontainers.image.description=Used to generate ISO installers for OCI containers
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
org.opencontainers.image.version=${{ steps.labels.outputs.VERSION }}
# Build image using Buildah action
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
containerfiles: |
./Containerfile
# Postfix image name with -custom to make it a little more descriptive
# Syntax: https://docs.github.com/en/actions/learn-github-actions/expressions#format
image: ${{ env.IMAGE_NAME }}
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
VERSION=${{ matrix.version }}
labels: ${{ steps.meta.outputs.labels }}
oci: false
# 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: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Push the image to GHCR (Image Registry)
- name: Push To GHCR
uses: redhat-actions/push-to-registry@v2
id: push
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
# Sign container
- uses: sigstore/cosign-installer@v3.4.0
if: github.event_name != 'pull_request'
- name: Sign container image
if: github.event_name != 'pull_request'
run: |
cosign sign -y --key env://COSIGN_PRIVATE_KEY ${{ steps.registry_case.outputs.lowercase }}/${{ steps.build_image.outputs.image }}@${TAGS}
env:
TAGS: ${{ steps.push.outputs.digest }}
COSIGN_EXPERIMENTAL: false
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}
check:
name: Check build successful

View File

@ -15,7 +15,7 @@ on:
jobs:
build-and-push-iso:
name: Build ISO
runs-on: ubuntu-latest
runs-on: self-hosted
container:
image: fedora:39
options: "--privileged"
@ -27,18 +27,14 @@ jobs:
strategy:
fail-fast: false
matrix:
version:
- 38
- 39
secure_boot:
- true
- false
version: [38, 39]
boot: [secureboot, insecure]
include:
- secure_boot: true
- boot: secureboot
SECURE_BOOT_KEY_URL: 'https://github.com/ublue-os/akmods/raw/main/certs/public_key.der'
ENROLLMENT_PASSWORD: 'ublue-os'
SECURE_BOOT_STRING: '-secure'
- secure_boot: false
- boot: insecure
SECURE_BOOT_KEY_URL: ''
ENROLLMENT_PASSWORD: ''
SECURE_BOOT_STRING: ''
@ -48,6 +44,7 @@ jobs:
uses: actions/checkout@v4
- name: Build ISO
id: build-iso
uses: ./
with:
ARCH: 'x86_64'
@ -55,8 +52,6 @@ jobs:
IMAGE_REPO: 'ghcr.io/ublue-os'
VARIANT: 'Kinoite'
VERSION: ${{ matrix.version }}
ACTION_REPO: ${{ github.repository }}
ACTION_REF: ${{ github.ref }}
SECURE_BOOT_KEY_URL: ${{ matrix.SECURE_BOOT_KEY_URL }}
ENROLLMENT_PASSWORD: ${{ matrix.ENROLLMENT_PASSWORD }}
@ -64,7 +59,9 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: base-main-${{ matrix.version }}${{ matrix.SECURE_BOOT_STRING }}.iso
path: end_iso/*
path: |
${{ steps.build-iso.outputs.iso-path }}
${{ steps.build-iso.outputs.checksum-path }}
if-no-files-found: error
retention-days: 0
compression-level: 0

View File

@ -4,7 +4,7 @@ ARG VERSION=39
FROM fedora:${VERSION}
# Set version for the environment variables in the container.
ARG VERSION=39
ARG VERSION=${VERSION}
ENV ARCH="x86_64"
ENV IMAGE_NAME="base-main"
@ -16,10 +16,12 @@ ENV WEB_UI="false"
ENV SECURE_BOOT_KEY_URL=""
ENV ENROLLMENT_PASSWORD="ublue-os"
COPY / /isogenerator
COPY ./ /isogenerator
WORKDIR /isogenerator
RUN dnf install -y make && make install-deps
RUN dnf install -y make && \
make install-deps && \
dnf clean all
VOLUME /isogenerator/output

View File

@ -35,6 +35,9 @@ sudo podman run --rm --privileged --volume .:/isogenerator/output -e VERSION=39
```
## Customizing
### Inputs
The following variables can be used to customize the create image.
| Variable | Description | Default Value |
@ -56,6 +59,16 @@ The following variables can be used to customize the create image.
Our public key for our kmods is located here: https://github.com/ublue-os/akmods/raw/main/certs/public_key.der
### Outputs
This action outputs some useful values for you to use further on in your workflow.
| Output | Description |
| ------ | ----------- |
| output-directory | The directory containing ISO and checksum files |
| iso-path | The full path to the ISO file |
| checksum-path | The full path to the checksum file |
## VSCode Dev Container
There is a dev container configuration provided for development. By default it will use the existing container image available at `ghcr.io/ublue-os/isogenerator`, however, you can have it build a new image by editing `.devcontainer/devcontainer.json` and replacing `image` with `build`. `Ctrl+/` can be used to comment and uncomment blocks of code within VSCode.

View File

@ -35,17 +35,24 @@ inputs:
ENROLLMENT_PASSWORD:
description: Used for supporting secure boot (requires SECURE_BOOT_KEY_URL to be defined)
required: false
default: "ublue-os"
SECURE_BOOT_KEY_URL:
description: Secure boot key that is installed from URL location
required: false
ACTION_REPO:
description: Repository with the build action
deprecationMessage: This variable is no longer used and will be removed in a future version
required: false
default: ${{ github.repository }}
ACTION_REF:
description: Repository ref for the build action
deprecationMessage: This variable is no longer used and will be removed in a future version
required: false
default: ${{ github.ref }}
outputs:
output-directory:
value: ${{ steps.final.outputs.OUTPUT_DIR }}
iso-path:
value: ${{ steps.final.outputs.ISO_PATH }}
checksum-path:
value: ${{ steps.final.outputs.CHECKSUM_PATH }}
runs:
using: composite
@ -69,19 +76,13 @@ runs:
echo "Host must be mounted as /host in order to make more space"
fi
- name: Install make and git
- name: Install Make
shell: bash
run: dnf install -y make git
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ inputs.ACTION_REPO }}
ref: ${{ inputs.ACTION_REF }}
submodules: recursive
run: dnf install -y make
- name: Install dependencies
shell: bash
working-directory: ${{ github.action_path }}
run: make install-deps
- name: Lowercase Registry
@ -92,6 +93,7 @@ runs:
- name: Download image
shell: bash
working-directory: ${{ github.action_path }}
run: |
make container/${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }} \
ARCH=${{ inputs.ARCH }} \
@ -104,6 +106,7 @@ runs:
- name: Create boot.iso
shell: bash
working-directory: ${{ github.action_path }}
run: |
make boot.iso \
ARCH=${{ inputs.ARCH }} \
@ -119,6 +122,8 @@ runs:
- name: Create deploy.iso and generate sha256 checksum
shell: bash
id: final
working-directory: ${{ github.action_path }}
run: |
make ${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}.iso \
ARCH=${{ inputs.ARCH }} \
@ -131,3 +136,7 @@ runs:
mkdir end_iso
sha256sum ${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}.iso > ./end_iso/${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}-CHECKSUM
mv ${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}.iso end_iso/
echo "OUTPUT_DIR=$(realpath ./end_iso)" >> $GITHUB_OUTPUT
echo "ISO_PATH=$(realpath ./end_iso/${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}.iso)" >> $GITHUB_OUTPUT
echo "CHECKSUM_PATH=$(realpath ./end_iso/${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}-CHECKSUM)" >> $GITHUB_OUTPUT