From cdee42f47947cedd832458dcc139a843898b9e9e Mon Sep 17 00:00:00 2001 From: Florian Wilhelm <2292245+fwilhe@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:30:39 +0000 Subject: [PATCH] Upload artifacts, use cname for artifact name --- .github/workflows/repo.yml | 12 +++++++ .../ostreeRepo/image.ostreeRepo.tar.gz | 35 ++++++++++--------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 62158fd..10c6eb9 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -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 @@ -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 diff --git a/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz b/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz index a18f208..ed7d9c6 100755 --- a/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz +++ b/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz @@ -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" @@ -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"