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 1/7] 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" From 6690ce0c7887beb43cd8e156702c9a36c90390a8 Mon Sep 17 00:00:00 2001 From: Florian Wilhelm <2292245+fwilhe@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:43:53 +0000 Subject: [PATCH 2/7] Fix path --- .github/workflows/repo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 10c6eb9..495dbc9 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -25,7 +25,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: ostree-${{ matrix.arch }}-trixie-repo - path: .build/*.ostreeRepo.tar.gz + path: debian/.build/ostreeRepo-${{ matrix.arch }}-trixie*.ostreeRepo.tar.gz retention-days: 2 gardenlinux-repo: @@ -46,5 +46,5 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ matrix.platform }}_dev_curl-ostreeRepo-${{ matrix.arch }} - path: .build/${{ matrix.platform }}*ostreeRepo-${{ matrix.arch }}*.ostreeRepo.tar.gz + path: gardenlinux/.build/${{ matrix.platform }}*ostreeRepo-${{ matrix.arch }}*.ostreeRepo.tar.gz retention-days: 2 From edb246437815a61e10174cd60765ffa4201d4ba4 Mon Sep 17 00:00:00 2001 From: Florian Wilhelm <2292245+fwilhe@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:41:35 +0000 Subject: [PATCH 3/7] build-script --- build.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..2ebc2a1 --- /dev/null +++ b/build.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +platforms=("metal" "kvm") +architectures=("amd64" "arm64") + +pushd gardenlinux + +for platform in "${platforms[@]}" +do + for architecture in "${architectures[@]}" + do + ./build ${platform}_dev_curl-ostreeRepo-${architecture} + done +done + + + + +podp From e6fc709ba101465d567c6ee975513403066d91a7 Mon Sep 17 00:00:00 2001 From: Florian Wilhelm <2292245+fwilhe@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:42:11 +0000 Subject: [PATCH 4/7] build-script --- build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sh b/build.sh index 2ebc2a1..f0fb13a 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +set -e +set -u +set -o pipefail platforms=("metal" "kvm") architectures=("amd64" "arm64") From 074cbaaa948280a06969e745b5d21c5b52ccd1ac Mon Sep 17 00:00:00 2001 From: Florian Wilhelm <2292245+fwilhe@users.noreply.github.com> Date: Tue, 17 Oct 2023 11:19:02 +0000 Subject: [PATCH 5/7] Update remote urls --- build.sh | 14 ++++++++------ .../ostreeRepo/image.ostreeRepo.tar.gz | 18 +++++++++++------- .../ostreeRepo/image.ostreeRepo.tar.gz | 10 ++++++++-- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/build.sh b/build.sh index f0fb13a..2bf3d8a 100755 --- a/build.sh +++ b/build.sh @@ -4,10 +4,9 @@ set -u set -o pipefail platforms=("metal" "kvm") -architectures=("amd64" "arm64") +architectures=("arm64") pushd gardenlinux - for platform in "${platforms[@]}" do for architecture in "${architectures[@]}" @@ -15,8 +14,11 @@ do ./build ${platform}_dev_curl-ostreeRepo-${architecture} done done +popd - - - -podp +pushd debian +for architecture in "${architectures[@]}" +do + ./build ostreeRepo-${architecture} +done +popd diff --git a/debian/features/ostreeRepo/image.ostreeRepo.tar.gz b/debian/features/ostreeRepo/image.ostreeRepo.tar.gz index 063b41f..5d0a696 100755 --- a/debian/features/ostreeRepo/image.ostreeRepo.tar.gz +++ b/debian/features/ostreeRepo/image.ostreeRepo.tar.gz @@ -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" @@ -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 diff --git a/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz b/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz index ed7d9c6..7853d1f 100755 --- a/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz +++ b/gardenlinux/features/ostreeRepo/image.ostreeRepo.tar.gz @@ -14,7 +14,7 @@ OSTREE_SYSROOT="$MYROOT/sysroot" OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo OSTREE_REF="gardenlinux/today/$BUILDER_ARCH" -REMOTE_NAME="gardenlinux-$BUILDER_CNAME" +REMOTE_NAME="$BUILDER_CNAME".ostreeRepo REMOTE_ARCHIVE_NAME="$REMOTE_NAME.tar.gz" REMOTE_URL="http://ostree.gardenlinux.io" @@ -46,6 +46,12 @@ if curl --head --silent --fail $REMOTE_URL/$REMOTE_ARCHIVE_NAME 2> /dev/null; 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 "$REMOTE_NAME $(date --utc +%Y-%m-%dT%H:%M%Z)" "$rootfs_work" +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 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" From 72c866919644607975ccea3641f27fe615a4e8e6 Mon Sep 17 00:00:00 2001 From: Florian Wilhelm <2292245+fwilhe@users.noreply.github.com> Date: Tue, 17 Oct 2023 11:44:36 +0000 Subject: [PATCH 6/7] Update image builder --- debian/features/ostreeImage/image.ostree.raw | 8 ++++++-- gardenlinux/features/ostreeImage/image.ostree.raw | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/debian/features/ostreeImage/image.ostree.raw b/debian/features/ostreeImage/image.ostree.raw index 19d2fd7..3842401 100755 --- a/debian/features/ostreeImage/image.ostree.raw +++ b/debian/features/ostreeImage/image.ostree.raw @@ -16,6 +16,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" @@ -26,8 +30,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 diff --git a/gardenlinux/features/ostreeImage/image.ostree.raw b/gardenlinux/features/ostreeImage/image.ostree.raw index a7cc722..5027453 100755 --- a/gardenlinux/features/ostreeImage/image.ostree.raw +++ b/gardenlinux/features/ostreeImage/image.ostree.raw @@ -16,6 +16,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" @@ -26,8 +30,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 From 1ae9c4241d96580a682a54b39bcaca21711ff22e Mon Sep 17 00:00:00 2001 From: Florian Wilhelm <2292245+fwilhe@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:28:12 +0000 Subject: [PATCH 7/7] Add image workflow, workaround for repo url --- .github/workflows/image.yml | 46 +++++++++++++++++++ build.sh | 24 ---------- debian/features/ostreeImage/image.ostree.raw | 5 +- .../features/ostreeImage/image.ostree.raw | 5 +- gardenlinux/features/ostreeImage/info.yaml | 2 +- gardenlinux/features/ostreeRepo/info.yaml | 2 +- 6 files changed, 56 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/image.yml delete mode 100755 build.sh diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 0000000..768bfea --- /dev/null +++ b/.github/workflows/image.yml @@ -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 diff --git a/build.sh b/build.sh deleted file mode 100755 index 2bf3d8a..0000000 --- a/build.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -e -set -u -set -o pipefail - -platforms=("metal" "kvm") -architectures=("arm64") - -pushd gardenlinux -for platform in "${platforms[@]}" -do - for architecture in "${architectures[@]}" - do - ./build ${platform}_dev_curl-ostreeRepo-${architecture} - done -done -popd - -pushd debian -for architecture in "${architectures[@]}" -do - ./build ostreeRepo-${architecture} -done -popd diff --git a/debian/features/ostreeImage/image.ostree.raw b/debian/features/ostreeImage/image.ostree.raw index 3842401..afe1d5b 100755 --- a/debian/features/ostreeImage/image.ostree.raw +++ b/debian/features/ostreeImage/image.ostree.raw @@ -16,7 +16,10 @@ OSTREE_SYSROOT="$MYROOT/sysroot" OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo OSTREE_REF="debian/testing/$BUILDER_ARCH" -REMOTE_NAME="$BUILDER_CNAME".ostreeRepo +# 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" diff --git a/gardenlinux/features/ostreeImage/image.ostree.raw b/gardenlinux/features/ostreeImage/image.ostree.raw index 5027453..50bd6b0 100755 --- a/gardenlinux/features/ostreeImage/image.ostree.raw +++ b/gardenlinux/features/ostreeImage/image.ostree.raw @@ -16,7 +16,10 @@ OSTREE_SYSROOT="$MYROOT/sysroot" OSTREE_REPO=$OSTREE_SYSROOT/ostree/repo OSTREE_REF="gardenlinux/today/$BUILDER_ARCH" -REMOTE_NAME="$BUILDER_CNAME".ostreeRepo +# 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" diff --git a/gardenlinux/features/ostreeImage/info.yaml b/gardenlinux/features/ostreeImage/info.yaml index 6bc5f79..69ea904 100644 --- a/gardenlinux/features/ostreeImage/info.yaml +++ b/gardenlinux/features/ostreeImage/info.yaml @@ -1,2 +1,2 @@ description: 'image-based system using OSTree' -type: platform +type: element diff --git a/gardenlinux/features/ostreeRepo/info.yaml b/gardenlinux/features/ostreeRepo/info.yaml index 7127904..126b3d9 100644 --- a/gardenlinux/features/ostreeRepo/info.yaml +++ b/gardenlinux/features/ostreeRepo/info.yaml @@ -1,5 +1,5 @@ description: 'image-based system using OSTree' -type: flag +type: element features: exclude: - _boot