Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/build-bootc-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
strategy:
fail-fast: false
runs-on: ubuntu-24.04
outputs:
image_version: ${{ steps.getversion.outputs.image_version }}
steps:
- name: Free disk space
uses: hastd/free-disk-space@68572aeaadb7f76bd408246328e95926323402b5 # v0.1.2
Expand Down Expand Up @@ -97,6 +99,10 @@ jobs:
- name: Install mkosi
uses: systemd/mkosi@c4c3d793d0f6f0a2f26895de5ed9382396f36bb5

- name: Set mkosi.version
# We need to do this because mkosi.version is not persistent between builds on CI
run: skopeo list-tags docker://${IMAGE_REGISTRY}/${IMAGE_NAME} | jq --arg date "$(date -u +%Y%m%d)" -r '.Tags[] | select(startswith($date+"."))' | sort -n | tail -1 > mkosi.version

- name: Render configuration (for debugging)
run: mkosi cat-config --debug

Expand All @@ -120,6 +126,12 @@ jobs:

sudo mkosi -B --profile bootc ${args} --debug -ff --tools-tree-distribution=arch ${RELEASE_ARGUMENTS}

- name: Get Version
id: getversion
run: |
set -e
echo "image_version=$(cat mkosi.version)" >> "$GITHUB_OUTPUT"

- name: Load image
id: load
run: |
Expand Down Expand Up @@ -247,9 +259,9 @@ jobs:
tags: |
type=raw,value=${{ env.DEFAULT_TAG }}
type=raw,value=${{ env.DEFAULT_TAG }}-${{ github.sha }}
type=raw,value=${{ env.DEFAULT_TAG }}.{{date 'YYYYMMDD'}}
type=raw,value=${{ env.DEFAULT_TAG }}.{{date 'YYYYMMDD'}}-${{ github.sha }}
type=raw,value={{ date 'YYYYMMDD'}},enable=${{ env.DEFAULT_TAG == 'latest' }}
type=raw,value=${{ env.DEFAULT_TAG }}.${{ needs.build_push.outputs.image_version }}
type=raw,value=${{ env.DEFAULT_TAG }}.${{ needs.build_push.outputs.image_version }}-${{ github.sha }}
type=raw,value=${{ needs.build_push.outputs.image_version }},enable=${{ env.DEFAULT_TAG == 'latest' }}
type=ref,event=pr
type=sha,enable=${{ github.event_name == 'pull_request' }}
labels: |
Expand All @@ -268,7 +280,7 @@ jobs:
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
org.opencontainers.image.url=https://github.com/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}/tree/${{ github.sha }}
org.opencontainers.image.vendor=${{ github.repository_owner }}
org.opencontainers.image.version=${{ env.DEFAULT_TAG }}.{{date 'YYYYMMDD'}}
org.opencontainers.image.version=${{ env.DEFAULT_TAG }}.${{ needs.build_push.outputs.image_version }}

- name: Login to GitHub Container Registry
if: inputs.publish
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Thank you for your interest in contributing to Apollo. To help your contribution be accepted more easily, please read through the following first.

## Building
Apollo is made with mkosi and bootc. You'll need mkosi, just, and preferably podman (docker should work too). A hypervisor is also recommended for testing images.
Apollo is made with mkosi and bootc. You'll need mkosi, python, just, and preferably podman (docker should work too). A hypervisor is also recommended for testing images.

You can build a bootc-compatible oci archive with mkosi (an Arch-based environment is currently recommended) using the following command:
```bash
Expand Down
27 changes: 24 additions & 3 deletions mkosi.bump
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
#!/bin/bash
set -e
#!/usr/bin/env python
from datetime import datetime, timezone

date +%Y%m%d%H%M%S
DEFAULT_INDEX=0

cur_date = datetime.now(timezone.utc).strftime("%Y%m%d")
old_date = None
old_index = 0

# Try to find the old version. If the file is missing or fails to parse, don't do anything
try:
old_version = open("mkosi.version", "r").read().split(".")
if len(old_version) == 2:
old_date = old_version[0]
old_index = int(old_version[1])

except FileNotFoundError, ValueError:
pass

# If the date timestamp (YYYYMMDD) of the last built version is the same as the one we want to build, increment the counter index. If not, reset to 0
if old_date != cur_date:
print(f"{cur_date}.{DEFAULT_INDEX}")
else:
new_index = old_index + 1
print(f"{cur_date}.{new_index}")

3 changes: 2 additions & 1 deletion mkosi.postinst.d/os-info.chroot
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ HOME_URL="${HOME_URL}"
SUPPORT_URL="${SUPPORT_URL}"
LOGO="${LOGO}"
DEFAULT_HOSTNAME="${HOSTNAME}"
EOF
IMAGE_VERSION="${IMAGE_VERSION}"
EOF