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

Commit

Permalink
Upload artifacts, use cname for artifact name
Browse files Browse the repository at this point in the history
  • Loading branch information
fwilhe committed Oct 16, 2023
1 parent cd0f2bc commit cdee42f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
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: .build/*.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: .build/${{ matrix.platform }}*ostreeRepo-${{ matrix.arch }}*.ostreeRepo.tar.gz
retention-days: 2
35 changes: 19 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="gardenlinux-$BUILDER_CNAME"
REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz"
REMOTE_URL="http://ostree.gardenlinux.io"

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

Expand All @@ -23,26 +27,25 @@ 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 "Gardenlinux build $(date --utc +%Y-%m-%dT%H:%M%Z)" "$rootfs_work"
ostree commit --repo=$OSTREE_REPO --branch $OSTREE_REF --skip-if-unchanged -s "$REMOTE_NAME $(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"

0 comments on commit cdee42f

Please sign in to comment.