Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Build multi-arch images (amd64, arm64), upload images
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilhe committed Oct 10, 2023
1 parent fd136ca commit 028a45d
Show file tree
Hide file tree
Showing 20 changed files with 128 additions and 59 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/build.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build the repo
run: ./build ostreeImage-amd64 ostreeImage-arm64
- name: Upload amd64
uses: actions/upload-artifact@v3
with:
name: ostree-amd64-trixie-image
path: .build/*amd64-trixie-*raw
- name: Upload arm64
uses: actions/upload-artifact@v3
with:
name: ostree-arm64-trixie-image
path: .build/*arm64-trixie-*raw

28 changes: 28 additions & 0 deletions .github/workflows/repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
repo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build the repo
run: ./build ostreeRepo-amd64 ostreeRepo-arm64
- name: Upload amd64
uses: actions/upload-artifact@v3
with:
name: ostree-amd64-trixie-repo
path: .build/ostreeRepo-amd64-trixie-*.ostreeRepo.tar.gz
- name: Upload arm64
uses: actions/upload-artifact@v3
with:
name: ostree-arm64-trixie-repo
path: .build/ostreeRepo-arm64-trixie-*.ostreeRepo.tar.gz
28 changes: 0 additions & 28 deletions features/ostree/makeRepo.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ mount -t tmpfs tmpfs "$rootfs_work"
MYROOT="$(mktemp -d)"
mount -t tmpfs tmpfs "$MYROOT"
mkdir -p "$MYROOT"/sysroot
mkdir -p "$MYROOT"/sysroot/ostree/deploy
mkdir -p "$MYROOT"/sysroot/ostree/deploy/debian/var
OSTREE_SYSROOT="$MYROOT/sysroot"
OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo
OSTREE_REF="debian/testing/$BUILDER_ARCH"
Expand All @@ -19,27 +21,28 @@ output="$2"

tar xf "$rootfs" -C "$rootfs_work"

mv "$rootfs_work"/etc "$rootfs_work"/usr/etc

mkdir -p $OSTREE_REPO
ostree init --mode=archive --repo=$OSTREE_REPO
ostree admin init-fs --modern $OSTREE_SYSROOT
ostree admin os-init --sysroot=$OSTREE_SYSROOT gardenlinux
ostree config --repo=$OSTREE_REPO set sysroot.bootloader none
ostree commit --repo=$OSTREE_REPO --branch $OSTREE_REF --skip-if-unchanged -s "Debian testing build $(date --utc +%Y-%m-%dT%H:%M:%S%Z)" "$rootfs_work"
ostree remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin http://172.16.48.131:8000 $OSTREE_REF # fixme: hardcoded ip address
mkdir -p $OSTREE_SYSROOT
download="$(mktemp -d)"
pushd $download
curl --remote-name http://ostree.gardenlinux.io/debian-testing-$BUILDER_ARCH.tar.gz
tar xf debian-testing-$BUILDER_ARCH.tar.gz --directory $OSTREE_REPO
ls -l $OSTREE_REPO
popd
rm -rf $download
ostree admin deploy --karg=root=LABEL=ROOT --karg-append=rw --karg-append=efi=runtime --karg-append=systemd.journald.forward_to_console=1 --sysroot=$OSTREE_SYSROOT --os=gardenlinux $OSTREE_REF

boot_hash=`ls "$OSTREE_SYSROOT"/ostree/boot.1.1/gardenlinux/`
mkdir -p "$OSTREE_SYSROOT"/ostree/boot.1.1/gardenlinux/$boot_hash/0/sysroot
boot_hash=`ls "$OSTREE_SYSROOT"/ostree/boot.1.1/debian/`
mkdir -p "$OSTREE_SYSROOT"/ostree/boot.1.1/debian/$boot_hash/0/sysroot

mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/home
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/home/user
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/roothome
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/opt
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/srv
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/debian/var/home
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/debian/var/home/user
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/debian/var/roothome
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/debian/var/opt
mkdir -p "$OSTREE_SYSROOT"/ostree/deploy/debian/var/srv

chown 1000:1000 "$OSTREE_SYSROOT"/ostree/deploy/gardenlinux/var/home/user
chown 1000:1000 "$OSTREE_SYSROOT"/ostree/deploy/debian/var/home/user

# Build disk image, this is hacky as of now, needs rework
# Setup bootloader
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions features/ostreeRepo/file.exclude
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/boot/efi/loader/random-seed
3 changes: 3 additions & 0 deletions features/ostreeRepo/fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# <file system> <dir> <type> <options> <makeimg args>
LABEL=EFI /boot/efi vfat umask=0077 type=uefi,size=1G
LABEL=ROOT / ext4 rw,prjquota,discard
47 changes: 47 additions & 0 deletions features/ostreeRepo/image.ostreeRepo.tar.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

set -euxo pipefail

export PATH="/builder/image.d:$PATH"

rootfs_work="$(mktemp -d)"
mount -t tmpfs tmpfs "$rootfs_work"

MYROOT="$(mktemp -d)"
mount -t tmpfs tmpfs "$MYROOT"
mkdir -p "$MYROOT"/sysroot
OSTREE_SYSROOT="$MYROOT/sysroot"
OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo
OSTREE_REF="debian/testing/$BUILDER_ARCH"

rootfs="$1"
output="$2"

tar xf "$rootfs" -C "$rootfs_work"

mv "$rootfs_work"/etc "$rootfs_work"/usr/etc

mkdir -p $OSTREE_REPO

if curl --head --silent --fail http://ostree.gardenlinux.io/debian-testing-$BUILDER_ARCH.tar.gz 2> /dev/null;
then
echo "Using http://ostree.gardenlinux.io/debian-testing-$BUILDER_ARCH.tar.gz"
mkdir -p $OSTREE_REPO
download="$(mktemp -d)"
pushd $download
curl --remote-name http://ostree.gardenlinux.io/debian-testing-$BUILDER_ARCH.tar.gz
tar xf debian-testing-$BUILDER_ARCH.tar.gz --directory $OSTREE_REPO
popd
rm -rf $download
else
echo "Coud not download http://ostree.gardenlinux.io/debian-testing-$BUILDER_ARCH.tar.gz, building new repo"
ostree init --mode=archive --repo=$OSTREE_REPO
ostree admin init-fs --modern $OSTREE_SYSROOT
ostree admin os-init --sysroot=$OSTREE_SYSROOT debian
ostree config --repo=$OSTREE_REPO set sysroot.bootloader none
ostree remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin http://ostree.gardenlinux.io/debian-testing-$BUILDER_ARCH $OSTREE_REF
fi

ostree commit --repo=$OSTREE_REPO --branch $OSTREE_REF --skip-if-unchanged -s "Debian testing build $(date --utc +%Y-%m-%dT%H:%M%Z)" "$rootfs_work"

tar --directory $OSTREE_REPO --create --mtime="@$BUILDER_TIMESTAMP" --sort name --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime . | gzip > "$output"
2 changes: 2 additions & 0 deletions features/ostreeRepo/info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
description: 'image-based system using OSTree'
type: platform
File renamed without changes.

0 comments on commit 028a45d

Please sign in to comment.