Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Upload Repo Artifacts, add Image CI Workflow #1

Merged
merged 7 commits into from
Oct 17, 2023
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
46 changes: 46 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Image

on:
workflow_dispatch:

jobs:
debian-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [ amd64, arm64 ]
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build the image
run: ./build ostreeImage-${{ matrix.arch }}
working-directory: ./debian
- name: Upload ${{ matrix.arch }} image
uses: actions/upload-artifact@v3
with:
name: ostree-${{ matrix.arch }}-trixie-image
path: debian/.build/ostreeImage-${{ matrix.arch }}-trixie*.ostreeImage.tar.gz
retention-days: 2

gardenlinux-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [ amd64, arm64 ]
platform: [ kvm ]
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build the image
run: ./build ${{ matrix.platform }}_dev_curl-ostreeImage-${{ matrix.arch }}
working-directory: ./gardenlinux
- name: Upload ${{ matrix.arch }} image
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}_dev_curl-ostreeImage-${{ matrix.arch }}
path: gardenlinux/.build/${{ matrix.platform }}*ostreeImage-${{ matrix.arch }}*.ostreeImage.tar.gz
retention-days: 2
12 changes: 12 additions & 0 deletions .github/workflows/repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
- name: Build the repo
run: ./build ostreeRepo-${{ matrix.arch }}
working-directory: ./debian
- name: Upload ${{ matrix.arch }} repo
uses: actions/upload-artifact@v3
with:
name: ostree-${{ matrix.arch }}-trixie-repo
path: debian/.build/ostreeRepo-${{ matrix.arch }}-trixie*.ostreeRepo.tar.gz
retention-days: 2

gardenlinux-repo:
runs-on: ubuntu-latest
Expand All @@ -36,3 +42,9 @@ jobs:
- name: Build the repo
run: ./build ${{ matrix.platform }}_dev_curl-ostreeRepo-${{ matrix.arch }}
working-directory: ./gardenlinux
- name: Upload ${{ matrix.arch }} repo
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}_dev_curl-ostreeRepo-${{ matrix.arch }}
path: gardenlinux/.build/${{ matrix.platform }}*ostreeRepo-${{ matrix.arch }}*.ostreeRepo.tar.gz
retention-days: 2
11 changes: 9 additions & 2 deletions debian/features/ostreeImage/image.ostree.raw
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ OSTREE_SYSROOT="$MYROOT/sysroot"
OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo
OSTREE_REF="debian/testing/$BUILDER_ARCH"

# REPO_CNAME=$(echo $BUILDER_CNAME | sed 's/Image/Repo/g')
# FIXME proper name building
REPO_CNAME=ostreeRepo-${BUILDER_ARCH}-trixie
REMOTE_NAME="$REPO_CNAME".ostreeRepo
REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz"
REMOTE_URL="http://ostree.gardenlinux.io"

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

Expand All @@ -26,8 +33,8 @@ mkdir -p $OSTREE_REPO
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
curl --remote-name $REMOTE_URL/$REMOTE_ARCHIVE_NAME
tar xf $REMOTE_ARCHIVE_NAME --directory $OSTREE_REPO
ls -l $OSTREE_REPO
popd
rm -rf $download
Expand Down
18 changes: 11 additions & 7 deletions debian/features/ostreeRepo/image.ostreeRepo.tar.gz
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ OSTREE_SYSROOT="$MYROOT/sysroot"
OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo
OSTREE_REF="debian/testing/$BUILDER_ARCH"

REMOTE_NAME="$BUILDER_CNAME".ostreeRepo
REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz"
REMOTE_URL="http://ostree.gardenlinux.io"

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

Expand All @@ -23,26 +27,26 @@ 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;
if curl --head --silent --fail $REMOTE_URL/$REMOTE_ARCHIVE_NAME 2> /dev/null;
then
echo "Using http://ostree.gardenlinux.io/debian-testing-$BUILDER_ARCH.tar.gz"
echo "Using $REMOTE_URL/$REMOTE_ARCHIVE_NAME"
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
curl --remote-name $REMOTE_URL/$REMOTE_ARCHIVE_NAME
tar xf $REMOTE_ARCHIVE_NAME --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"
echo "Coud not download $REMOTE_URL/$REMOTE_ARCHIVE_NAME, 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
ostree remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin $REMOTE_URL/$REMOTE_NAME $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"
ostree commit --repo=$OSTREE_REPO --branch $OSTREE_REF --skip-if-unchanged -s "Debian $REMOTE_NAME $(date --utc +%Y-%m-%dT%H:%M%Z)" "$rootfs_work"

ostree log --repo=$OSTREE_REPO $OSTREE_REF

Expand Down
11 changes: 9 additions & 2 deletions gardenlinux/features/ostreeImage/image.ostree.raw
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ OSTREE_SYSROOT="$MYROOT/sysroot"
OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo
OSTREE_REF="gardenlinux/today/$BUILDER_ARCH"

# REPO_CNAME=$(echo $BUILDER_CNAME | sed 's/Image/Repo/g')
# FIXME proper name building
REPO_CNAME=kvm_curl_dev-ostreeRepo-${BUILDER_ARCH}-today
REMOTE_NAME="$REPO_CNAME".ostreeRepo
REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz"
REMOTE_URL="http://ostree.gardenlinux.io"

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

Expand All @@ -26,8 +33,8 @@ mkdir -p $OSTREE_REPO
mkdir -p $OSTREE_SYSROOT
download="$(mktemp -d)"
pushd $download
curl --remote-name http://ostree.gardenlinux.io/gardenlinux-today-$BUILDER_ARCH.tar.gz
tar xf gardenlinux-today-$BUILDER_ARCH.tar.gz --directory $OSTREE_REPO
curl --remote-name $REMOTE_URL/$REMOTE_ARCHIVE_NAME
tar xf $REMOTE_ARCHIVE_NAME --directory $OSTREE_REPO
ls -l $OSTREE_REPO
popd
rm -rf $download
Expand Down
2 changes: 1 addition & 1 deletion gardenlinux/features/ostreeImage/info.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
description: 'image-based system using OSTree'
type: platform
type: element
41 changes: 25 additions & 16 deletions gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ OSTREE_SYSROOT="$MYROOT/sysroot"
OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo
OSTREE_REF="gardenlinux/today/$BUILDER_ARCH"

REMOTE_NAME="$BUILDER_CNAME".ostreeRepo
REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz"
REMOTE_URL="http://ostree.gardenlinux.io"

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

Expand All @@ -23,26 +27,31 @@ mv "$rootfs_work"/etc "$rootfs_work"/usr/etc

mkdir -p $OSTREE_REPO

# fixme: re-enable later
# if curl --head --silent --fail http://ostree.gardenlinux.io/gardenlinux-today-$BUILDER_ARCH.tar.gz 2> /dev/null;
# then
# echo "Using http://ostree.gardenlinux.io/gardenlinux-today-$BUILDER_ARCH.tar.gz"
# mkdir -p $OSTREE_REPO
# download="$(mktemp -d)"
# pushd $download
# curl --remote-name http://ostree.gardenlinux.io/gardenlinux-today-$BUILDER_ARCH.tar.gz
# tar xf gardenlinux-today-$BUILDER_ARCH.tar.gz --directory $OSTREE_REPO
# popd
# rm -rf $download
# else
# echo "Coud not download http://ostree.gardenlinux.io/gardenlinux-today-$BUILDER_ARCH.tar.gz, building new repo"
if curl --head --silent --fail $REMOTE_URL/$REMOTE_ARCHIVE_NAME 2> /dev/null;
then
echo "Using $REMOTE_URL/$REMOTE_ARCHIVE_NAME"
mkdir -p $OSTREE_REPO
download="$(mktemp -d)"
pushd $download
curl --remote-name $REMOTE_URL/$REMOTE_ARCHIVE_NAME
tar xf $REMOTE_ARCHIVE_NAME --directory $OSTREE_REPO
popd
rm -rf $download
else
echo "Coud not download $REMOTE_URL/$REMOTE_ARCHIVE_NAME, building new 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 remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin http://ostree.gardenlinux.io/gardenlinux-today-$BUILDER_ARCH $OSTREE_REF
# fi
ostree remote --repo=$OSTREE_REPO add --no-gpg-verify --no-sign-verify origin $REMOTE_URL/$REMOTE_NAME $OSTREE_REF
fi

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

ostree log --repo=$OSTREE_REPO $OSTREE_REF

ostree summary --update --repo=$OSTREE_REPO

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

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: 1 addition & 1 deletion gardenlinux/features/ostreeRepo/info.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
description: 'image-based system using OSTree'
type: flag
type: element
features:
exclude:
- _boot
Loading